Skip to content

Commit

Permalink
tool_operate: allow debug builds to set buffersize
Browse files Browse the repository at this point in the history
Using the CURL_BUFFERSIZE environment variable.

Closes #10532
  • Loading branch information
bagder committed Feb 16, 2023
1 parent cc52bc4 commit 5479d99
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/tool_operate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,12 +1298,22 @@ static CURLcode single_transfer(struct GlobalConfig *global,
my_setopt(curl, CURLOPT_SEEKDATA, input);
my_setopt(curl, CURLOPT_SEEKFUNCTION, tool_seek_cb);

if(config->recvpersecond &&
(config->recvpersecond < BUFFER_SIZE))
/* use a smaller sized buffer for better sleeps */
my_setopt(curl, CURLOPT_BUFFERSIZE, (long)config->recvpersecond);
#ifdef CURLDEBUG
if(getenv("CURL_BUFFERSIZE")) {
long size = strtol(getenv("CURL_BUFFERSIZE"), NULL, 10);

This comment has been minimized.

Copy link
@MarcelRaad

This comment has been minimized.

Copy link
@jay

jay Feb 18, 2023

Member

#10559. I guess it doesn't account for the if(getenv... beforehand. ok.

if(size)
my_setopt(curl, CURLOPT_BUFFERSIZE, size);
}
else
my_setopt(curl, CURLOPT_BUFFERSIZE, (long)BUFFER_SIZE);
#endif
{
if(config->recvpersecond &&
(config->recvpersecond < BUFFER_SIZE))
/* use a smaller sized buffer for better sleeps */
my_setopt(curl, CURLOPT_BUFFERSIZE, (long)config->recvpersecond);
else
my_setopt(curl, CURLOPT_BUFFERSIZE, (long)BUFFER_SIZE);
}

my_setopt_str(curl, CURLOPT_URL, per->this_url);
my_setopt(curl, CURLOPT_NOPROGRESS, global->noprogress?1L:0L);
Expand Down

0 comments on commit 5479d99

Please sign in to comment.