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:
Daniel Stenberg 2021-05-06 10:25:56 +02:00
parent 817c01dacc
commit 1763aceb0c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 22 additions and 17 deletions

View file

@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2017, 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@ -39,6 +39,9 @@ actually get the given size.
This buffer size is by default \fICURL_MAX_WRITE_SIZE\fP (16kB). The maximum
buffer size allowed to be set is \fICURL_MAX_READ_SIZE\fP (512kB). The minimum
buffer size allowed to be set is 1024.
DO NOT set this option on a handle that is currently used for an active
transfer as that may lead to unintended consequences.
.SH DEFAULT
CURL_MAX_WRITE_SIZE (16kB)
.SH PROTOCOLS

View file

@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2018, 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@ -43,6 +43,9 @@ allowed to be set is 2 megabytes. The minimum buffer size allowed to be set is
Since curl 7.61.1 the upload buffer is allocated on-demand - so if the handle
isn't used for upload, this buffer will not be allocated at all.
DO NOT set this option on a handle that is currently used for an active
transfer as that may lead to unintended consequences.
.SH DEFAULT
64 kB
.SH PROTOCOLS