http, use stack scratch buffer

- instead of data->state.buffer

Closes #12791
This commit is contained in:
Stefan Eissing 2024-01-25 15:14:23 +01:00 committed by Daniel Stenberg
parent 8e9c304f4a
commit a069c6aeb2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -2940,13 +2940,14 @@ CURLcode Curl_http_resume(struct Curl_easy *data,
}
/* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
do {
char scratch[4*1024];
size_t readthisamountnow =
(data->state.resume_from - passed > data->set.buffer_size) ?
(size_t)data->set.buffer_size :
(data->state.resume_from - passed > (curl_off_t)sizeof(scratch)) ?
sizeof(scratch) :
curlx_sotouz(data->state.resume_from - passed);
size_t actuallyread =
data->state.fread_func(data->state.buffer, 1, readthisamountnow,
data->state.fread_func(scratch, 1, readthisamountnow,
data->state.in);
passed += actuallyread;