Blame SOURCES/0033-curl-7.29.0-29bf0598.patch

92baa4
From f9ebe8047f5f62dfcee379b010d8207f0d6985b1 Mon Sep 17 00:00:00 2001
92baa4
From: Daniel Stenberg <daniel@haxx.se>
92baa4
Date: Mon, 3 Jun 2013 20:19:51 +0200
92baa4
Subject: [PATCH 1/5] curl_multi_wait: reduce timeout if the multi handle wants
92baa4
 to
92baa4
92baa4
If the multi handle's pending timeout is less than what is passed into
92baa4
this function, it will now opt to use the shorter time anyway since it
92baa4
is a very good hint that the handle wants to process something in a
92baa4
shorter time than what otherwise would happen.
92baa4
92baa4
curl_multi_wait.3 was updated accordingly to clarify
92baa4
92baa4
This is the reason for bug #1224
92baa4
92baa4
Bug: http://curl.haxx.se/bug/view.cgi?id=1224
92baa4
Reported-by: Andrii Moiseiev
92baa4
92baa4
Upstream-commit: 29bf0598aad58d9da5dd8c5358f5175dae49026d
92baa4
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
92baa4
---
92baa4
 docs/libcurl/curl_multi_wait.3 | 3 +++
92baa4
 lib/multi.c                    | 9 +++++++++
92baa4
 2 files changed, 12 insertions(+)
92baa4
92baa4
diff --git a/docs/libcurl/curl_multi_wait.3 b/docs/libcurl/curl_multi_wait.3
92baa4
index b14760b..57c40f0 100644
92baa4
--- a/docs/libcurl/curl_multi_wait.3
92baa4
+++ b/docs/libcurl/curl_multi_wait.3
92baa4
@@ -36,6 +36,9 @@ CURLMcode curl_multi_wait(CURLM *multi_handle,
92baa4
 This function polls on all file descriptors used by the curl easy handles
92baa4
 contained in the given multi handle set.  It will block until activity is
92baa4
 detected on at least one of the handles or \fItimeout_ms\fP has passed.
92baa4
+Alternatively, if the multi handle has a pending internal timeout that has a
92baa4
+shorter expiry time than \fItimeout_ms\fP, that shorter time will be used
92baa4
+instead to make sure timeout accuracy is reasonably kept.
92baa4
 
92baa4
 The calling application may pass additional curl_waitfd structures which are
92baa4
 similar to \fIpoll(2)\fP's pollfd structure to be waited on in the same call.
92baa4
diff --git a/lib/multi.c b/lib/multi.c
92baa4
index 9a8e68e..c8dd97d 100644
92baa4
--- a/lib/multi.c
92baa4
+++ b/lib/multi.c
92baa4
@@ -81,6 +81,8 @@ static bool isHandleAtHead(struct SessionHandle *handle,
92baa4
 static CURLMcode add_next_timeout(struct timeval now,
92baa4
                                   struct Curl_multi *multi,
92baa4
                                   struct SessionHandle *d);
92baa4
+static CURLMcode multi_timeout(struct Curl_multi *multi,
92baa4
+                               long *timeout_ms);
92baa4
 
92baa4
 #ifdef DEBUGBUILD
92baa4
 static const char * const statename[]={
92baa4
@@ -804,10 +806,17 @@ CURLMcode curl_multi_wait(CURLM *multi_handle,
92baa4
   unsigned int i;
92baa4
   unsigned int nfds = extra_nfds;
92baa4
   struct pollfd *ufds = NULL;
92baa4
+  long timeout_internal;
92baa4
 
92baa4
   if(!GOOD_MULTI_HANDLE(multi))
92baa4
     return CURLM_BAD_HANDLE;
92baa4
 
92baa4
+  /* If the internally desired timeout is actually shorter than requested from
92baa4
+     the outside, then use the shorter time! */
92baa4
+  (void)multi_timeout(multi, &timeout_internal);
92baa4
+  if(timeout_internal < (long)timeout_ms)
92baa4
+    timeout_ms = (int)timeout_internal;
92baa4
+
92baa4
   /* Count up how many fds we have from the multi handle */
92baa4
   easy=multi->easy.next;
92baa4
   while(easy != &multi->easy) {
92baa4
-- 
92baa4
2.4.0
92baa4
92baa4
92baa4
From 3db7d3959815224b7a618860be783fed44fab72a Mon Sep 17 00:00:00 2001
92baa4
From: Daniel Stenberg <daniel@haxx.se>
92baa4
Date: Tue, 4 Jun 2013 13:22:40 +0200
92baa4
Subject: [PATCH 2/5] curl_multi_wait: only use internal timer if not -1
92baa4
92baa4
commit 29bf0598aad5 introduced a problem when the "internal" timeout is
92baa4
prefered to the given if shorter, as it didn't consider the case where
92baa4
-1 was returned. Now the internal timeout is only considered if not -1.
92baa4
92baa4
Reported-by: Tor Arntsen
92baa4
Bug: http://curl.haxx.se/mail/lib-2013-06/0015.html
92baa4
92baa4
Upstream-commit: 0bf5ce77aabe7307e41db13a0d03a63517fdc366
92baa4
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
92baa4
---
92baa4
 lib/multi.c | 5 +++--
92baa4
 1 file changed, 3 insertions(+), 2 deletions(-)
92baa4
92baa4
diff --git a/lib/multi.c b/lib/multi.c
92baa4
index c8dd97d..6dfce9b 100644
92baa4
--- a/lib/multi.c
92baa4
+++ b/lib/multi.c
92baa4
@@ -812,9 +812,10 @@ CURLMcode curl_multi_wait(CURLM *multi_handle,
92baa4
     return CURLM_BAD_HANDLE;
92baa4
 
92baa4
   /* If the internally desired timeout is actually shorter than requested from
92baa4
-     the outside, then use the shorter time! */
92baa4
+     the outside, then use the shorter time! But only if the internal timer
92baa4
+     is actually larger than 0! */
92baa4
   (void)multi_timeout(multi, &timeout_internal);
92baa4
-  if(timeout_internal < (long)timeout_ms)
92baa4
+  if((timeout_internal > 0) && (timeout_internal < (long)timeout_ms))
92baa4
     timeout_ms = (int)timeout_internal;
92baa4
 
92baa4
   /* Count up how many fds we have from the multi handle */
92baa4
-- 
92baa4
2.4.0
92baa4
92baa4
92baa4
From 761d88bb94e33a119f8e10083c33acf6fe216c79 Mon Sep 17 00:00:00 2001
92baa4
From: Daniel Stenberg <daniel@haxx.se>
92baa4
Date: Tue, 20 Aug 2013 22:45:47 +0200
92baa4
Subject: [PATCH 3/5] FTP: fix getsock during DO_MORE state
92baa4
92baa4
... when doing upload it would return the wrong values at times. This
92baa4
commit attempts to cleanup the mess.
92baa4
92baa4
Bug: http://curl.haxx.se/mail/lib-2013-08/0109.html
92baa4
Reported-by: Mike Mio
92baa4
92baa4
Upstream-commit: c4a7ca038e26a57df952b4ea560f9b718a5ebd1d
92baa4
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
92baa4
---
92baa4
 lib/ftp.c | 24 ++++++++++--------------
92baa4
 1 file changed, 10 insertions(+), 14 deletions(-)
92baa4
92baa4
diff --git a/lib/ftp.c b/lib/ftp.c
92baa4
index 4501116..63d1e64 100644
92baa4
--- a/lib/ftp.c
92baa4
+++ b/lib/ftp.c
92baa4
@@ -877,14 +877,9 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks,
92baa4
     return GETSOCK_BLANK;
92baa4
 
92baa4
   /* When in DO_MORE state, we could be either waiting for us to connect to a
92baa4
-     remote site, or we could wait for that site to connect to us. Or just
92baa4
-     handle ordinary commands.
92baa4
-
92baa4
-     When waiting for a connect, we will be in FTP_STOP state and then we wait
92baa4
-     for the secondary socket to become writeable. If we're in another state,
92baa4
-     we're still handling commands on the control (primary) connection.
92baa4
-
92baa4
-  */
92baa4
+   * remote site, or we could wait for that site to connect to us. Or just
92baa4
+   * handle ordinary commands.
92baa4
+   */
92baa4
 
92baa4
   switch(ftpc->state) {
92baa4
   case FTP_STOP:
92baa4
@@ -893,13 +888,12 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks,
92baa4
     return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);
92baa4
   }
92baa4
 
92baa4
-  socks[0] = conn->sock[SECONDARYSOCKET];
92baa4
-  if(ftpc->wait_data_conn) {
92baa4
-    socks[1] = conn->sock[FIRSTSOCKET];
92baa4
-    return GETSOCK_READSOCK(0) | GETSOCK_READSOCK(1);
92baa4
-  }
92baa4
+  /* if stopped and still in this state, then we're also waiting for a
92baa4
+     connect on the secondary connection */
92baa4
+  socks[0] = conn->sock[FIRSTSOCKET];
92baa4
+  socks[1] = conn->sock[SECONDARYSOCKET];
92baa4
 
92baa4
-  return GETSOCK_READSOCK(0);
92baa4
+  return GETSOCK_READSOCK(FIRSTSOCKET) | GETSOCK_WRITESOCK(SECONDARYSOCKET);
92baa4
 }
92baa4
 
92baa4
 /* This is called after the FTP_QUOTE state is passed.
92baa4
@@ -2421,6 +2415,8 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn,
92baa4
   if(data->set.ftp_use_port) {
92baa4
     bool connected;
92baa4
 
92baa4
+    state(conn, FTP_STOP); /* no longer in STOR state */
92baa4
+
92baa4
     result = AllowServerConnect(conn, &connected);
92baa4
     if(result)
92baa4
       return result;
92baa4
-- 
92baa4
2.4.0
92baa4
92baa4
92baa4
From 5b18b86746cf09208e57adb69edcf411b10f5e30 Mon Sep 17 00:00:00 2001
92baa4
From: Daniel Stenberg <daniel@haxx.se>
92baa4
Date: Sat, 6 Apr 2013 17:49:58 +0200
92baa4
Subject: [PATCH 4/5] ftp tests: libcurl returns CURLE_FTP_ACCEPT_FAILED better
92baa4
 now
92baa4
92baa4
Since commit 57aeabcc1a20f, it handles errors on the control connection
92baa4
while waiting for the data connection better.
92baa4
92baa4
Test 591 and 592 are updated accordingly.
92baa4
92baa4
Upstream-commit: 18f0ab7bd353289049ca06c4a7105473e37a8f20
92baa4
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
92baa4
---
92baa4
 tests/data/test591 | 4 ++--
92baa4
 tests/data/test592 | 5 +++--
92baa4
 2 files changed, 5 insertions(+), 4 deletions(-)
92baa4
92baa4
diff --git a/tests/data/test591 b/tests/data/test591
92baa4
index 42a2271..1455a38 100644
92baa4
--- a/tests/data/test591
92baa4
+++ b/tests/data/test591
92baa4
@@ -63,9 +63,9 @@ TYPE I
92baa4
 STOR 591
92baa4
 QUIT
92baa4
 </protocol>
92baa4
-# CURLE_UPLOAD_FAILED = 25
92baa4
+# CURLE_FTP_ACCEPT_FAILED = 10
92baa4
 <errorcode>
92baa4
-25
92baa4
+10
92baa4
 </errorcode>
92baa4
 <upload>
92baa4
 </upload>
92baa4
diff --git a/tests/data/test592 b/tests/data/test592
92baa4
index 23aa6c4..f443205 100644
92baa4
--- a/tests/data/test592
92baa4
+++ b/tests/data/test592
92baa4
@@ -62,10 +62,11 @@ EPRT |1|
92baa4
 PORT
92baa4
 TYPE I
92baa4
 STOR 592
92baa4
+QUIT
92baa4
 </protocol>
92baa4
-# 28 == CURLE_OPERATION_TIMEDOUT
92baa4
+# CURLE_FTP_ACCEPT_FAILED = 10
92baa4
 <errorcode>
92baa4
-28
92baa4
+10
92baa4
 </errorcode>
92baa4
 <upload>
92baa4
 </upload>
92baa4
-- 
92baa4
2.4.0
92baa4
92baa4
92baa4
From 599ef7d7ec8ed7a979df1cd3180819359e6af97f Mon Sep 17 00:00:00 2001
92baa4
From: Daniel Stenberg <daniel@haxx.se>
92baa4
Date: Thu, 6 Jun 2013 22:20:39 +0200
92baa4
Subject: [PATCH 5/5] lib1500: remove bad check
92baa4
92baa4
After curl_multi_wait() returns, this test checked that we got exactly
92baa4
one file descriptor told to read from, but we cannot be sure that is
92baa4
true. curl_multi_wait() will sometimes return earlier without any file
92baa4
descriptor to handle, just just because it is a suitable time to call
92baa4
*perform().
92baa4
92baa4
This problem showed up with commit 29bf0598.
92baa4
92baa4
Bug: http://curl.haxx.se/mail/lib-2013-06/0029.html
92baa4
Reported-by: Fabian Keil
92baa4
92baa4
Upstream-commit: 87cf677eca55abee88f0a9dced9e6fa570143873
92baa4
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
92baa4
---
92baa4
 tests/libtest/lib1500.c | 5 -----
92baa4
 1 file changed, 5 deletions(-)
92baa4
92baa4
diff --git a/tests/libtest/lib1500.c b/tests/libtest/lib1500.c
92baa4
index 784bdb2..736a817 100644
92baa4
--- a/tests/libtest/lib1500.c
92baa4
+++ b/tests/libtest/lib1500.c
92baa4
@@ -61,11 +61,6 @@ int test(char *URL)
92baa4
       res = -1;
92baa4
       goto test_cleanup;
92baa4
     }
92baa4
-    if (num != 1) {
92baa4
-      printf("curl_multi_wait() returned on %d handle(s), expected 1\n", num);
92baa4
-      res = -1;
92baa4
-      goto test_cleanup;
92baa4
-    }
92baa4
 
92baa4
     abort_on_test_timeout();
92baa4
 
92baa4
-- 
92baa4
2.4.0
92baa4