summaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorIsaac Boukris <iboukris@gmail.com>2017-02-03 14:30:26 +0200
committerJay Satiro <raysatiro@yahoo.com>2017-02-17 02:32:16 -0500
commit13e3a18b345af1a15b892b0bbedfbbff06e10a39 (patch)
tree287181977e87aab9d983c6ed118d3d8d86cb146e /lib/http.c
parent3cc30e8207b5ab3a9a381c0ff3584d1af8dc54a1 (diff)
downloadcurl-13e3a18b345af1a15b892b0bbedfbbff06e10a39.tar.gz
http: fix missing 'Content-Length: 0' while negotiating auth
- While negotiating auth during PUT/POST if a user-specified Content-Length header is set send 'Content-Length: 0'. This is what we do already in HTTPREQ_POST_FORM and what we did in the HTTPREQ_POST case (regression since afd288b). Prior to this change no Content-Length header would be sent in such a case. Bug: https://curl.haxx.se/mail/lib-2017-02/0006.html Reported-by: Dominik Hölzl Closes https://github.com/curl/curl/pull/1242
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/http.c b/lib/http.c
index 2066520e7..8db86cd84 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -2512,7 +2512,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
postsize = data->state.infilesize;
if((postsize != -1) && !data->req.upload_chunky &&
- !Curl_checkheaders(conn, "Content-Length:")) {
+ (conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length:"))) {
/* only add Content-Length if not uploading chunked */
result = Curl_add_bufferf(req_buffer,
"Content-Length: %" CURL_FORMAT_CURL_OFF_T
@@ -2564,7 +2564,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
we don't upload data chunked, as RFC2616 forbids us to set both
kinds of headers (Transfer-Encoding: chunked and Content-Length) */
if((postsize != -1) && !data->req.upload_chunky &&
- !Curl_checkheaders(conn, "Content-Length:")) {
+ (conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length:"))) {
/* we allow replacing this header if not during auth negotiation,
although it isn't very wise to actually set your own */
result = Curl_add_bufferf(req_buffer,