mirror of
https://github.com/curl/curl.git
synced 2026-07-27 09:47:16 +03:00
Ensure progress.size_dl/progress.size_ul are always >= 0
Historically the default "unknown" value for progress.size_dl and progress.size_ul has been zero, since these values are initialized implicitly by the calloc that allocates the curl handle that these variables are a part of. Users of curl that install progress callbacks may expect these values to always be >= 0. Currently it is possible for progress.size_dl and progress.size_ul to by set to a value of -1, if Curl_pgrsSetDownloadSize() or Curl_pgrsSetUploadSize() are passed a "size" of -1 (which a few places currently do, and a following patch will add more). So lets update Curl_pgrsSetDownloadSize() and Curl_pgrsSetUploadSize() so they make sure that these variables always contain a value that is >= 0. Updates test579 and test599. Signed-off-by: Brandon Casey <drafnel@gmail.com>
This commit is contained in:
parent
8acbb074f8
commit
6beb0eeea1
10 changed files with 47 additions and 28 deletions
|
|
@ -2351,7 +2351,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||
return result;
|
||||
|
||||
http->postdata = NULL; /* nothing to post at this point */
|
||||
Curl_pgrsSetUploadSize(data, 0); /* upload size is 0 atm */
|
||||
Curl_pgrsSetUploadSize(data, -1); /* upload size is unknown atm */
|
||||
|
||||
/* If 'authdone' is FALSE, we must not set the write socket index to the
|
||||
Curl_transfer() call below, as we're not ready to actually upload any
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue