From 1ebda8fa0eedf04a9759bd08b904199b2c02a0bf Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 12 Mar 2004 08:55:47 +0000 Subject: [PATCH] Added CURLOPT_POSTFIELDSIZE_LARGE to offer a large file version of the CURLOPT_POSTFIELDSIZE option to allow really big HTTP POSTs. --- CHANGES | 6 ++++++ RELEASE-NOTES | 3 ++- docs/libcurl/curl_easy_setopt.3 | 7 ++++++- include/curl/curl.h | 3 +++ lib/url.c | 11 +++++++++-- lib/urldata.h | 6 +++--- 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 0d825af7f..f17894976 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,12 @@ Changelog +Daniel (12 March 2004) +- Added CURLOPT_POSTFIELDSIZE_LARGE, the large file version of + CURLOPT_POSTFIELDSIZE to allow POSTs larger than 2GB. + +- David Byron fixed an uninitialized variable case/crash. + Daniel (10 March 2004) - Jeff Lawson fixed the SSL connection to deal with received signals during the connect. diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 524b74d93..3b3041d8d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -3,10 +3,11 @@ Curl and libcurl 7.11.1. A bugfix release. Public curl release number: 79 Releases counted from the very beginning: 106 Available command line options: 94 - Available curl_easy_setopt() options: 111 + Available curl_easy_setopt() options: 112 This release includes the following changes: + o CURLOPT_POSTFIELDSIZE_LARGE added to offer POSTs larger than 2GB o CURL_VERSION_LARGEFILE is a feature bit returned by libcurls that feature large file support o libcurl only requires winsock 1.1 on windows now diff --git a/docs/libcurl/curl_easy_setopt.3 b/docs/libcurl/curl_easy_setopt.3 index afe04b29c..7feb1eb03 100644 --- a/docs/libcurl/curl_easy_setopt.3 +++ b/docs/libcurl/curl_easy_setopt.3 @@ -21,7 +21,7 @@ .\" * $Id$ .\" ************************************************************************** .\" -.TH curl_easy_setopt 3 "27 Feb 2004" "libcurl 7.11.1" "libcurl Manual" +.TH curl_easy_setopt 3 "12 Mar 2004" "libcurl 7.11.1" "libcurl Manual" .SH NAME curl_easy_setopt - set options for a curl easy handle .SH SYNOPSIS @@ -464,6 +464,11 @@ If you want to post data to the server without letting libcurl do a strlen() to measure the data size, this option must be used. When this option is used you can post fully binary data, which otherwise is likely to fail. If this size is set to zero, the library will use strlen() to get the size. +.IP CURLOPT_POSTFIELDSIZE_LARGE +Pass a curl_off_t as parameter. Use this to set the size of the +\fICURLOPT_POSTFIELDS\fP data to prevent libcurl from doing strlen() on the +data to figure out the size. This is the large file version of the +\fICURLOPT_POSTFIELDSIZE\fP option. .IP CURLOPT_HTTPPOST Tells libcurl you want a multipart/formdata HTTP POST to be made and you instruct what data to pass on to the server. Pass a pointer to a linked list diff --git a/include/curl/curl.h b/include/curl/curl.h index 5ba819213..0a3b32717 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -783,6 +783,9 @@ typedef enum { */ CINIT(FTP_SSL, LONG, 119), + /* The _LARGE version of the standard POSTFIELDSIZE option */ + CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120), + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; diff --git a/lib/url.c b/lib/url.c index 2b215bdbf..f7b7cc378 100644 --- a/lib/url.c +++ b/lib/url.c @@ -782,11 +782,18 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) break; case CURLOPT_POSTFIELDSIZE: /* - * The size of the POSTFIELD data, if curl should now do a strlen - * to find out. Enables binary posts. + * The size of the POSTFIELD data to prevent libcurl to do strlen() to + * figure it out. Enables binary posts. */ data->set.postfieldsize = va_arg(param, long); break; + case CURLOPT_POSTFIELDSIZE_LARGE: + /* + * The size of the POSTFIELD data to prevent libcurl to do strlen() to + * figure it out. Enables binary posts. + */ + data->set.postfieldsize = va_arg(param, curl_off_t); + break; case CURLOPT_REFERER: /* * String to set in the HTTP Referer: field. diff --git a/lib/urldata.h b/lib/urldata.h index 4e7b14e3f..1338c666e 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -780,9 +780,9 @@ struct UserDefined { char *useragent; /* User-Agent string */ char *encoding; /* Accept-Encoding string */ char *postfields; /* if POST, set the fields' values here */ - size_t postfieldsize; /* if POST, this might have a size to use instead of - strlen(), and then the data *may* be binary (contain - zero bytes) */ + curl_off_t postfieldsize; /* if POST, this might have a size to use instead + of strlen(), and then the data *may* be binary + (contain zero bytes) */ char *ftpport; /* port to send with the FTP PORT command */ char *device; /* network interface to use */ curl_write_callback fwrite; /* function that stores the output */