Bug report #1078066: when a chunked transfer was pre-maturely closed exactly

at a chunk boundary it was not considered an error and thus went unnoticed.
Added test case 207 to verify.
This commit is contained in:
Daniel Stenberg
2004-12-03 09:31:25 +00:00
parent 6ac9e67bd7
commit 2c27e4ee76
5 changed files with 88 additions and 5 deletions

View File

@@ -1368,9 +1368,18 @@ CURLcode Curl_readwrite(struct connectdata *conn,
conn->size - k->bytecount);
return CURLE_PARTIAL_FILE;
}
else if(conn->bits.chunk && conn->proto.http->chunk.datasize) {
failf(data, "transfer closed with at least %d bytes remaining",
conn->proto.http->chunk.datasize);
else if(conn->bits.chunk &&
(conn->proto.http->chunk.state != CHUNK_STOP)) {
/*
* In chunked mode, return an error if the connection is closed prior to
* the empty (terminiating) chunk is read.
*
* The condition above used to check for
* conn->proto.http->chunk.datasize != 0 which is true after reading
* *any* chunk, not just the empty chunk.
*
*/
failf(data, "transfer closed with outstanding read data remaining");
return CURLE_PARTIAL_FILE;
}
if(Curl_pgrsUpdate(conn))