mirror of
https://github.com/curl/curl.git
synced 2026-08-10 04:50:53 +03:00
http: limit the initial send amount to used upload buffer size
Previously this logic would cap the send to CURL_MAX_WRITE_SIZE bytes, but for the situations where a larger upload buffer has been set, this function can benefit from sending more bytes. With default size used, this does the same as before. Also changed the storage of the size to an 'unsigned int' as it is not allowed to be set larger than 2M. Also added cautions to the man pages about changing buffer sizes in run-time. Closes #7022
This commit is contained in:
parent
817c01dacc
commit
1763aceb0c
7 changed files with 22 additions and 17 deletions
16
lib/http.c
16
lib/http.c
|
|
@ -1273,14 +1273,6 @@ CURLcode Curl_buffer_send(struct dynbuf *in,
|
|||
else
|
||||
sendsize = size;
|
||||
|
||||
/* We never send more than CURL_MAX_WRITE_SIZE bytes in one single chunk
|
||||
when we speak HTTPS, as if only a fraction of it is sent now, this data
|
||||
needs to fit into the normal read-callback buffer later on and that
|
||||
buffer is using this size.
|
||||
*/
|
||||
if(sendsize > CURL_MAX_WRITE_SIZE)
|
||||
sendsize = CURL_MAX_WRITE_SIZE;
|
||||
|
||||
/* OpenSSL is very picky and we must send the SAME buffer pointer to the
|
||||
library when we attempt to re-send this buffer. Sending the same data
|
||||
is not enough, we must use the exact same address. For this reason, we
|
||||
|
|
@ -1293,6 +1285,14 @@ CURLcode Curl_buffer_send(struct dynbuf *in,
|
|||
Curl_dyn_free(in);
|
||||
return result;
|
||||
}
|
||||
/* We never send more than upload_buffer_size bytes in one single chunk
|
||||
when we speak HTTPS, as if only a fraction of it is sent now, this data
|
||||
needs to fit into the normal read-callback buffer later on and that
|
||||
buffer is using this size.
|
||||
*/
|
||||
if(sendsize > (size_t)data->set.upload_buffer_size)
|
||||
sendsize = (size_t)data->set.upload_buffer_size;
|
||||
|
||||
memcpy(data->state.ulbuf, ptr, sendsize);
|
||||
ptr = data->state.ulbuf;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue