From eeb2cb05a1012d8aa61174c762698b39d19c3d5d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 21 Aug 2010 00:21:24 +0200 Subject: cmdline: make -F type= accept ;charset= The -F option allows some custom parameters within the given string, and those strings are separated with semicolons. You can for example specify "name=daniel;type=text/plain" to set content-type for the field. However, the use of semicolons like that made it not work fine if you specified one within the content-type, like for: "name=daniel;type=text/plain;charset=UTF-8" ... as the second one would be seen as a separator and "charset" is no parameter curl knows anything about so it was just silently discarded. The new logic now checks if the semicolon and following keyword looks like a parameter it knows about and if it isn't it is assumed to be meant to be used within the content-type string itself. I modified test case 186 to verify that this works as intended. Reported by: Larry Stone Bug: http://curl.haxx.se/bug/view.cgi?id=3048988 --- tests/data/test186 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/data/test186 b/tests/data/test186 index cbb36a8a2..5a1b7b9ac 100644 --- a/tests/data/test186 +++ b/tests/data/test186 @@ -21,7 +21,7 @@ http HTTP RFC1867-type formposting with types on text fields -http://%HOSTIP:%HTTPPORT/we/want/186 -F "name=daniel;type=moo/foo" -F "html= hello;type=text/html" +http://%HOSTIP:%HTTPPORT/we/want/186 -F "name=daniel;type=moo/foo" -F "html= hello;type=text/html;charset=verymoo" # We create this file before the command is invoked! @@ -36,7 +36,7 @@ POST /we/want/186 HTTP/1.1 User-Agent: curl/7.12.2-CVS (i686-pc-linux-gnu) libcurl/7.12.2-CVS OpenSSL/0.9.7d zlib/1.2.1.1 c-ares/1.2.0 libidn/0.5.2 Host: %HOSTIP:%HTTPPORT Accept: */* -Content-Length: 305 +Content-Length: 321 Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------212d9006ceb5 @@ -47,7 +47,7 @@ Content-Type: moo/foo daniel ------------------------------212d9006ceb5 Content-Disposition: form-data; name="html" -Content-Type: text/html +Content-Type: text/html;charset=verymoo hello ------------------------------212d9006ceb5-- -- cgit v1.2.3