diff options
author | Daniel Stenberg <daniel@haxx.se> | 2023-02-16 09:26:55 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-02-16 14:36:24 +0100 |
commit | 5479d9916e53f00a59d7b655c5ff1eece303c89e (patch) | |
tree | 4f02700679dcb200510c0ff3224bef1a8f2cf3c6 /src | |
parent | cc52bc45f625d285a3634fe28372d2db7854a614 (diff) | |
download | curl-5479d9916e53f00a59d7b655c5ff1eece303c89e.tar.gz |
tool_operate: allow debug builds to set buffersize
Using the CURL_BUFFERSIZE environment variable.
Closes #10532
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_operate.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c index c9583b850..02a5113dd 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -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); + 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); |