diff mbox series

[2/2] negative values are ignored for http.maxreceivespeed

Message ID 20210819131808.40759-2-chenan.xxw@alibaba-inc.com (mailing list archive)
State New, archived
Headers show
Series [1/2] add http.maxReceiveSpeed to limit git-receive-pack receiving speed | expand

Commit Message

Xiaowen Xia Aug. 19, 2021, 1:18 p.m. UTC
---
 http.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/http.c b/http.c
index 12030cf3bc..2e01ebf559 100644
--- a/http.c
+++ b/http.c
@@ -84,7 +84,7 @@  static const char *ssl_cainfo;
 static long curl_low_speed_limit = -1;
 static long curl_low_speed_time = -1;
 #if LIBCURL_VERSION_NUM >= 0x070f05
-static ssize_t curl_max_receive_speed = -1;
+static ssize_t curl_max_receive_speed = 0;
 #endif
 static int curl_ftp_no_epsv;
 static const char *curl_http_proxy;
@@ -983,7 +983,9 @@  static CURL *get_curl_handle(void)
 	}
 
 #if LIBCURL_VERSION_NUM >= 0x070f05
-	if (curl_max_receive_speed > 0)
+	if (curl_max_receive_speed < 0)
+		warning("negative values are ignored for http.maxreceivespeed");
+	else if (curl_max_receive_speed > 0)
 		curl_easy_setopt(result, CURLOPT_MAX_RECV_SPEED_LARGE,
 				 curl_max_receive_speed);
 #endif