diff options
author | Patrick Monnerat <patrick@monnerat.net> | 2017-09-22 01:08:29 +0100 |
---|---|---|
committer | Patrick Monnerat <patrick@monnerat.net> | 2017-09-22 01:08:29 +0100 |
commit | ee56fdb6910f6bf215eecede9e2e9bfc83cb5f29 (patch) | |
tree | bfdbf1f3f2f5cd9f051f6b8d0b2469c51b2660ef /docs | |
parent | fa9482ab0907dfacd0fb619add2dbf41de2d8c9c (diff) |
form/mime: field names are not allowed to contain zero-valued bytes.
Also suppress length argument of curl_mime_name() (names are always
zero-terminated).
Diffstat (limited to 'docs')
-rw-r--r-- | docs/examples/multi-post.c | 6 | ||||
-rw-r--r-- | docs/examples/postit2.c | 6 | ||||
-rw-r--r-- | docs/libcurl/curl_formadd.3 | 14 | ||||
-rw-r--r-- | docs/libcurl/curl_mime_addpart.3 | 2 | ||||
-rw-r--r-- | docs/libcurl/curl_mime_data.3 | 4 | ||||
-rw-r--r-- | docs/libcurl/curl_mime_data_cb.3 | 4 | ||||
-rw-r--r-- | docs/libcurl/curl_mime_filedata.3 | 6 | ||||
-rw-r--r-- | docs/libcurl/curl_mime_filename.3 | 8 | ||||
-rw-r--r-- | docs/libcurl/curl_mime_headers.3 | 2 | ||||
-rw-r--r-- | docs/libcurl/curl_mime_init.3 | 2 | ||||
-rw-r--r-- | docs/libcurl/curl_mime_name.3 | 17 | ||||
-rw-r--r-- | docs/libcurl/curl_mime_type.3 | 6 |
12 files changed, 36 insertions, 41 deletions
diff --git a/docs/examples/multi-post.c b/docs/examples/multi-post.c index 93c78e98d..95d71bea9 100644 --- a/docs/examples/multi-post.c +++ b/docs/examples/multi-post.c @@ -51,17 +51,17 @@ int main(void) /* Fill in the file upload field */ field = curl_mime_addpart(form); - curl_mime_name(field, "sendfile", CURL_ZERO_TERMINATED); + curl_mime_name(field, "sendfile"); curl_mime_filedata(field, "multi-post.c"); /* Fill in the filename field */ field = curl_mime_addpart(form); - curl_mime_name(field, "filename", CURL_ZERO_TERMINATED); + curl_mime_name(field, "filename"); curl_mime_data(field, "multi-post.c", CURL_ZERO_TERMINATED); /* Fill in the submit field too, even if this is rarely needed */ field = curl_mime_addpart(form); - curl_mime_name(field, "submit", CURL_ZERO_TERMINATED); + curl_mime_name(field, "submit"); curl_mime_data(field, "send", CURL_ZERO_TERMINATED); /* initialize custom header list (stating that Expect: 100-continue is not diff --git a/docs/examples/postit2.c b/docs/examples/postit2.c index ca5c77dc4..49391e1cd 100644 --- a/docs/examples/postit2.c +++ b/docs/examples/postit2.c @@ -61,17 +61,17 @@ int main(int argc, char *argv[]) /* Fill in the file upload field */ field = curl_mime_addpart(form); - curl_mime_name(field, "sendfile", CURL_ZERO_TERMINATED); + curl_mime_name(field, "sendfile"); curl_mime_filedata(field, "postit2.c"); /* Fill in the filename field */ field = curl_mime_addpart(form); - curl_mime_name(field, "filename", CURL_ZERO_TERMINATED); + curl_mime_name(field, "filename"); curl_mime_data(field, "postit2.c", CURL_ZERO_TERMINATED); /* Fill in the submit field too, even if this is rarely needed */ field = curl_mime_addpart(form); - curl_mime_name(field, "submit", CURL_ZERO_TERMINATED); + curl_mime_name(field, "submit"); curl_mime_data(field, "send", CURL_ZERO_TERMINATED); /* initialize custom header list (stating that Expect: 100-continue is not diff --git a/docs/libcurl/curl_formadd.3 b/docs/libcurl/curl_formadd.3 index 652663b7c..39a749b7c 100644 --- a/docs/libcurl/curl_formadd.3 +++ b/docs/libcurl/curl_formadd.3 @@ -62,16 +62,15 @@ parts. .IP CURLFORM_COPYNAME followed by a string which provides the \fIname\fP of this part. libcurl copies the string so your application doesn't need to keep it around after -this function call. If the name isn't NUL-terminated, or if you'd -like it to contain zero bytes, you must set its length with -\fBCURLFORM_NAMELENGTH\fP. The copied data will be freed by -\fIcurl_formfree(3)\fP. +this function call. If the name isn't NUL-terminated, you must set its length +with \fBCURLFORM_NAMELENGTH\fP. The \fIname\fP is not allowed to contain +zero-valued bytes. The copied data will be freed by \fIcurl_formfree(3)\fP. .IP CURLFORM_PTRNAME followed by a string which provides the \fIname\fP of this part. libcurl will use the pointer and refer to the data in your application, so you must make sure it remains until curl no longer needs it. If the name -isn't NUL-terminated, or if you'd like it to contain zero -bytes, you must set its length with \fBCURLFORM_NAMELENGTH\fP. +isn't NUL-terminated, you must set its length with \fBCURLFORM_NAMELENGTH\fP. +The \fIname\fP is not allowed to contain zero-valued bytes. .IP CURLFORM_COPYCONTENTS followed by a pointer to the contents of this part, the actual data to send away. libcurl copies the provided data, so your application doesn't @@ -172,7 +171,8 @@ you've called \fIcurl_easy_cleanup(3)\fP for the curl handle. See example below. .SH AVAILABILITY -Deprecated in 7.56.0. +Deprecated in 7.56.0. Before this release, field names were allowed to +contain zero-valued bytes. .SH RETURN VALUE 0 means everything was ok, non-zero means an error occurred corresponding to a CURL_FORMADD_* constant defined in diff --git a/docs/libcurl/curl_mime_addpart.3 b/docs/libcurl/curl_mime_addpart.3 index 5ea8171de..22350668a 100644 --- a/docs/libcurl/curl_mime_addpart.3 +++ b/docs/libcurl/curl_mime_addpart.3 @@ -51,7 +51,7 @@ A mime part structure handle, or NULL upon failure. /* continue and set name + data to the part */ curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED); - curl_mime_name(part, "data", CURL_ZERO_TERMINATED); + curl_mime_name(part, "data"); .fi .SH "SEE ALSO" .BR curl_mime_init "(3)," diff --git a/docs/libcurl/curl_mime_data.3 b/docs/libcurl/curl_mime_data.3 index 7ed8eeb3b..d2112f2d4 100644 --- a/docs/libcurl/curl_mime_data.3 +++ b/docs/libcurl/curl_mime_data.3 @@ -64,6 +64,6 @@ CURLE_OK or a CURL error code upon failure. .fi .SH "SEE ALSO" .BR curl_mime_addpart "(3)," -.BR curl_mime_data_cb "(3)" -.BR curl_mime_name "(3)" +.BR curl_mime_data_cb "(3)," +.BR curl_mime_name "(3)," .BR curl_mime_type "(3)" diff --git a/docs/libcurl/curl_mime_data_cb.3 b/docs/libcurl/curl_mime_data_cb.3 index b174d3b37..bc74a85a5 100644 --- a/docs/libcurl/curl_mime_data_cb.3 +++ b/docs/libcurl/curl_mime_data_cb.3 @@ -155,6 +155,6 @@ int seek_callback(void *arg, curl_off_t offset, int origin) &hugectl); .SH "SEE ALSO" -.BR curl_mime_addpart "(3)" -.BR curl_mime_data "(3)" +.BR curl_mime_addpart "(3)," +.BR curl_mime_data "(3)," .BR curl_mime_name "(3)" diff --git a/docs/libcurl/curl_mime_filedata.3 b/docs/libcurl/curl_mime_filedata.3 index f9cea3ce8..9a57068de 100644 --- a/docs/libcurl/curl_mime_filedata.3 +++ b/docs/libcurl/curl_mime_filedata.3 @@ -68,10 +68,10 @@ CURLE_OK or a CURL error code upon failure. curl_mime_filedata(part, "image.png"); /* set name */ - curl_mime_name(part, "data", CURL_ZERO_TERMINATED); + curl_mime_name(part, "data"); .fi .SH "SEE ALSO" .BR curl_mime_addpart "(3)," .BR curl_mime_data "(3)," -.BR curl_mime_filename "(3)" -.BR curl_mime_name "(3)," +.BR curl_mime_filename "(3)," +.BR curl_mime_name "(3)" diff --git a/docs/libcurl/curl_mime_filename.3 b/docs/libcurl/curl_mime_filename.3 index e29726c1a..42916e598 100644 --- a/docs/libcurl/curl_mime_filename.3 +++ b/docs/libcurl/curl_mime_filename.3 @@ -64,9 +64,9 @@ CURLE_OK or a CURL error code upon failure. curl_mime_filename(part, "image.png"); /* set name */ - curl_mime_name(part, "data", CURL_ZERO_TERMINATED); + curl_mime_name(part, "data"); .fi .SH "SEE ALSO" -.BR curl_mime_addpart "(3) " -.BR curl_mime_filedata "(3) " -.BR curl_mime_data "(3) " +.BR curl_mime_addpart "(3)," +.BR curl_mime_filedata "(3)," +.BR curl_mime_data "(3)" diff --git a/docs/libcurl/curl_mime_headers.3 b/docs/libcurl/curl_mime_headers.3 index 87724ae1b..1d02e1ee5 100644 --- a/docs/libcurl/curl_mime_headers.3 +++ b/docs/libcurl/curl_mime_headers.3 @@ -59,7 +59,7 @@ CURLE_OK or a CURL error code upon failure. curl_mime_data(part, "12345679", CURL_ZERO_TERMINATED); /* set name */ - curl_mime_name(part, "numbers", CURL_ZERO_TERMINATED); + curl_mime_name(part, "numbers"); .fi .SH "SEE ALSO" .BR curl_mime_addpart "(3)" diff --git a/docs/libcurl/curl_mime_init.3 b/docs/libcurl/curl_mime_init.3 index 2f5617eef..469f02b7c 100644 --- a/docs/libcurl/curl_mime_init.3 +++ b/docs/libcurl/curl_mime_init.3 @@ -52,7 +52,7 @@ A mime struct handle, or NULL upon failure. mime = curl_mime_init(easy); part = curl_mime_addpart(mime); curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED); - curl_mime_name(part, "data", CURL_ZERO_TERMINATED); + curl_mime_name(part, "data"); /* Post and send it. */ curl_easy_setopt(easy, CURLOPT_MIMEPOST, mime); diff --git a/docs/libcurl/curl_mime_name.3 b/docs/libcurl/curl_mime_name.3 index 369598012..f821d9082 100644 --- a/docs/libcurl/curl_mime_name.3 +++ b/docs/libcurl/curl_mime_name.3 @@ -25,21 +25,16 @@ curl_mime_name - set a mime part's name .SH SYNOPSIS .B #include <curl/curl.h> .sp -.BI "CURLcode curl_mime_name(curl_mimepart * " part ", const char * " name -.BI ", size_t " namesize ");" +.BI "CURLcode curl_mime_name(curl_mimepart * " part ", const char * " name ");" .ad .SH DESCRIPTION \fIcurl_mime_name(3)\fP sets a mime part's name. This is the way HTTP form fields are named. -\fIname\fP points to the name byte string; the string may contain nul bytes -unless \fInamesize\fP is -1. - -\fInamesize\fP is the name length: it can be set to \fICURL_ZERO_TERMINATED\fP -to indicate \fIname\fP is a nul-terminated string. - \fIpart\fP is the part's handle to assign a name to. +\fIname\fP points to the zero-terminated name string. + The name string is copied into the part, thus the associated storage may safely be released or reused after call. Setting a part's name twice is valid: only the value set by the last call is retained. It is possible to "unname" a @@ -60,9 +55,9 @@ CURLE_OK or a CURL error code upon failure. part = curl_mime_addpart(mime); /* give the part a name */ - curl_mime_name(part, "shoe_size", CURL_ZERO_TERMINATED); + curl_mime_name(part, "shoe_size"); .fi .SH "SEE ALSO" -.BR curl_mime_addpart "(3)" -.BR curl_mime_data "(3)" +.BR curl_mime_addpart "(3)," +.BR curl_mime_data "(3)," .BR curl_mime_type "(3)" diff --git a/docs/libcurl/curl_mime_type.3 b/docs/libcurl/curl_mime_type.3 index 4882ceec2..59841d5bd 100644 --- a/docs/libcurl/curl_mime_type.3 +++ b/docs/libcurl/curl_mime_type.3 @@ -75,9 +75,9 @@ CURLE_OK or a CURL error code upon failure. curl_mime_type(part, "image/png"); /* set name */ - curl_mime_name(part, "image", CURL_ZERO_TERMINATED); + curl_mime_name(part, "image"); .fi .SH "SEE ALSO" -.BR curl_mime_addpart "(3)" -.BR curl_mime_name "(3)" +.BR curl_mime_addpart "(3)," +.BR curl_mime_name "(3)," .BR curl_mime_data "(3)" |