Blame SOURCES/0028-curl-7.61.1-http-auth-payload.patch

9b977c
From 5a51924c2505c1d5616904aa732fdaedd74d3ffe Mon Sep 17 00:00:00 2001
9b977c
From: Marc Schlatter <mschlatter@gestour.com>
9b977c
Date: Mon, 11 Mar 2019 17:15:34 +0100
9b977c
Subject: [PATCH] http: send payload when (proxy) authentication is done
9b977c
9b977c
The check that prevents payload from sending in case of authentication
9b977c
doesn't check properly if the authentication is done or not.
9b977c
9b977c
They're cases where the proxy respond "200 OK" before sending
9b977c
authentication challenge. This change takes care of that.
9b977c
9b977c
Fixes #2431
9b977c
Closes #3669
9b977c
9b977c
Upstream-commit: dd8a19f8a05b59394d1ab33c09497e8db884742a
9b977c
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
9b977c
---
9b977c
 lib/http.c          | 3 ++-
9b977c
 tests/data/test1097 | 5 +++--
9b977c
 2 files changed, 5 insertions(+), 3 deletions(-)
9b977c
9b977c
diff --git a/lib/http.c b/lib/http.c
9b977c
index e727ed8..26eb52d 100644
9b977c
--- a/lib/http.c
9b977c
+++ b/lib/http.c
9b977c
@@ -1991,7 +1991,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
9b977c
   if(result)
9b977c
     return result;
9b977c
 
9b977c
-  if((data->state.authhost.multipass || data->state.authproxy.multipass) &&
9b977c
+  if(((data->state.authhost.multipass && !data->state.authhost.done)
9b977c
+      || (data->state.authproxy.multipass && !data->state.authproxy.done)) &&
9b977c
      (httpreq != HTTPREQ_GET) &&
9b977c
      (httpreq != HTTPREQ_HEAD)) {
9b977c
     /* Auth is required and we are not authenticated yet. Make a PUT or POST
9b977c
diff --git a/tests/data/test1097 b/tests/data/test1097
9b977c
index 7512a2e..7eb7b5f 100644
9b977c
--- a/tests/data/test1097
9b977c
+++ b/tests/data/test1097
9b977c
@@ -60,7 +60,7 @@ http://test.a.galaxy.far.far.away.1097:%HTTPPORT/1097 --proxy http://%HOSTIP:%HT
9b977c
 <strip>
9b977c
 ^User-Agent: curl/.*
9b977c
 </strip>
9b977c
-<protocol>
9b977c
+<protocol nonewline="yes">
9b977c
 CONNECT test.a.galaxy.far.far.away.1097:%HTTPPORT HTTP/1.1
9b977c
 Host: test.a.galaxy.far.far.away.1097:%HTTPPORT
9b977c
 Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
9b977c
@@ -71,9 +71,10 @@ POST /1097 HTTP/1.1
9b977c
 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
9b977c
 Host: test.a.galaxy.far.far.away.1097:%HTTPPORT
9b977c
 Accept: */*
9b977c
-Content-Length: 0
9b977c
+Content-Length: 11
9b977c
 Content-Type: application/x-www-form-urlencoded
9b977c
 
9b977c
+dummy=value
9b977c
 </protocol>
9b977c
 
9b977c
 </verify>
9b977c
-- 
9b977c
2.26.2
9b977c