[curl/f15] sync the curl-multi code with upstream f551aa5 (several bug fixes)

Kamil Dudka kdudka at fedoraproject.org
Wed Jun 8 14:43:15 UTC 2011


commit fc44112bc4cef73a4e81ca648be3f79b8ba2da33
Author: Kamil Dudka <kdudka at redhat.com>
Date:   Wed Jun 8 16:21:38 2011 +0200

    sync the curl-multi code with upstream f551aa5 (several bug fixes)

 0003-curl-7.21.3-multi.patch |  173 ++++++++++++++++++++++++++++++++++++++++++
 curl.spec                    |    5 +
 2 files changed, 178 insertions(+), 0 deletions(-)
---
diff --git a/0003-curl-7.21.3-multi.patch b/0003-curl-7.21.3-multi.patch
new file mode 100644
index 0000000..ce99732
--- /dev/null
+++ b/0003-curl-7.21.3-multi.patch
@@ -0,0 +1,173 @@
+From 1ccdb4549499dcf12b938ac28c7e3646e83bdf1b Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel at haxx.se>
+Date: Thu, 17 Feb 2011 23:51:43 +0100
+Subject: [PATCH 1/3] multi: better failed connect treatment
+
+When failing to connect the protocol during the CURLM_STATE_PROTOCONNECT
+state, Curl_done() has to be called with the premature flag set TRUE as
+for the pingpong protocols this can be important.
+
+When Curl_done() is called with premature == TRUE, it needs to call
+Curl_disconnect() with its 'dead_connection' argument set to TRUE as
+well so that any protocol handler's disconnect function won't attempt to
+use the (control) connection for anything.
+
+This problem caused the pingpong protocols to fail to disconnect when
+STARTTLS failed.
+
+Reported by: Alona Rossen
+Bug: http://curl.haxx.se/mail/lib-2011-02/0195.html
+
+Signed-off-by: Kamil Dudka <kdudka at redhat.com>
+---
+ lib/multi.c |    2 +-
+ lib/url.c   |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/multi.c b/lib/multi.c
+index ff4bf86..6555ee6 100644
+--- a/lib/multi.c
++++ b/lib/multi.c
+@@ -1189,7 +1189,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
+       else if(easy->result) {
+         /* failure detected */
+         Curl_posttransfer(data);
+-        Curl_done(&easy->easy_conn, easy->result, FALSE);
++        Curl_done(&easy->easy_conn, easy->result, TRUE);
+         disconnect_conn = TRUE;
+       }
+       break;
+diff --git a/lib/url.c b/lib/url.c
+index d6e9d09..29fd43a 100644
+--- a/lib/url.c
++++ b/lib/url.c
+@@ -5233,7 +5233,7 @@ CURLcode Curl_done(struct connectdata **connp,
+   */
+   if(data->set.reuse_forbid || conn->bits.close || premature ||
+      (-1 == conn->connectindex)) {
+-    CURLcode res2 = Curl_disconnect(conn, FALSE); /* close the connection */
++    CURLcode res2 = Curl_disconnect(conn, premature); /* close the connection */
+ 
+     /* If we had an error already, make sure we return that one. But
+        if we got a new error, return that. */
+-- 
+1.7.4.4
+
+
+From e727dc4344fc5077c5b268045392f65b4f99c0f8 Mon Sep 17 00:00:00 2001
+From: Mike Crowe <mac at mcrowe.com>
+Date: Fri, 18 Feb 2011 23:19:14 +0100
+Subject: [PATCH 2/3] multi: close connection on timeout
+
+After a request times out, the connection wasn't properly closed and
+prevented to get re-used, so subsequent transfers could still mistakenly
+get to use the previously aborted connection.
+
+Signed-off-by: Kamil Dudka <kdudka at redhat.com>
+---
+ lib/multi.c |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/lib/multi.c b/lib/multi.c
+index 6555ee6..4d50b9c 100644
+--- a/lib/multi.c
++++ b/lib/multi.c
+@@ -1003,6 +1003,11 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
+                 Curl_tvdiff(now, data->progress.t_startsingle), k->bytecount,
+                 k->size);
+         }
++
++        /* Force the connection closed because the server could continue to
++           send us stuff at any time. (The disconnect_conn logic used below
++           doesn't work at this point). */
++        easy->easy_conn->bits.close = TRUE;
+         easy->result = CURLE_OPERATION_TIMEDOUT;
+         multistate(easy, CURLM_STATE_COMPLETED);
+         break;
+-- 
+1.7.4.4
+
+
+From 4f98cb97d689b1ef15d089a27fb0191b7de1c00c Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel at haxx.se>
+Date: Thu, 28 Apr 2011 09:39:33 +0200
+Subject: [PATCH 3/3] multi-socks: fix connect to proxy
+
+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
+
+Signed-off-by: Kamil Dudka <kdudka at redhat.com>
+---
+ lib/connect.c       |    8 +++++++-
+ lib/multi.c         |    2 --
+ tests/data/DISABLED |    1 -
+ tests/data/test564  |    7 ++-----
+ 4 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/lib/connect.c b/lib/connect.c
+index 7638854..8da2527 100644
+--- a/lib/connect.c
++++ b/lib/connect.c
+@@ -686,7 +686,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 */
+diff --git a/lib/multi.c b/lib/multi.c
+index 4d50b9c..575284b 100644
+--- a/lib/multi.c
++++ b/lib/multi.c
+@@ -1140,8 +1140,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
+diff --git a/tests/data/DISABLED b/tests/data/DISABLED
+index b6071cb..96328f1 100644
+--- a/tests/data/DISABLED
++++ b/tests/data/DISABLED
+@@ -2,4 +2,3 @@
+ # 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
+diff --git a/tests/data/test564 b/tests/data/test564
+index 6d0609d..72bf129 100644
+--- a/tests/data/test564
++++ b/tests/data/test564
+@@ -47,11 +47,8 @@ PWD
+ CWD path
+ EPSV
+ TYPE I
+-SIZE 546
+-RETR 546
+-EPSV
+-SIZE 546
+-RETR 546
++SIZE 564
++RETR 564
+ QUIT
+ </protocol>
+ <stdout>
+-- 
+1.7.4.4
+
diff --git a/curl.spec b/curl.spec
index f200cca..a348e85 100644
--- a/curl.spec
+++ b/curl.spec
@@ -14,6 +14,9 @@ Patch1: 0001-curl-7.21.3-f551aa5.patch
 # sync the NSS code with upstream f551aa5 (several bug fixes)
 Patch2: 0002-curl-7.21.3-nss.patch
 
+# sync the code of curl-multi with upstream f551aa5 (several bug fixes)
+Patch3: 0003-curl-7.21.3-multi.patch
+
 # Avoid buffer overflow report from glibc with FORTIFY_SOURCE
 Patch5: 0005-curl-7.21.3-tftpd-buffer-overflow.patch
 
@@ -118,6 +121,7 @@ done
 # upstream patches (already applied)
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 %patch5 -p1
 
 # Fedora patches
@@ -235,6 +239,7 @@ rm -rf $RPM_BUILD_ROOT
 * Wed Jun 08 2011 Kamil Dudka <kdudka at redhat.com> 7.21.3-7
 - avoid an invalid timeout event on a reused handle (#679709)
 - sync the NSS code with upstream f551aa5 (several bug fixes)
+- sync the code of curl-multi with upstream f551aa5 (several bug fixes)
 
 * Sat Apr 16 2011 Peter Robinson <pbrobinson at gmail.com> 7.21.3-6
 - no valgrind on ARMv5 arches


More information about the scm-commits mailing list