mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[curl] Added bandwith limit for ftp and http.
protocol.ftp.curl_max_recv_speed protocol.ftp.curl_max_send_speed protocol.http.curl_max_recv_speed protocol.http.curl_max_send_speed Unit is byte per second. 0 - unlimited.
This commit is contained in:
parent
ea9d93d44b
commit
141ad11ad5
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)"),
|
||||
|
@ -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"),
|
||||
|
Loading…
Reference in New Issue
Block a user