b7b705
From 4d5f2c162fe8b0a05f05c7f03573381c11ec2958 Mon Sep 17 00:00:00 2001
b7b705
From: Daniel Stenberg <daniel@haxx.se>
b7b705
Date: Sun, 22 Dec 2013 23:36:11 +0100
b7b705
Subject: [PATCH 1/2] FILE: don't wait due to CURLOPT_MAX_RECV_SPEED_LARGE
b7b705
b7b705
The FILE:// code doesn't support this option - and it doesn't make sense
b7b705
to support it as long as it works as it does since then it'd only block
b7b705
even longer.
b7b705
b7b705
But: setting CURLOPT_MAX_RECV_SPEED_LARGE would make the transfer first
b7b705
get done and then libcurl would wait until the average speed would get
b7b705
low enough. This happened because the transfer happens completely in the
b7b705
DO state for FILE:// but then it would still unconditionally continue in
b7b705
to the PERFORM state where the speed check is made.
b7b705
b7b705
Starting now, the code will skip from DO_DONE to DONE immediately if no
b7b705
socket is set to be recv()ed or send()ed to.
b7b705
b7b705
Bug: http://curl.haxx.se/bug/view.cgi?id=1312
b7b705
Reported-by: Mohammad AlSaleh
b7b705
b7b705
Upstream-commit: 2715d7f948c8eb7cd3cba38f3dff6d4148e7cfaf
b7b705
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
b7b705
---
b7b705
 lib/multi.c | 8 +++++++-
b7b705
 1 file changed, 7 insertions(+), 1 deletion(-)
b7b705
b7b705
diff --git a/lib/multi.c b/lib/multi.c
b7b705
index 39a0938..f27a18f 100644
b7b705
--- a/lib/multi.c
b7b705
+++ b/lib/multi.c
b7b705
@@ -1398,7 +1398,13 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
b7b705
       moveHandleFromSendToRecvPipeline(data, easy->easy_conn);
b7b705
       /* Check if we can move pending requests to send pipe */
b7b705
       checkPendPipeline(easy->easy_conn);
b7b705
-      multistate(easy, CURLM_STATE_WAITPERFORM);
b7b705
+      /* Only perform the transfer if there's a good socket to work with.
b7b705
+         Having both BAD is a signal to skip immediately to DONE */
b7b705
+      if((easy->easy_conn->sockfd != CURL_SOCKET_BAD) ||
b7b705
+         (easy->easy_conn->writesockfd != CURL_SOCKET_BAD))
b7b705
+        multistate(easy, CURLM_STATE_WAITPERFORM);
b7b705
+      else
b7b705
+        multistate(easy, CURLM_STATE_DONE);
b7b705
       result = CURLM_CALL_MULTI_PERFORM;
b7b705
       break;
b7b705
 
b7b705
-- 
b7b705
2.17.2
b7b705
b7b705
b7b705
From 876a1e81ff44157bbd5e48ca5e120f4266aefc9e Mon Sep 17 00:00:00 2001
b7b705
From: Daniel Stenberg <daniel@haxx.se>
b7b705
Date: Sun, 22 Dec 2013 23:45:10 +0100
b7b705
Subject: [PATCH 2/2] docs: mention CURLOPT_MAX_RECV/SEND_SPEED_LARGE don't
b7b705
 work for FILE://
b7b705
b7b705
Upstream-commit: f718415bc7914f4c238c88d8f76b22ddf4d470c9
b7b705
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
b7b705
---
b7b705
 docs/libcurl/curl_easy_setopt.3 | 10 ++++++++--
b7b705
 1 file changed, 8 insertions(+), 2 deletions(-)
b7b705
b7b705
diff --git a/docs/libcurl/curl_easy_setopt.3 b/docs/libcurl/curl_easy_setopt.3
b7b705
index 226e0ca..d720b95 100644
b7b705
--- a/docs/libcurl/curl_easy_setopt.3
b7b705
+++ b/docs/libcurl/curl_easy_setopt.3
b7b705
@@ -2053,12 +2053,18 @@ it too slow and abort.
b7b705
 Pass a curl_off_t as parameter.  If an upload exceeds this speed (counted in
b7b705
 bytes per second) on cumulative average during the transfer, the transfer will
b7b705
 pause to keep the average rate less than or equal to the parameter value.
b7b705
-Defaults to unlimited speed. (Added in 7.15.5)
b7b705
+Defaults to unlimited speed.
b7b705
+
b7b705
+This option doesn't affect transfer speeds done with FILE:// URLs. (Added in
b7b705
+ 7.15.5)
b7b705
 .IP CURLOPT_MAX_RECV_SPEED_LARGE
b7b705
 Pass a curl_off_t as parameter.  If a download exceeds this speed (counted in
b7b705
 bytes per second) on cumulative average during the transfer, the transfer will
b7b705
 pause to keep the average rate less than or equal to the parameter
b7b705
-value. Defaults to unlimited speed. (Added in 7.15.5)
b7b705
+value. Defaults to unlimited speed.
b7b705
+
b7b705
+This option doesn't affect transfer speeds done with FILE:// URLs. (Added in
b7b705
+7.15.5)
b7b705
 .IP CURLOPT_MAXCONNECTS
b7b705
 Pass a long. The set number will be the persistent connection cache size. The
b7b705
 set amount will be the maximum amount of simultaneously open connections that
b7b705
-- 
b7b705
2.17.2
b7b705