}
else if(k->size != -1) {
if(data->set.max_filesize &&
- k->size > data->set.max_filesize) {
+ !k->ignorebody &&
+ (k->size > data->set.max_filesize)) {
failf(data, "Maximum file size exceeded");
return CURLE_FILESIZE_EXCEEDED;
}
+ if(k->ignorebody)
+ infof(data, "setting size while ignoring");
Curl_pgrsSetDownloadSize(data, k->size);
k->maxdownload = k->size;
}
}
- /* This is the last response that we will got for the current request.
- * Check on the body size and determine if the response is complete.
- */
- result = Curl_http_size(data);
- if(result)
- goto out;
-
/* If we requested a "no body", this is a good time to get
* out and return home.
*/
/* final response without error, prepare to receive the body */
result = Curl_http_firstwrite(data);
+ if(!result)
+ /* This is the last response that we get for the current request.
+ * Check on the body size and determine if the response is complete.
+ */
+ result = Curl_http_size(data);
+
out:
if(last_hd) {
/* if not written yet, write it now */
connclose(data->conn, "excess found in a read");
}
}
- else if(nwrite < nbytes) {
+ else if((nwrite < nbytes) && !data->req.ignorebody) {
failf(data, "Exceeded the maximum allowed file size "
"(%" FMT_OFF_T ") with %" FMT_OFF_T " bytes",
data->set.max_filesize, data->req.bytecount);
# 1591, 1943. See https://github.com/hyperium/hyper/issues/2699 for details.
%if hyper
266
+477
500
579
587
test444 test445 test446 test447 test448 test449 test450 test451 test452 \
test453 test454 test455 test456 test457 test458 test459 test460 test461 \
test462 test463 test467 test468 test469 test470 test471 test472 test473 \
-test474 test475 test476 \
+test474 test475 test476 test477 \
\
test490 test491 test492 test493 test494 test495 test496 test497 test498 \
test499 test500 test501 test502 test503 test504 test505 test506 test507 \
--- /dev/null
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+--max-filesize
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data nocheck="yes">
+HTTP/1.1 301 OK
+Date: Tue, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Location: %TESTNUMBER0002
+Accept-Ranges: bytes
+Content-Length: 26
+Funny-head: yesyes
+
+aaaaaaaaaaaaaaaaaaaa-foo-
+</data>
+
+<data2 nocheck="yes">
+HTTP/1.1 200 OK
+Date: Tue, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Accept-Ranges: bytes
+Content-Length: 4
+Funny-head: yesyes
+
+hej
+</data2>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+<name>
+HTTP GET with maximum filesize with a redirect sending data
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER --max-filesize 5 -L
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<protocol>
+GET /%TESTNUMBER HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+GET /%TESTNUMBER0002 HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
+</testcase>