Skip to content
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

tool_cb_hdr: allow --remote-header-name for all http responses #13303

Closed
wants to merge 1 commit into from

Conversation

jay
Copy link
Member

@jay jay commented Apr 6, 2024

  • Use the content-disposition filename (server-specified filename) for non-2xx responses.

For example, a server may send a content-disposition filename header with a redirect reply (3xx) but not with the final response (2xx). Without this change curl would ignore the server's specified filename and continue to use the filename extracted from the user-specified URL.

This is a partial revert of 75d79a4, which limited content-disposition and etag header processing to 2xx response codes. There's no explanation for why that was done.

Reported-by: Morgan Willcock

Fixes #13302
Closes #xxxx

- Use the content-disposition filename (server-specified filename) for
  non-2xx responses.

For example, a server may send a content-disposition filename header
with a redirect reply (3xx) but not with the final response (2xx).
Without this change curl would ignore the server's specified filename
and continue to use the filename extracted from the user-specified URL.

This is a partial revert of 75d79a4, which limited content-disposition
and etag header processing to 2xx response codes. There's no explanation
for why that was done.

Reported-by: Morgan Willcock

Fixes curl#13302
Closes #xxxx
@jay
Copy link
Member Author

jay commented Apr 6, 2024

This looks like a lot of change but it's almost all whitespace change. Add w=1 to the URL query to suppress the whitespace changes https://github.com/curl/curl/pull/13303/files?w=1

@bagder
Copy link
Member

bagder commented Apr 7, 2024

There's no explanation for why that was done.

It was made to make curl more careful about when to use data in response headers. It should probably allow 3xx as well as 2xx. Not convinced about 1xx, 4xx and 5xx.

@jay
Copy link
Member Author

jay commented Apr 7, 2024

It was made to make curl more careful about when to use data in response headers. It should probably allow 3xx as well as 2xx. Not convinced about 1xx, 4xx and 5xx.

The RFC doesn't limit it though I struggle to think of why a server would want to send a filename for those responses.

@bagder
Copy link
Member

bagder commented Apr 9, 2024

I struggle to think of why a server would want to send a filename for those responses.

Right. Hence this precaution: it seems unlikely and surprising to get the header for the other ranges, so it seems safer to not parse it then.

@bagder bagder added the HTTP label Apr 9, 2024
@jay
Copy link
Member Author

jay commented Apr 9, 2024

I don't think it is safer just limiting.

@jay
Copy link
Member Author

jay commented Apr 22, 2024

Does anyone else have an opinion on this

@jay
Copy link
Member Author

jay commented Apr 26, 2024

Closing in favor of #13484

@jay jay closed this Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Change in behavior for --remote-header-name
2 participants