diff options
author | Fabian Keil <fk@fabiankeil.de> | 2012-11-25 18:34:01 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2012-11-26 15:28:53 +0100 |
commit | 0683adbf50a99f0917c74cd3c5def77254ba9258 (patch) | |
tree | 931c3a00a05029872a9242ad282e3e0fd7684416 | |
parent | 68e2c9a85faca7708fdb0a09c7c3278fea75f98b (diff) |
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.
-rw-r--r-- | lib/http.c | 16 | ||||
-rw-r--r-- | tests/data/test1333 | 1 | ||||
-rw-r--r-- | tests/data/test565 | 1 |
3 files changed, 10 insertions, 8 deletions
diff --git a/lib/http.c b/lib/http.c index 4eee83221..965b37503 100644 --- a/lib/http.c +++ b/lib/http.c @@ -2484,15 +2484,19 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) if(postsize) { /* Append the POST data chunky-style */ 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, (size_t)postsize); + if(CURLE_OK == result) + result = Curl_add_buffer(req_buffer, "\r\n", 2); + included_body = postsize + 2; + } } if(CURLE_OK == result) result = Curl_add_buffer(req_buffer, - "\x0d\x0a\x30\x0d\x0a\x0d\x0a", 7); - /* CR LF 0 CR LF CR LF */ - included_body = postsize + 7; + "\x30\x0d\x0a\x0d\x0a", 5); + /* 0 CR LF CR LF */ + included_body += 5; } if(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 end-of-data only */ result = Curl_add_buffer(req_buffer, - "\x0d\x0a\x30\x0d\x0a\x0d\x0a", 7); - /* CR LF 0 CR LF CR LF */ + "\x30\x0d\x0a\x0d\x0a", 5); + /* 0 CR LF CR LF */ if(result) return result; } diff --git a/tests/data/test1333 b/tests/data/test1333 index 51ba75b4e..a2ea30143 100644 --- a/tests/data/test1333 +++ b/tests/data/test1333 @@ -47,7 +47,6 @@ Accept: */* Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded
-
0
</protocol> diff --git a/tests/data/test565 b/tests/data/test565 index fdf75a5f8..b8d12b45c 100644 --- a/tests/data/test565 +++ b/tests/data/test565 @@ -79,7 +79,6 @@ Accept: */* Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded
-
0
POST /565 HTTP/1.1
|