diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-08-29 10:47:59 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-08-29 10:47:59 +0000 |
commit | c67a99ff27036c824be15f01e21b91c3ec08da4a (patch) | |
tree | c2d84c831212e7b4f026764abadfa10b2312cf6e /lib/transfer.c | |
parent | bae4e12302e783af59ad40cef3fb72c42a3bef17 (diff) |
- When libcurl was doing a HTTP POST and the server would respond with
"Connection: close" and actually close the connection after the
response-body, libcurl could still have outstanding data to send and it
would not properly notice this and stop sending. This caused weirdness and
sad faces. http://curl.haxx.se/bug/view.cgi?id=2080222
Note that there are still reasons to consider libcurl's behavior when
getting a >= 400 response code while sending data, as Craig Perras' note
"http upload: how to stop on error" specifies:
http://curl.haxx.se/mail/archive-2008-08/0138.html
Diffstat (limited to 'lib/transfer.c')
-rw-r--r-- | lib/transfer.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index 3294ba530..2fd6d4cf3 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -656,6 +656,15 @@ static CURLcode readwrite_data(struct SessionHandle *data, } while(data_pending(conn)); + if(((k->keepon & (KEEP_READ|KEEP_WRITE)) == KEEP_WRITE) && + conn->bits.close ) { + /* When we've read the entire thing and the close bit is set, the server may + now close the connection. If there's now any kind of sending going on from + our side, we need to stop that immediately. */ + infof(data, "we are done reading and this is set to close, stop send\n"); + k->keepon &= ~KEEP_WRITE; /* no writing anymore either */ + } + return CURLE_OK; } |