[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 14/116: transfer: Fix chunked-encoding upload bug
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 14/116: transfer: Fix chunked-encoding upload bug |
Date: |
Tue, 05 Dec 2017 14:50:44 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 979d2877be3647bef52e19a38f27346866a66bea
Author: Jay Satiro <address@hidden>
AuthorDate: Tue Oct 24 16:08:26 2017 -0400
transfer: Fix chunked-encoding upload bug
- When uploading via chunked-encoding don't compare file size to bytes
sent to determine whether the upload has finished.
Chunked-encoding adds its own overhead which why the bytes sent is not
equal to the file size. Prior to this change if a file was uploaded in
chunked-encoding and its size was known it was possible that the upload
could end prematurely without sending the final few chunks. That would
result in a server hang waiting for the remaining data, likely followed
by a disconnect.
The scope of this bug is limited to some arbitrary file sizes which have
not been determined. One size that triggers the bug is 475020.
Bug: https://github.com/curl/curl/issues/2001
Reported-by: address@hidden
Closes https://github.com/curl/curl/pull/2010
---
lib/transfer.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/transfer.c b/lib/transfer.c
index 75659cf44..937477670 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -238,9 +238,11 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int
bytes, int *nreadp)
}
#endif /* CURL_DOES_CONVERSIONS */
- if((nread - hexlen) == 0)
+ if((nread - hexlen) == 0) {
/* mark this as done once this chunk is transferred */
data->req.upload_done = TRUE;
+ infof(data, "Signaling end of chunked upload via terminating chunk.\n");
+ }
nread += (int)strlen(endofline_native); /* for the added end of line */
}
@@ -1046,7 +1048,8 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
k->writebytecount += bytes_written;
- if(k->writebytecount == data->state.infilesize) {
+ if((!k->upload_chunky || k->forbidchunk) &&
+ (k->writebytecount == data->state.infilesize)) {
/* we have sent all data we were supposed to */
k->upload_done = TRUE;
infof(data, "We are completely uploaded and fine\n");
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 34/116: select: update comments, (continued)
- [GNUnet-SVN] [gnurl] 34/116: select: update comments, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 31/116: cli tool: improve "; type=" handling in -F option arguments, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 53/116: HTTP: implement Brotli content encoding, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 36/116: runtests.pl: Fixed typo in message, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 37/116: mkhelp.pl: support reproducible build, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 55/116: travis: add a job with brotli enabled, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 63/116: connect: store IPv6 connection status after valid connection, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 32/116: timeval: use mach time on MacOS, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 47/116: curl: pass through [] in URLs instead of calling globbing error, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 72/116: curl_share_setopt: va_end was not called if conncache errors, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 14/116: transfer: Fix chunked-encoding upload bug,
gnunet <=
- [GNUnet-SVN] [gnurl] 49/116: RELEASE-NOTES: synced with ee8016b3d, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 48/116: curl: speed up handling of many URLs, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 43/116: tests: Fixed torture tests on tests 556 and 650, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 75/116: README.md: fixed layout, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 77/116: SMB: fix uninitialized local variable, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 27/116: RELEASE-NOTES: synced with f20cbac97, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 68/116: curl_share_setopt.3: document CURL_LOCK_DATA_CONNECT, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 52/116: HTTP: support multiple Content-Encodings, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 69/116: --interface: add support for Linux VRF, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 106/116: ssh: remove check for a NULL pointer (!), gnunet, 2017/12/05