-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"--max-filesize 0" doesn't seem to work as described #14440
Comments
Reported-by: MasterInQuestion on github Fixes #14440
|
Didn't manage to locate the "-X"... |
Why does it for this example seem to still download the whole file..? "--max-filesize 1" variant worked intended. See also: ---- More suitable to test: |
@bagder, probably worth your attention. |
What is? I don't understand what you're talking about. |
Pardon. |
That's a curl command line. What about it? |
You ask for |
The question is: ---- Rationale explained in 1st post: |
OK, so what is the exact question? |
How to: |
That is exactly what you get with:
|
That is exactly what you get me with... The problem is: Did it work (without full-download) for you? |
I also don't understand what you are asking. You want curl to behave as if it's receiving a HEAD response and close? What do you mean it causes an unwanted download? For example this download of 200MB should terminate immediately (after receiving the headers) if you tell curl it's a HEAD request but then change it custom to GET:
The server sees GET and replies with the content but curl will terminate the connection after the headers. It sounds to me like you want to simulate a HEAD reply for a server that does not support those requests but if you send a GET request to the server then it may send data before curl can close the connection. That's what you are asking the server to do with GET you want to get the resource. Correct me if I'm wrong @bagder but I'm pretty sure it's discarded as excess in such a case (ie not written to -o outfile) though I don't know if that's guaranteed |
Compare: #1 also worked for me. (no notable download) |
As I have explained the server may send data before curl can close the connection. I took a look at your latter example in Wireshark and google takes approximately 3 seconds to reply with HTTP/2 HEADERS, I don't know why so long but it has nothing to do with curl. Then the server follows with DATA frames and during that entire time which is less than 1 second like 100 200 ms curl replies with RST_STREAM on the stream and then GOAWAY on the connection. You cannot expect no data will be sent because you are requesting the data is sent and curl needs to hang up after receiving the headers. |
[[ Then the server follows with DATA frames, and during that entire time which is less than 1 second like 100, 200 ms: You cannot expect no data will be sent: because you are requesting the data be sent. Meanwhile I noted using "--max-filesize 1" with "-L", had caused those carp a redirection message of length: Workaround would be rising the limit to somewhat higher more tolerable value, e.g. "4K" (4,096 B?). |
I see, you are saying that --max-filesize applies to servers that redirect. Users of --max-filesize may want to limit the overall bytes downloaded even if it's specifically documented as file size downloaded, so I'm not sure that's a bug. What happens on redirect is curl is discarding the bytes like if the redirect is from localhost/foo to localhost/bar then it ignores foo download ( Anyone else have an opinion on whether this is appropriate behavior? |
[[ What happens on redirect is: Anyone else have an opinion on whether this is appropriate behavior? The "foobar" non-sense is extraordinarily befuddling... |
The ignored response-body should not be counted as "file download" data. That should be a bug if it is. The max filesize should be for the data actually delivered/saved, not just transferred I think. |
Seemingly no-op, or null the limit.
Somewhat against: https://curl.se/docs/manpage.html#--max-filesize
Use case:
curl -v --max-filesize 1 -L "https://github.com/mozilla-mobile/firefox-android/assets/38040960/fd50937d-5442-494e-b4aa-0baf75569a57"
.
Effectively doing HEAD but with GET:
[ ^ Alike what browsers do: https://bugzilla.mozilla.org/show_bug.cgi?id=1872503#c3 ]
Certain servers may refuse to serve HEAD (example reported HTTP 403 Forbidden), meanwhile the file may be large.
Related:
https://github.com/curl/curl/issues/11810
The text was updated successfully, but these errors were encountered: