]> granicus.if.org Git - curl/commitdiff
http: send payload when (proxy) authentication is done
authorMarc Schlatter <mschlatter@gestour.com>
Mon, 11 Mar 2019 16:15:34 +0000 (17:15 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 13 Mar 2019 09:58:52 +0000 (10:58 +0100)
The check that prevents payload from sending in case of authentication
doesn't check properly if the authentication is done or not.

They're cases where the proxy respond "200 OK" before sending
authentication challenge. This change takes care of that.

Fixes #2431
Closes #3669

lib/http.c
tests/data/test1097

index 3618f8728bbf2c4f17167f1f17393b7a397c8f3f..3f41a451b95f7b4f1bbe0eea6f08af43f0810304 100644 (file)
@@ -2060,7 +2060,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
       return result;
   }
 
-  if((data->state.authhost.multipass || data->state.authproxy.multipass) &&
+  if(((data->state.authhost.multipass && !data->state.authhost.done)
+      || (data->state.authproxy.multipass && !data->state.authproxy.done)) &&
      (httpreq != HTTPREQ_GET) &&
      (httpreq != HTTPREQ_HEAD)) {
     /* Auth is required and we are not authenticated yet. Make a PUT or POST
index 7512a2e7dd73edef0985f86eaace4166065b5d20..7eb7b5f3d2e7e5976ecdd29d16a2e0bcd9de6942 100644 (file)
@@ -60,7 +60,7 @@ http://test.a.galaxy.far.far.away.1097:%HTTPPORT/1097 --proxy http://%HOSTIP:%HT
 <strip>
 ^User-Agent: curl/.*
 </strip>
-<protocol>
+<protocol nonewline="yes">
 CONNECT test.a.galaxy.far.far.away.1097:%HTTPPORT HTTP/1.1\r
 Host: test.a.galaxy.far.far.away.1097:%HTTPPORT\r
 Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=\r
@@ -71,9 +71,10 @@ POST /1097 HTTP/1.1
 User-Agent: curl/7.19.5-CVS (i686-pc-linux-gnu) libcurl/7.19.5-CVS OpenSSL/0.9.8g zlib/1.2.3.3 c-ares/1.6.1-CVS libidn/1.12 libssh2/1.0.1_CVS\r
 Host: test.a.galaxy.far.far.away.1097:%HTTPPORT\r
 Accept: */*\r
-Content-Length: 0\r
+Content-Length: 11\r
 Content-Type: application/x-www-form-urlencoded\r
 \r
+dummy=value
 </protocol>
 
 </verify>