mirror of
https://github.com/moparisthebest/curl
synced 2025-03-11 07:39:50 -04:00
Remove stray CRLF in chunk-encoded content-free request bodies
.. that are sent when auth-negotiating before a chunked upload or when setting the 'Transfer-Encoding: chunked' header and intentionally sending no content. Adjust test565 and test1333 accordingly.
This commit is contained in:
parent
68e2c9a85f
commit
0683adbf50
16
lib/http.c
16
lib/http.c
@ -2484,15 +2484,19 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
if(postsize) {
|
if(postsize) {
|
||||||
/* Append the POST data chunky-style */
|
/* Append the POST data chunky-style */
|
||||||
result = Curl_add_bufferf(req_buffer, "%x\r\n", (int)postsize);
|
result = Curl_add_bufferf(req_buffer, "%x\r\n", (int)postsize);
|
||||||
if(CURLE_OK == result)
|
if(CURLE_OK == result) {
|
||||||
result = Curl_add_buffer(req_buffer, data->set.postfields,
|
result = Curl_add_buffer(req_buffer, data->set.postfields,
|
||||||
(size_t)postsize);
|
(size_t)postsize);
|
||||||
|
if(CURLE_OK == result)
|
||||||
|
result = Curl_add_buffer(req_buffer, "\r\n", 2);
|
||||||
|
included_body = postsize + 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(CURLE_OK == result)
|
if(CURLE_OK == result)
|
||||||
result = Curl_add_buffer(req_buffer,
|
result = Curl_add_buffer(req_buffer,
|
||||||
"\x0d\x0a\x30\x0d\x0a\x0d\x0a", 7);
|
"\x30\x0d\x0a\x0d\x0a", 5);
|
||||||
/* CR LF 0 CR LF CR LF */
|
/* 0 CR LF CR LF */
|
||||||
included_body = postsize + 7;
|
included_body += 5;
|
||||||
}
|
}
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
@ -2526,8 +2530,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
/* Chunky upload is selected and we're negotiating auth still, send
|
/* Chunky upload is selected and we're negotiating auth still, send
|
||||||
end-of-data only */
|
end-of-data only */
|
||||||
result = Curl_add_buffer(req_buffer,
|
result = Curl_add_buffer(req_buffer,
|
||||||
"\x0d\x0a\x30\x0d\x0a\x0d\x0a", 7);
|
"\x30\x0d\x0a\x0d\x0a", 5);
|
||||||
/* CR LF 0 CR LF CR LF */
|
/* 0 CR LF CR LF */
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ Accept: */*
|
|||||||
Transfer-Encoding: chunked
|
Transfer-Encoding: chunked
|
||||||
Content-Type: application/x-www-form-urlencoded
|
Content-Type: application/x-www-form-urlencoded
|
||||||
|
|
||||||
|
|
||||||
0
|
0
|
||||||
|
|
||||||
</protocol>
|
</protocol>
|
||||||
|
@ -79,7 +79,6 @@ Accept: */*
|
|||||||
Transfer-Encoding: chunked
|
Transfer-Encoding: chunked
|
||||||
Content-Type: application/x-www-form-urlencoded
|
Content-Type: application/x-www-form-urlencoded
|
||||||
|
|
||||||
|
|
||||||
0
|
0
|
||||||
|
|
||||||
POST /565 HTTP/1.1
|
POST /565 HTTP/1.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user