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

curl: handle multiple Content-Type headers #18596

Merged
merged 1 commit into from
Oct 20, 2024

Conversation

samford
Copy link
Member

@samford samford commented Oct 19, 2024

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

#curl_http_content_headers_and_checksum contains code that works with a Content-Type header in a response but it expects there to always be only one header in the response. This is normally a reasonable assumption but we've come across a server that is giving a response with multiple Content-Type headers (Homebrew/homebrew-cask#189072), so this produces an error and causes brew audit to fail when checking the URL.

This works around the issue by naively using the last Content-Type header in the response when there's more than one. It's not something that should normally occur but this will handle the situation when it does.

`#curl_http_content_headers_and_checksum` contains code that works
with a `Content-Type` header in a response but it expects there to
always be only one header in the response. This is normally a
reasonable assumption but we've come across a server that is giving
a response with multiple `Content-Type` headers in the response, so
this produces an error and causes `brew audit` to fail when checking
the URL.

This works around the issue by naively using the last `Content-Type`
header in the response when there's more than one. It's not something
that should normally occur but this will handle the situation when it
does.
Copy link
Member

@ZhongRuoyu ZhongRuoyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be forbidden by the standard, but things do happen...

@MikeMcQuaid MikeMcQuaid merged commit d0ab3d3 into master Oct 20, 2024
27 checks passed
@MikeMcQuaid MikeMcQuaid deleted the handle-multiple-content-type-headers branch October 20, 2024 18:16
@MikeMcQuaid
Copy link
Member

Thanks @samford!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants