Loading CHANGES +4 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,10 @@ Changelog Patrick M (15 October 2007) - Fixed the dynamic CURLOPT_POSTFIELDS problem: this option is now static again and option CURLOPT_COPYPOSTFIELDS has been added to support dynamic mode. Patrick M (12 October 2007) - Added per-protocol callback static tables, replacing callback ptr storage in the connectdata structure by a single handler table ptr. Loading docs/libcurl/curl_easy_setopt.3 +25 −6 Original line number Diff line number Diff line Loading @@ -386,8 +386,7 @@ POST/PUT and a 401 or 407 is received immediately afterwards. .SH NETWORK OPTIONS .IP CURLOPT_URL The actual URL to deal with. The parameter should be a char * to a zero terminated string. The string must remain present until curl no longer needs it, as it doesn't copy the string. terminated string. If the given URL lacks the protocol part ("http://" or "ftp://" etc), it will attempt to guess which protocol to use based on the given host name. If the Loading Loading @@ -662,14 +661,16 @@ also make the library use the a "Content-Type: application/x-www-form-urlencoded" header. (This is by far the most commonly used POST method). Use the \fICURLOPT_POSTFIELDS\fP option to specify what data to post and \fICURLOPT_POSTFIELDSIZE\fP to set the data size. Use one of \fICURLOPT_POSTFIELDS\fP or \fICURLOPT_COPYPOSTFIELDS\fP options to specify what data to post and \fICURLOPT_POSTFIELDSIZE\fP or \fICURLOPT_POSTFIELDSIZE_LARGE\fP to set the data size. Optionally, you can provide data to POST using the \fICURLOPT_READFUNCTION\fP and \fICURLOPT_READDATA\fP options but then you must make sure to not set \fICURLOPT_POSTFIELDS\fP to anything but NULL. When providing data with a callback, you must transmit it using chunked transfer-encoding or you must set the size of the data with the \fICURLOPT_POSTFIELDSIZE\fP option. the size of the data with the \fICURLOPT_POSTFIELDSIZE\fP or \fICURLOPT_POSTFIELDSIZE_LARGE\fP option. You can override the default POST Content-Type: header by setting your own with \fICURLOPT_HTTPHEADER\fP. Loading @@ -690,11 +691,14 @@ If you issue a POST request and then want to make a HEAD or GET using the same re-used handle, you must explicitly set the new request type using \fICURLOPT_NOBODY\fP or \fICURLOPT_HTTPGET\fP or similar. .IP CURLOPT_POSTFIELDS Pass a char * as parameter, which should be the full data to post in an HTTP Pass a void * as parameter, which should be the full data to post in an HTTP POST operation. You must make sure that the data is formatted the way you want the server to receive it. libcurl will not convert or encode it for you. Most web servers will assume this data to be url-encoded. Take note. The pointed data are NOT copied by the library: as a consequence, they must be preserved by the calling application until the transfer finishes. This POST is a normal application/x-www-form-urlencoded kind (and libcurl will set that Content-Type by default when this option is used), which is the most commonly used one by HTML forms. See also the \fICURLOPT_POST\fP. Using Loading @@ -721,6 +725,21 @@ 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. (Added in 7.11.1) .IP CURLOPT_COPYPOSTFIELDS Pass a char * as parameter, which should be the full data to post in an HTTP POST operation. It behaves has the \fICURLOPT_POSTFIELDS\fP option, but the original data are copied by the library, allowing the application to overwrite the original data after setting this option. Because data are copied, care must be taken when using this option in conjunction with \fICURLOPT_POSTFIELDSIZE\fP or \fICURLOPT_POSTFIELDSIZE_LARGE\fP: If the size has not been set prior to \fICURLOPT_COPYPOSTFIELDS\fP, the data are assumed to be a null-terminated string; else the stored size informs the library about the data byte count to copy. In any case, the size must not be changed after \fICURLOPT_COPYPOSTFIELDS\fP, unless another \fICURLOPT_POSTFIELDS\fP or \fICURLOPT_COPYPOSTFIELDS\fP option is issued. .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 Loading include/curl/curl.h +4 −1 Original line number Diff line number Diff line Loading @@ -659,7 +659,7 @@ typedef enum { */ CINIT(INFILESIZE, LONG, 14), /* POST input fields. */ /* POST static input fields. */ CINIT(POSTFIELDS, OBJECTPOINT, 15), /* Set the referer page (needed by some CGIs) */ Loading Loading @@ -1156,6 +1156,9 @@ typedef enum { CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163), CINIT(OPENSOCKETDATA, OBJECTPOINT, 164), /* POST volatile input fields. */ CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165), CURLOPT_LASTENTRY /* the last unused */ } CURLoption; Loading lib/config-os400.h +3 −0 Original line number Diff line number Diff line Loading @@ -361,6 +361,9 @@ /* The size of a `long double', as computed by sizeof. */ #define SIZEOF_LONG_DOUBLE 8 /* Define if 64 bit integers are supported. */ #define HAVE_LONGLONG /* The size of a `long long', as computed by sizeof. */ #define SIZEOF_LONG_LONG 8 Loading lib/http.c +5 −6 Original line number Diff line number Diff line Loading @@ -2554,8 +2554,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* figure out the size of the postfields */ postsize = (data->set.postfieldsize != -1)? data->set.postfieldsize: (data->set.str[STRING_POSTFIELDS]? (curl_off_t)strlen(data->set.str[STRING_POSTFIELDS]):0); (data->set.postfields? (curl_off_t)strlen(data->set.postfields):0); if(!conn->bits.upload_chunky) { /* We only set Content-Length and allow a custom Content-Length if Loading @@ -2580,7 +2579,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) return result; } if(data->set.str[STRING_POSTFIELDS]) { if(data->set.postfields) { /* for really small posts we don't use Expect: headers at all, and for the somewhat bigger ones we allow the app to disable it */ Loading Loading @@ -2608,7 +2607,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) if(!conn->bits.upload_chunky) { /* We're not sending it 'chunked', append it to the request already now to reduce the number if send() calls */ result = add_buffer(req_buffer, data->set.str[STRING_POSTFIELDS], result = add_buffer(req_buffer, data->set.postfields, (size_t)postsize); included_body = postsize; } Loading @@ -2616,7 +2615,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* Append the POST data chunky-style */ result = add_bufferf(req_buffer, "%x\r\n", (int)postsize); if(CURLE_OK == result) result = add_buffer(req_buffer, data->set.str[STRING_POSTFIELDS], result = add_buffer(req_buffer, data->set.postfields, (size_t)postsize); if(CURLE_OK == result) result = add_buffer(req_buffer, Loading @@ -2630,7 +2629,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) else { /* A huge POST coming up, do data separate from the request */ http->postsize = postsize; http->postdata = data->set.str[STRING_POSTFIELDS]; http->postdata = data->set.postfields; http->sending = HTTPSEND_BODY; Loading Loading
CHANGES +4 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,10 @@ Changelog Patrick M (15 October 2007) - Fixed the dynamic CURLOPT_POSTFIELDS problem: this option is now static again and option CURLOPT_COPYPOSTFIELDS has been added to support dynamic mode. Patrick M (12 October 2007) - Added per-protocol callback static tables, replacing callback ptr storage in the connectdata structure by a single handler table ptr. Loading
docs/libcurl/curl_easy_setopt.3 +25 −6 Original line number Diff line number Diff line Loading @@ -386,8 +386,7 @@ POST/PUT and a 401 or 407 is received immediately afterwards. .SH NETWORK OPTIONS .IP CURLOPT_URL The actual URL to deal with. The parameter should be a char * to a zero terminated string. The string must remain present until curl no longer needs it, as it doesn't copy the string. terminated string. If the given URL lacks the protocol part ("http://" or "ftp://" etc), it will attempt to guess which protocol to use based on the given host name. If the Loading Loading @@ -662,14 +661,16 @@ also make the library use the a "Content-Type: application/x-www-form-urlencoded" header. (This is by far the most commonly used POST method). Use the \fICURLOPT_POSTFIELDS\fP option to specify what data to post and \fICURLOPT_POSTFIELDSIZE\fP to set the data size. Use one of \fICURLOPT_POSTFIELDS\fP or \fICURLOPT_COPYPOSTFIELDS\fP options to specify what data to post and \fICURLOPT_POSTFIELDSIZE\fP or \fICURLOPT_POSTFIELDSIZE_LARGE\fP to set the data size. Optionally, you can provide data to POST using the \fICURLOPT_READFUNCTION\fP and \fICURLOPT_READDATA\fP options but then you must make sure to not set \fICURLOPT_POSTFIELDS\fP to anything but NULL. When providing data with a callback, you must transmit it using chunked transfer-encoding or you must set the size of the data with the \fICURLOPT_POSTFIELDSIZE\fP option. the size of the data with the \fICURLOPT_POSTFIELDSIZE\fP or \fICURLOPT_POSTFIELDSIZE_LARGE\fP option. You can override the default POST Content-Type: header by setting your own with \fICURLOPT_HTTPHEADER\fP. Loading @@ -690,11 +691,14 @@ If you issue a POST request and then want to make a HEAD or GET using the same re-used handle, you must explicitly set the new request type using \fICURLOPT_NOBODY\fP or \fICURLOPT_HTTPGET\fP or similar. .IP CURLOPT_POSTFIELDS Pass a char * as parameter, which should be the full data to post in an HTTP Pass a void * as parameter, which should be the full data to post in an HTTP POST operation. You must make sure that the data is formatted the way you want the server to receive it. libcurl will not convert or encode it for you. Most web servers will assume this data to be url-encoded. Take note. The pointed data are NOT copied by the library: as a consequence, they must be preserved by the calling application until the transfer finishes. This POST is a normal application/x-www-form-urlencoded kind (and libcurl will set that Content-Type by default when this option is used), which is the most commonly used one by HTML forms. See also the \fICURLOPT_POST\fP. Using Loading @@ -721,6 +725,21 @@ 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. (Added in 7.11.1) .IP CURLOPT_COPYPOSTFIELDS Pass a char * as parameter, which should be the full data to post in an HTTP POST operation. It behaves has the \fICURLOPT_POSTFIELDS\fP option, but the original data are copied by the library, allowing the application to overwrite the original data after setting this option. Because data are copied, care must be taken when using this option in conjunction with \fICURLOPT_POSTFIELDSIZE\fP or \fICURLOPT_POSTFIELDSIZE_LARGE\fP: If the size has not been set prior to \fICURLOPT_COPYPOSTFIELDS\fP, the data are assumed to be a null-terminated string; else the stored size informs the library about the data byte count to copy. In any case, the size must not be changed after \fICURLOPT_COPYPOSTFIELDS\fP, unless another \fICURLOPT_POSTFIELDS\fP or \fICURLOPT_COPYPOSTFIELDS\fP option is issued. .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 Loading
include/curl/curl.h +4 −1 Original line number Diff line number Diff line Loading @@ -659,7 +659,7 @@ typedef enum { */ CINIT(INFILESIZE, LONG, 14), /* POST input fields. */ /* POST static input fields. */ CINIT(POSTFIELDS, OBJECTPOINT, 15), /* Set the referer page (needed by some CGIs) */ Loading Loading @@ -1156,6 +1156,9 @@ typedef enum { CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163), CINIT(OPENSOCKETDATA, OBJECTPOINT, 164), /* POST volatile input fields. */ CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165), CURLOPT_LASTENTRY /* the last unused */ } CURLoption; Loading
lib/config-os400.h +3 −0 Original line number Diff line number Diff line Loading @@ -361,6 +361,9 @@ /* The size of a `long double', as computed by sizeof. */ #define SIZEOF_LONG_DOUBLE 8 /* Define if 64 bit integers are supported. */ #define HAVE_LONGLONG /* The size of a `long long', as computed by sizeof. */ #define SIZEOF_LONG_LONG 8 Loading
lib/http.c +5 −6 Original line number Diff line number Diff line Loading @@ -2554,8 +2554,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* figure out the size of the postfields */ postsize = (data->set.postfieldsize != -1)? data->set.postfieldsize: (data->set.str[STRING_POSTFIELDS]? (curl_off_t)strlen(data->set.str[STRING_POSTFIELDS]):0); (data->set.postfields? (curl_off_t)strlen(data->set.postfields):0); if(!conn->bits.upload_chunky) { /* We only set Content-Length and allow a custom Content-Length if Loading @@ -2580,7 +2579,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) return result; } if(data->set.str[STRING_POSTFIELDS]) { if(data->set.postfields) { /* for really small posts we don't use Expect: headers at all, and for the somewhat bigger ones we allow the app to disable it */ Loading Loading @@ -2608,7 +2607,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) if(!conn->bits.upload_chunky) { /* We're not sending it 'chunked', append it to the request already now to reduce the number if send() calls */ result = add_buffer(req_buffer, data->set.str[STRING_POSTFIELDS], result = add_buffer(req_buffer, data->set.postfields, (size_t)postsize); included_body = postsize; } Loading @@ -2616,7 +2615,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* Append the POST data chunky-style */ result = add_bufferf(req_buffer, "%x\r\n", (int)postsize); if(CURLE_OK == result) result = add_buffer(req_buffer, data->set.str[STRING_POSTFIELDS], result = add_buffer(req_buffer, data->set.postfields, (size_t)postsize); if(CURLE_OK == result) result = add_buffer(req_buffer, Loading @@ -2630,7 +2629,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) else { /* A huge POST coming up, do data separate from the request */ http->postsize = postsize; http->postdata = data->set.str[STRING_POSTFIELDS]; http->postdata = data->set.postfields; http->sending = HTTPSEND_BODY; Loading