diff --git a/src/protocol/curl/ftp.c b/src/protocol/curl/ftp.c index 88ce7bd4..706fee1c 100644 --- a/src/protocol/curl/ftp.c +++ b/src/protocol/curl/ftp.c @@ -446,6 +446,8 @@ do_ftpes(struct connection *conn) curl_easy_setopt(curl, CURLOPT_PRIVATE, conn); curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, offset); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)get_opt_long("protocol.ftp.curl_max_recv_speed", NULL)); + curl_easy_setopt(curl, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t)get_opt_long("protocol.ftp.curl_max_send_speed", NULL)); //curl_easy_setopt(curl, CURLOPT_XFERINFODATA, conn); //curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback); diff --git a/src/protocol/curl/http.c b/src/protocol/curl/http.c index f73a2ab2..3d0549c3 100644 --- a/src/protocol/curl/http.c +++ b/src/protocol/curl/http.c @@ -199,6 +199,8 @@ do_http(struct connection *conn) curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, ""); curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L); curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, offset); + curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)get_opt_long("protocol.http.curl_max_recv_speed", NULL)); + curl_easy_setopt(curl, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t)get_opt_long("protocol.http.curl_max_send_speed", NULL)); if (bundle) { curl_easy_setopt(curl, CURLOPT_CAINFO, bundle); diff --git a/src/protocol/ftp/ftp.c b/src/protocol/ftp/ftp.c index 44b4cd02..379b9eea 100644 --- a/src/protocol/ftp/ftp.c +++ b/src/protocol/ftp/ftp.c @@ -80,6 +80,14 @@ union option_info ftp_options[] = { INIT_OPT_BOOL("protocol.ftp", N_("Use libcurl"), "use_curl", OPT_ZERO, 0, N_("Use libcurl implementation of ftp.")), + + INIT_OPT_LONG("protocol.ftp", N_("Curl max receive speed"), + "curl_max_recv_speed", OPT_ZERO, 0, LONG_MAX, 0, + N_("Max download speed in bytes/s. 0 means unlimited.")), + + INIT_OPT_LONG("protocol.ftp", N_("Curl max send speed"), + "curl_max_send_speed", OPT_ZERO, 0, LONG_MAX, 0, + N_("Max upload speed in bytes/s. 0 means unlimited.")), #endif INIT_OPT_BOOL("protocol.ftp", N_("Use passive mode (IPv4)"), diff --git a/src/protocol/http/http.c b/src/protocol/http/http.c index 8531b337..c396d66c 100644 --- a/src/protocol/http/http.c +++ b/src/protocol/http/http.c @@ -201,6 +201,14 @@ static union option_info http_options[] = { INIT_OPT_BOOL("protocol.http", N_("Use libcurl"), "use_curl", OPT_ZERO, 0, N_("Use libcurl implementation of http(s).")), + + INIT_OPT_LONG("protocol.http", N_("Curl max receive speed"), + "curl_max_recv_speed", OPT_ZERO, 0, LONG_MAX, 0, + N_("Max download speed in bytes/s. 0 means unlimited.")), + + INIT_OPT_LONG("protocol.http", N_("Curl max send speed"), + "curl_max_send_speed", OPT_ZERO, 0, LONG_MAX, 0, + N_("Max upload speed in bytes/s. 0 means unlimited.")), #endif /* OSNews.com is supposed to be relying on the textmode token, at least. */ INIT_OPT_STRING("protocol.http", N_("User-agent identification"),