summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-09-04 10:45:02 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-09-04 11:45:10 +0200
commit988721ce3f87810eb636f75c16107e7978537ebd (patch)
tree12f92a6ad09c25b03b85fa0439036d615e637492
parent4ed618c023445d5d174e964055b1373e434d5e4f (diff)
downloadcurl-bagder/http-proxy-2xx.tar.gz
http-proxy: treat all 2xx as CONNECT successbagder/http-proxy-2xx
Added test 1904 to verify. Reported-by: Lawrence Wagerfield Fixes #1859
-rw-r--r--lib/http_proxy.c4
-rw-r--r--tests/data/Makefile.inc2
-rw-r--r--tests/data/test190479
3 files changed, 82 insertions, 3 deletions
diff --git a/lib/http_proxy.c b/lib/http_proxy.c
index 5a1dc0b86..f9b8b0f05 100644
--- a/lib/http_proxy.c
+++ b/lib/http_proxy.c
@@ -567,7 +567,7 @@ static CURLcode CONNECT(struct connectdata *conn,
if(error)
return CURLE_RECV_ERROR;
- if(data->info.httpproxycode != 200) {
+ if(data->info.httpproxycode/100 != 2) {
/* Deal with the possibly already received authenticate
headers. 'newurl' is set to a new URL if we must loop. */
result = Curl_http_auth_act(conn);
@@ -598,7 +598,7 @@ static CURLcode CONNECT(struct connectdata *conn,
} while(data->req.newurl);
- if(200 != data->req.httpcode) {
+ if(data->info.httpproxycode/100 != 2) {
if(closeConnection && data->req.newurl) {
conn->bits.proxy_connect_closed = TRUE;
infof(data, "Connect me again please\n");
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index 8db5b80d0..464faeeaf 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -173,7 +173,7 @@ test1700 test1701 test1702 \
\
test1800 test1801 \
\
-test1900 test1901 test1902 test1903 \
+test1900 test1901 test1902 test1903 test1904 \
\
test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 \
test2008 test2009 test2010 test2011 test2012 test2013 test2014 test2015 \
diff --git a/tests/data/test1904 b/tests/data/test1904
new file mode 100644
index 000000000..08ad534a6
--- /dev/null
+++ b/tests/data/test1904
@@ -0,0 +1,79 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+HTTP CONNECT
+HTTP proxy
+proxytunnel
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake swsclose
+Content-Type: text/html
+Funny-head: yesyes
+Content-Length: 9
+
+contents
+</data>
+<connect>
+HTTP/1.1 204 Sure go ahead
+
+</connect>
+<datacheck>
+HTTP/1.1 204 Sure go ahead
+
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake swsclose
+Content-Type: text/html
+Funny-head: yesyes
+Content-Length: 9
+
+contents
+</datacheck>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+http-proxy
+</server>
+ <name>
+HTTP CONNECT with 204 response
+ </name>
+ <command>
+http://test.1904:%HTTPPORT/we/want/that/page/1904 -p --proxy %HOSTIP:%PROXYPORT
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<proxy>
+CONNECT test.1904:%HTTPPORT HTTP/1.1
+Host: test.1904:%HTTPPORT
+User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
+Proxy-Connection: Keep-Alive
+
+</proxy>
+<protocol>
+GET /we/want/that/page/1904 HTTP/1.1
+Host: test.1904:%HTTPPORT
+User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
+Accept: */*
+
+</protocol>
+</verify>
+</testcase>