Loading lib/mime.c +11 −8 Original line number Diff line number Diff line Loading @@ -1619,7 +1619,7 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part, { curl_mime *mime = NULL; const char *boundary = NULL; char *s; char *customct; const char *cte = NULL; CURLcode ret = CURLE_OK; Loading @@ -1631,12 +1631,14 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part, if(part->state.state == MIMESTATE_CURLHEADERS) mimesetstate(&part->state, MIMESTATE_CURLHEADERS, NULL); /* Build the content-type header. */ s = search_header(part->userheaders, "Content-Type"); if(s) contenttype = s; if(part->mimetype) contenttype = part->mimetype; /* Check if content type is specified. */ customct = part->mimetype; if(!customct) customct = search_header(part->userheaders, "Content-Type"); if(customct) contenttype = customct; /* If content type is not specified, try to determine it. */ if(!contenttype) { switch(part->kind) { case MIMEKIND_MULTIPART: Loading @@ -1660,7 +1662,8 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part, if(mime) boundary = mime->boundary; } else if(contenttype && strcasecompare(contenttype, "text/plain")) else if(contenttype && !customct && strcasecompare(contenttype, "text/plain")) if(strategy == MIMESTRATEGY_MAIL || !part->filename) contenttype = NULL; Loading tests/data/test554 +4 −2 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ s/boundary=------------------------[a-z0-9]*/boundary=-------------------------- POST /554 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 718 Content-Length: 744 Content-Type: multipart/form-data; boundary=---------------------------- ------------------------------ Loading @@ -87,6 +87,7 @@ Content-Disposition: form-data; name="filename" postit2.c ------------------------------ Content-Disposition: form-data; name="submit" Content-Type: text/plain send ------------------------------ Loading @@ -98,7 +99,7 @@ blah blah POST /554 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 732 Content-Length: 758 Content-Type: multipart/form-data; boundary=---------------------------- ------------------------------ Loading @@ -117,6 +118,7 @@ Content-Disposition: form-data; name="filename" postit2.c ------------------------------ Content-Disposition: form-data; name="submit" Content-Type: text/plain send ------------------------------ Loading tests/data/test587 +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ s/boundary=------------------------[a-z0-9]*/boundary=-------------------------- POST /587 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 718 Content-Length: 744 Content-Type: multipart/form-data; boundary=---------------------------- ------------------------------ Loading tests/data/test650 +5 −4 Original line number Diff line number Diff line Loading @@ -63,9 +63,12 @@ Transfer-Encoding: chunked Content-Type: multipart/form-data; boundary=---------------------------- Expect: 100-continue 5f0 60a ------------------------------ Content-Disposition: form-data; name="fieldname" Content-Type: text/plain X-customheader-1: Header 1 data X-customheader-2: Header 2 data this is what we post to the silly web server ------------------------------ Loading Loading @@ -98,15 +101,13 @@ This is data from a file. ------------------------------ Content-Disposition: form-data; name="filecontents" X-customheader-1: Header 1 data X-customheader-2: Header 2 data This is data from a file. ------------------------------ Content-Disposition: form-data; name="formlength" 1341 1367 ------------------------------ Content-Disposition: form-data; name="standardinput" Content-Type: application/octet-stream Loading tests/libtest/lib554.c +5 −4 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ static int once(char *URL, bool oldstyle) CURLFORM_END); if(formrc) printf("curl_formadd(1) = %d\n", (int)formrc); printf("curl_formadd(2) = %d\n", (int)formrc); /* Fill in the filename field */ formrc = curl_formadd(&formpost, Loading @@ -134,7 +134,7 @@ static int once(char *URL, bool oldstyle) CURLFORM_END); if(formrc) printf("curl_formadd(2) = %d\n", (int)formrc); printf("curl_formadd(3) = %d\n", (int)formrc); /* Fill in a submit field too */ formrc = curl_formadd(&formpost, Loading @@ -147,10 +147,11 @@ static int once(char *URL, bool oldstyle) #else CURLFORM_COPYCONTENTS, "send", #endif CURLFORM_CONTENTTYPE, "text/plain", CURLFORM_END); if(formrc) printf("curl_formadd(3) = %d\n", (int)formrc); printf("curl_formadd(4) = %d\n", (int)formrc); formrc = curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "somename", Loading @@ -160,7 +161,7 @@ static int once(char *URL, bool oldstyle) CURLFORM_END); if(formrc) printf("curl_formadd(4) = %d\n", (int)formrc); printf("curl_formadd(5) = %d\n", (int)formrc); curl = curl_easy_init(); if(!curl) { Loading Loading
lib/mime.c +11 −8 Original line number Diff line number Diff line Loading @@ -1619,7 +1619,7 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part, { curl_mime *mime = NULL; const char *boundary = NULL; char *s; char *customct; const char *cte = NULL; CURLcode ret = CURLE_OK; Loading @@ -1631,12 +1631,14 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part, if(part->state.state == MIMESTATE_CURLHEADERS) mimesetstate(&part->state, MIMESTATE_CURLHEADERS, NULL); /* Build the content-type header. */ s = search_header(part->userheaders, "Content-Type"); if(s) contenttype = s; if(part->mimetype) contenttype = part->mimetype; /* Check if content type is specified. */ customct = part->mimetype; if(!customct) customct = search_header(part->userheaders, "Content-Type"); if(customct) contenttype = customct; /* If content type is not specified, try to determine it. */ if(!contenttype) { switch(part->kind) { case MIMEKIND_MULTIPART: Loading @@ -1660,7 +1662,8 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part, if(mime) boundary = mime->boundary; } else if(contenttype && strcasecompare(contenttype, "text/plain")) else if(contenttype && !customct && strcasecompare(contenttype, "text/plain")) if(strategy == MIMESTRATEGY_MAIL || !part->filename) contenttype = NULL; Loading
tests/data/test554 +4 −2 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ s/boundary=------------------------[a-z0-9]*/boundary=-------------------------- POST /554 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 718 Content-Length: 744 Content-Type: multipart/form-data; boundary=---------------------------- ------------------------------ Loading @@ -87,6 +87,7 @@ Content-Disposition: form-data; name="filename" postit2.c ------------------------------ Content-Disposition: form-data; name="submit" Content-Type: text/plain send ------------------------------ Loading @@ -98,7 +99,7 @@ blah blah POST /554 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 732 Content-Length: 758 Content-Type: multipart/form-data; boundary=---------------------------- ------------------------------ Loading @@ -117,6 +118,7 @@ Content-Disposition: form-data; name="filename" postit2.c ------------------------------ Content-Disposition: form-data; name="submit" Content-Type: text/plain send ------------------------------ Loading
tests/data/test587 +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ s/boundary=------------------------[a-z0-9]*/boundary=-------------------------- POST /587 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 718 Content-Length: 744 Content-Type: multipart/form-data; boundary=---------------------------- ------------------------------ Loading
tests/data/test650 +5 −4 Original line number Diff line number Diff line Loading @@ -63,9 +63,12 @@ Transfer-Encoding: chunked Content-Type: multipart/form-data; boundary=---------------------------- Expect: 100-continue 5f0 60a ------------------------------ Content-Disposition: form-data; name="fieldname" Content-Type: text/plain X-customheader-1: Header 1 data X-customheader-2: Header 2 data this is what we post to the silly web server ------------------------------ Loading Loading @@ -98,15 +101,13 @@ This is data from a file. ------------------------------ Content-Disposition: form-data; name="filecontents" X-customheader-1: Header 1 data X-customheader-2: Header 2 data This is data from a file. ------------------------------ Content-Disposition: form-data; name="formlength" 1341 1367 ------------------------------ Content-Disposition: form-data; name="standardinput" Content-Type: application/octet-stream Loading
tests/libtest/lib554.c +5 −4 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ static int once(char *URL, bool oldstyle) CURLFORM_END); if(formrc) printf("curl_formadd(1) = %d\n", (int)formrc); printf("curl_formadd(2) = %d\n", (int)formrc); /* Fill in the filename field */ formrc = curl_formadd(&formpost, Loading @@ -134,7 +134,7 @@ static int once(char *URL, bool oldstyle) CURLFORM_END); if(formrc) printf("curl_formadd(2) = %d\n", (int)formrc); printf("curl_formadd(3) = %d\n", (int)formrc); /* Fill in a submit field too */ formrc = curl_formadd(&formpost, Loading @@ -147,10 +147,11 @@ static int once(char *URL, bool oldstyle) #else CURLFORM_COPYCONTENTS, "send", #endif CURLFORM_CONTENTTYPE, "text/plain", CURLFORM_END); if(formrc) printf("curl_formadd(3) = %d\n", (int)formrc); printf("curl_formadd(4) = %d\n", (int)formrc); formrc = curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "somename", Loading @@ -160,7 +161,7 @@ static int once(char *URL, bool oldstyle) CURLFORM_END); if(formrc) printf("curl_formadd(4) = %d\n", (int)formrc); printf("curl_formadd(5) = %d\n", (int)formrc); curl = curl_easy_init(); if(!curl) { Loading