multi-socks: fix connect to proxy
authorDaniel Stenberg <daniel@haxx.se>
Thu, 28 Apr 2011 07:39:33 +0000 (09:39 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 28 Apr 2011 08:06:49 +0000 (10:06 +0200)
When connecting to a socks or similar proxy we do the proxy handshake at
once when we know the TCP connect is completed and we only consider the
"connection" complete after the proxy handshake. This fixes test 564
which is now no longer considered disabled.

Reported by: Dmitri Shubin
Bug: http://curl.haxx.se/mail/lib-2011-04/0127.html

lib/connect.c
lib/multi.c
tests/data/DISABLED
tests/data/test564

index 2cd8cd39cc21db69fc9a410436d97899f0d203c5..732fc6721330ff93e6754479c7308f630e9c4380 100644 (file)
@@ -698,7 +698,13 @@ CURLcode Curl_is_connected(struct connectdata *conn,
 
   if(WAITCONN_CONNECTED == rc) {
     if(verifyconnect(sockfd, &error)) {
-      /* we are connected, awesome! */
+      /* we are connected with TCP, awesome! */
+
+      /* see if we need to do any proxy magic first once we connected */
+      code = Curl_connected_proxy(conn);
+      if(code)
+        return code;
+
       conn->bits.tcpconnect = TRUE;
       *connected = TRUE;
       Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */
index 9b707abc4e9888b9b7dd120fd2703104331220e9..aee190ceaada0a877d06dd85e0e0e22f904fa772 100644 (file)
@@ -1141,8 +1141,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
                                        FIRSTSOCKET,
                                        &connected);
       if(connected) {
-        /* see if we need to do any proxy magic first once we connected */
-        easy->result = Curl_connected_proxy(easy->easy_conn);
 
         if(!easy->result)
           /* if everything is still fine we do the protocol-specific connect
index 9ac123b18294e421786cd880c9a7ec91422927d3..82123e6ae4bbb758886b6f1cacd86140385c76bf 100644 (file)
@@ -2,5 +2,4 @@
 # test cases are run by runtests.pl. Just add the plain test case numbers, one
 # per line.
 # Lines starting with '#' letters are treated as comments.
-564
 811
index 6d0609d9df8993f5bd74c54d2acace91570ffa76..72bf12919ef4f658cd9b296aa71da6415f4ae90d 100644 (file)
@@ -47,11 +47,8 @@ PWD
 CWD path\r
 EPSV\r
 TYPE I\r
-SIZE 546\r
-RETR 546\r
-EPSV\r
-SIZE 546\r
-RETR 546\r
+SIZE 564\r
+RETR 564\r
 QUIT\r
 </protocol>
 <stdout>