diff --git a/lib/http.c b/lib/http.c index 07a202b96..e0d3cda9b 100644 --- a/lib/http.c +++ b/lib/http.c @@ -815,8 +815,6 @@ CURLcode Curl_http(struct connectdata *conn) } if(HTTPREQ_POST_FORM == data->set.httpreq) { - char contentType[256]; - int linelength=0; if(Curl_FormInit(&http->form, http->sendit)) { failf(data, "Internal HTTP POST error!"); return CURLE_HTTP_POST_ERROR; @@ -840,10 +838,19 @@ CURLcode Curl_http(struct connectdata *conn) add_bufferf(req_buffer, "Expect: 100-continue\r\n"); data->set.expect100header = TRUE; + } + if(!checkheaders(data, "Content-Type:")) { /* Get Content-Type: line from Curl_FormReadOneLine, which happens to always be the first line. We can know this for sure since - we always build the formpost linked list the same way! */ + we always build the formpost linked list the same way! + + The Content-Type header line also contains the MIME boundary + string etc why disabling this header is likely to not make things + work, but we support it anyway. + */ + char contentType[256]; + int linelength=0; linelength = Curl_FormReadOneLine (contentType, sizeof(contentType), 1, @@ -853,11 +860,11 @@ CURLcode Curl_http(struct connectdata *conn) return CURLE_HTTP_POST_ERROR; } add_buffer(req_buffer, contentType, linelength); - - /* make the request end in a true CRLF */ - add_buffer(req_buffer, "\r\n", 2); } + /* make the request end in a true CRLF */ + add_buffer(req_buffer, "\r\n", 2); + /* set upload size to the progress meter */ Curl_pgrsSetUploadSize(data, http->postsize);