ssh: use stack scratch buffer for seeks
- instead of data->state.buffer Closes #12794
This commit is contained in:
Родитель
31db4bfa73
Коммит
6d85228709
|
@ -1308,13 +1308,14 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||
}
|
||||
/* 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 :
|
||||
curlx_sotouz(data->state.resume_from - passed);
|
||||
(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,
|
||||
data->state.fread_func(scratch, 1,
|
||||
readthisamountnow, data->state.in);
|
||||
|
||||
passed += actuallyread;
|
||||
|
|
|
@ -2158,14 +2158,15 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||
}
|
||||
/* 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 :
|
||||
curlx_sotouz(data->state.resume_from - passed);
|
||||
(data->state.resume_from - passed >
|
||||
(curl_off_t)sizeof(scratch)) ?
|
||||
sizeof(scratch) : curlx_sotouz(data->state.resume_from - passed);
|
||||
|
||||
size_t actuallyread;
|
||||
Curl_set_in_callback(data, true);
|
||||
actuallyread = data->state.fread_func(data->state.buffer, 1,
|
||||
actuallyread = data->state.fread_func(scratch, 1,
|
||||
readthisamountnow,
|
||||
data->state.in);
|
||||
Curl_set_in_callback(data, false);
|
||||
|
|
|
@ -641,14 +641,15 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||
}
|
||||
/* 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 :
|
||||
curlx_sotouz(data->state.resume_from - passed);
|
||||
(data->state.resume_from - passed >
|
||||
(curl_off_t)sizeof(scratch)) ?
|
||||
sizeof(scratch) : curlx_sotouz(data->state.resume_from - passed);
|
||||
|
||||
size_t actuallyread;
|
||||
Curl_set_in_callback(data, true);
|
||||
actuallyread = data->state.fread_func(data->state.buffer, 1,
|
||||
actuallyread = data->state.fread_func(scratch, 1,
|
||||
readthisamountnow,
|
||||
data->state.in);
|
||||
Curl_set_in_callback(data, false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче