aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-08-25 13:33:34 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-08-25 13:33:34 +0200
commit36a76380739660ce368d97289d87d0906c412d47 (patch)
tree32bf6250473615967eaacca00530c04ab966dca6
parent2603618831e45357d62fbc5154ad8a5a0f808134 (diff)
CONNECT: close proxy connections that fail to CONNECT
This is usually due to failed auth. There's no point in us keeping such a connection alive since it shouldn't be re-used anyway. Bug: http://curl.haxx.se/bug/view.cgi?id=1381 Reported-by: Marcel Raad
-rw-r--r--lib/http_proxy.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/http_proxy.c b/lib/http_proxy.c
index 17f1c00a1..5343eb718 100644
--- a/lib/http_proxy.c
+++ b/lib/http_proxy.c
@@ -554,10 +554,16 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
conn->bits.proxy_connect_closed = TRUE;
infof(data, "Connect me again please\n");
}
- else if(data->req.newurl) {
- /* this won't be used anymore for the CONNECT so free it now */
- free(data->req.newurl);
- data->req.newurl = NULL;
+ else {
+ if(data->req.newurl) {
+ /* this won't be used anymore for the CONNECT so free it now */
+ free(data->req.newurl);
+ data->req.newurl = NULL;
+ }
+ /* failure, close this connection to avoid re-use */
+ connclose(conn, "proxy CONNECT failure");
+ Curl_closesocket(conn, conn->sock[sockindex]);
+ conn->sock[sockindex] = CURL_SOCKET_BAD;
}
/* to back to init state */