http-proxy: treat all 2xx as CONNECT success

Added test 1904 to verify.

Reported-by: Lawrence Wagerfield
Fixes #1859
Closes #1860
This commit is contained in:
Daniel Stenberg 2017-09-04 10:45:02 +02:00
parent d491a9c3a8
commit 3130414ce7
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 84 additions and 4 deletions

View file

@ -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");
@ -634,7 +634,8 @@ static CURLcode CONNECT(struct connectdata *conn,
data->state.authproxy.done = TRUE;
infof(data, "Proxy replied OK to CONNECT request\n");
infof(data, "Proxy replied %d to CONNECT request\n",
data->info.httpproxycode);
data->req.ignorebody = FALSE; /* put it (back) to non-ignore state */
conn->bits.rewindaftersend = FALSE; /* make sure this isn't set for the
document request */