Loading CHANGES +4 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,10 @@ Changelog Daniel (3 December) - swalkaus at yahoo.com patched libcurl to ignore Content-Length: headers when Tranfer-Encoding: chunked is used, as mandated by RFC2616. Daniel (2 December) - --ftp-pasv was added, which serves the only purpose of overriding a previously set --ftpport option. Starting now, --ftp-port is a recognized Loading lib/transfer.c +17 −8 Original line number Diff line number Diff line Loading @@ -206,6 +206,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, fd_set *readfdp = k->readfdp; fd_set *writefdp = k->writefdp; long contentlength; if((k->keepon & KEEP_READ) && !readfdp) { /* reading is requested, but no socket descriptor pointer was set */ Loading Loading @@ -474,9 +475,18 @@ CURLcode Curl_readwrite(struct connectdata *conn, "Content-Length: 0" still prevents us from attempting to read the (missing) response-body. */ if(-1 != conn->size) /* According to RFC2616 section 4.4, we MUST ignore Content-Length: headers if we are now receiving data using chunked Transfer-Encoding. */ if(conn->bits.chunk) conn->size=-1; if(-1 != conn->size) { Curl_pgrsSetDownloadSize(data, conn->size); conn->maxdownload = conn->size; } } /* If max download size is *zero* (nothing) we already have nothing and can safely return ok now! */ if(0 == conn->maxdownload) Loading Loading @@ -590,14 +600,13 @@ CURLcode Curl_readwrite(struct connectdata *conn, info about the true size of the document we didn't get now. */ if ((k->httpcode != 416) && checkprefix("Content-Length:", k->p) && sscanf (k->p+15, " %ld", &k->contentlength)) { if (data->set.max_filesize && k->contentlength > sscanf (k->p+15, " %ld", &contentlength)) { if (data->set.max_filesize && contentlength > data->set.max_filesize) { failf(data, "Maximum file size exceeded"); return CURLE_FILESIZE_EXCEEDED; } conn->size = k->contentlength; Curl_pgrsSetDownloadSize(data, k->contentlength); conn->size = contentlength; } /* check for Content-Type: header lines to get the mime-type */ else if (checkprefix("Content-Type:", k->p)) { Loading Loading @@ -1215,11 +1224,11 @@ CURLcode Curl_readwrite(struct connectdata *conn, * returning. */ if(!(data->set.no_body) && k->contentlength && (k->bytecount != k->contentlength) && if(!(data->set.no_body) && (conn->size != -1) && (k->bytecount != conn->size) && !conn->newurl) { failf(data, "transfer closed with %d bytes remaining to read", k->contentlength-k->bytecount); conn->size - k->bytecount); return CURLE_PARTIAL_FILE; } else if(conn->bits.chunk && conn->proto.http->chunk.datasize) { Loading lib/urldata.h +0 −1 Original line number Diff line number Diff line Loading @@ -306,7 +306,6 @@ struct ConnectBits { struct Curl_transfer_keeper { int bytecount; /* total number of bytes read */ int writebytecount; /* number of bytes written */ long contentlength; /* size of incoming data */ struct timeval start; /* transfer started at this time */ struct timeval now; /* current time */ bool header; /* incoming data has HTTP header */ Loading Loading
CHANGES +4 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,10 @@ Changelog Daniel (3 December) - swalkaus at yahoo.com patched libcurl to ignore Content-Length: headers when Tranfer-Encoding: chunked is used, as mandated by RFC2616. Daniel (2 December) - --ftp-pasv was added, which serves the only purpose of overriding a previously set --ftpport option. Starting now, --ftp-port is a recognized Loading
lib/transfer.c +17 −8 Original line number Diff line number Diff line Loading @@ -206,6 +206,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, fd_set *readfdp = k->readfdp; fd_set *writefdp = k->writefdp; long contentlength; if((k->keepon & KEEP_READ) && !readfdp) { /* reading is requested, but no socket descriptor pointer was set */ Loading Loading @@ -474,9 +475,18 @@ CURLcode Curl_readwrite(struct connectdata *conn, "Content-Length: 0" still prevents us from attempting to read the (missing) response-body. */ if(-1 != conn->size) /* According to RFC2616 section 4.4, we MUST ignore Content-Length: headers if we are now receiving data using chunked Transfer-Encoding. */ if(conn->bits.chunk) conn->size=-1; if(-1 != conn->size) { Curl_pgrsSetDownloadSize(data, conn->size); conn->maxdownload = conn->size; } } /* If max download size is *zero* (nothing) we already have nothing and can safely return ok now! */ if(0 == conn->maxdownload) Loading Loading @@ -590,14 +600,13 @@ CURLcode Curl_readwrite(struct connectdata *conn, info about the true size of the document we didn't get now. */ if ((k->httpcode != 416) && checkprefix("Content-Length:", k->p) && sscanf (k->p+15, " %ld", &k->contentlength)) { if (data->set.max_filesize && k->contentlength > sscanf (k->p+15, " %ld", &contentlength)) { if (data->set.max_filesize && contentlength > data->set.max_filesize) { failf(data, "Maximum file size exceeded"); return CURLE_FILESIZE_EXCEEDED; } conn->size = k->contentlength; Curl_pgrsSetDownloadSize(data, k->contentlength); conn->size = contentlength; } /* check for Content-Type: header lines to get the mime-type */ else if (checkprefix("Content-Type:", k->p)) { Loading Loading @@ -1215,11 +1224,11 @@ CURLcode Curl_readwrite(struct connectdata *conn, * returning. */ if(!(data->set.no_body) && k->contentlength && (k->bytecount != k->contentlength) && if(!(data->set.no_body) && (conn->size != -1) && (k->bytecount != conn->size) && !conn->newurl) { failf(data, "transfer closed with %d bytes remaining to read", k->contentlength-k->bytecount); conn->size - k->bytecount); return CURLE_PARTIAL_FILE; } else if(conn->bits.chunk && conn->proto.http->chunk.datasize) { Loading
lib/urldata.h +0 −1 Original line number Diff line number Diff line Loading @@ -306,7 +306,6 @@ struct ConnectBits { struct Curl_transfer_keeper { int bytecount; /* total number of bytes read */ int writebytecount; /* number of bytes written */ long contentlength; /* size of incoming data */ struct timeval start; /* transfer started at this time */ struct timeval now; /* current time */ bool header; /* incoming data has HTTP header */ Loading