-
-
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
Automatic decompression does not remove related response headers #5182
Comments
Isn't curl the client? Who's the client that needs this to "be visible" ?
curl has no logic to ever remove headers from the output and it has never done this. I wouldn't call it a bug. It's like when you have curl handle chunked-encoding, the chunked headers are still in the output even though curl "decoded" the body.... |
My bad, this should have been "consumer which uses curl".
The problem is that if you compare the content length header value and the real value on disk, they do not match. Some consumers might trip here because they will consider this as a transport error.
That is true, but no transformation happens here and no content length is provided which might trick the client. |
The headers and the body don't match, which is my point. The headers would imply something that the body isn't syntactically correct for. Very similar to the compression case. I think we can come up with more examples. curl doesn't ever inhibit or "filter" individual headers. Headers are provided exactly as sent from the server. |
The Content-Length header is not the size of the decompressed response on the desk, it's just a header sent from the server, and as a consumer of an httpclient I expect to see my headers when I say something like The size of the response on disk after decompression is something else and the consumer is aware that it has nothing to do with the http response headers. |
I don't think that content encoding and transfer encoding can be compared. TE is a inheritable part of HTTP. You'd never expose the chunked stream to a consumer, would you? But CE is perfactly valid because the client asks for it with |
It doesn't matter if you don't think they compare, this is how curl works and the delivery of the headers exactly verbatim as the server sent them was always intended. Changing this behavior would be a modified behavior that would need to be opted in by users. |
Don't they do that by supplying |
Request a compressed response using one of the algorithms curl supports, and save the uncompressed document. There's not a word about stripping or updating headers there and since we haven't done that for the 17 years we've supported that command line option so far, I think we can say that the current behavior is the established that we can't break without careful consideration. |
This is working as intended. Closing. |
I concur, at least documentation should be updated for this. |
Why? The documentation should mention any modification done to the headers (and there's none). It's kinda reasonable to assume no other modifications than specified. Curl promises to only to decode the body. |
Please suggest! |
The modification happens on the body. |
Working on it. |
Yep. And is documented to happen under certain conditions. There is nothing documented to happen with the incoming headers. But I guess if there's still someone confused, it shouldn't hurt anybody to add "headers remain untouched" line to the documentation. |
Here is my proposal:
|
This is pretty clear, but the way it is written makes the reader maybe think the headers are updated in other cases and not just for this. How about...
|
Fully acceptable. |
Suggested-by: Michael Osipov Bug: #5182 (comment)
Suggested-by: Michael Osipov Bug: #5182 (comment)
Suggested-by: Michael Osipov Assisted-by: Jay Satiro Bug: #5182 (comment) Closes #5217
This comes from https://stackoverflow.com/a/61011806/696632.
Running on:
Consider the following:
What happens here:
random.txt
which is generated byText::Lorem
.I'd expect curl to do the same. (a bug?)
WDYT?
The text was updated successfully, but these errors were encountered: