aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c8
-rw-r--r--tests/data/test1866
2 files changed, 11 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index e5279aa4f..093f6bed4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1202,9 +1202,17 @@ static int formparse(struct Configurable *config,
FreeMultiInfo (multi_start);
return 2; /* illegal content-type syntax! */
}
+
/* now point beyond the content-type specifier */
sep = (char *)type + strlen(major)+strlen(minor)+1;
+ /* there's a semicolon following - we check if it is a filename
+ specified and if not we simply assume that it is text that
+ the user wants included in the type and include that too up
+ to the next zero or semicolon. */
+ if((*sep==';') && !curlx_strnequal(";filname=", sep, 9))
+ sep = strchr(sep+1, ';');
+
if(*sep) {
*sep=0; /* zero terminate type string */
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
</name>
<command>
-http://%HOSTIP:%HTTPPORT/we/want/186 -F "name=daniel;type=moo/foo" -F "html= <body>hello</body>;type=text/html"
+http://%HOSTIP:%HTTPPORT/we/want/186 -F "name=daniel;type=moo/foo" -F "html= <body>hello</body>;type=text/html;charset=verymoo"
</command>
# We create this file before the command is invoked!
</client>
@@ -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
<body>hello</body>
------------------------------212d9006ceb5--