Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speed time triggers without regard for limit #3927

Closed
falconindy opened this issue May 22, 2019 · 6 comments
Closed

speed time triggers without regard for limit #3927

falconindy opened this issue May 22, 2019 · 6 comments

Comments

@falconindy
Copy link
Contributor

I did this

#include <stdio.h>
#include <curl/curl.h>

static int dload_progress_cb(void *a, curl_off_t b, curl_off_t c, curl_off_t d, curl_off_t e) {
  return 0;
}

int main(void) {
  CURLcode ret;
  CURL *hnd;
  FILE* devnull;
  char errorbuffer[CURL_ERROR_SIZE] = {};

  devnull = fopen("/dev/null", "w");

  hnd = curl_easy_init();
  curl_easy_setopt(hnd, CURLOPT_URL, "http://speedtest.wdc01.softlayer.com/downloads/test500.zip");
  curl_easy_setopt(hnd, CURLOPT_LOW_SPEED_LIMIT, 1L);
  curl_easy_setopt(hnd, CURLOPT_LOW_SPEED_TIME, 5L);
  curl_easy_setopt(hnd, CURLOPT_WRITEDATA, devnull);
  curl_easy_setopt(hnd, CURLOPT_ERRORBUFFER, errorbuffer);

  /* problematic options */
  curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 0L);
  curl_easy_setopt(hnd, CURLOPT_XFERINFOFUNCTION, dload_progress_cb);

  ret = curl_easy_perform(hnd);
  if (ret != CURLE_OK) {
    printf("error: %s\n", errorbuffer);
  }

  curl_easy_cleanup(hnd);

  return (int)ret;
}

The program exits unsuccessfully after logging

error: Operation too slow. Less than 1 bytes/sec transferred the last 5 seconds

I've bisected this to 3b06e68.

I expected the following

Successful exit.

curl/libcurl version

curl 7.65.0 (x86_64-pc-linux-gnu) libcurl/7.65.0 OpenSSL/1.1.1b zlib/1.2.11 libidn2/2.1.1 libpsl/0.20.2 (+libidn2/2.1.1) libssh2/1.8.2 nghttp2/1.36.0
Release-Date: 2019-05-22
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

operating system

Arch Linux, baseline kernel version 5.1.1

@bagder
Copy link
Member

bagder commented May 22, 2019

Thanks for the recipe. I suppose the easiest work-around for this issue could be to just revert that particular commit. Did you try that?

@falconindy
Copy link
Contributor Author

I guess I should have tried that. Yes, reverting the mentioned commit fixes it.

bagder added a commit that referenced this issue May 22, 2019
This reverts commit 3b06e68.

Clearly this change wasn't good enough as it broke CURLOPT_LOW_SPEED_LIMIT +
CURLOPT_LOW_SPEED_TIME

Reported-by: Dave Reisner

Fixes #3927
@bagder bagder closed this as completed in c6b5813 May 23, 2019
@jackiepluto
Copy link

What is the schedule of next official release to fix this issue?

@bagder
Copy link
Member

bagder commented Jun 4, 2019

ETA of 7.65.1 is about 20 hours! 😄

@JulesRapanga
Copy link

I believe that commit also breaks CURLINFO_TOTAL_TIME (always returns zero in 7.65.0, works in 7.65.1 and previous).
Makes sense as it comes from progress.timespent which is in that area.

@bagder
Copy link
Member

bagder commented Jun 13, 2019

Yes it did. But water under the bridge now!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

4 participants