Skip to content

Fixed parsing of incoming comma-separated list of Accept headers #973

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

Merged
merged 1 commit into from
Mar 18, 2021

Conversation

bart-degreed
Copy link
Contributor

@bart-degreed bart-degreed commented Mar 18, 2021

Our integration tests did actually test for compound values. But they use an internal loopback, which bypasses the actual Accept header parsing that occurs on incoming socket bytes.

Because httpContext.Request.Headers["Accept"] returns StringValues, I blindly assumed that this would break up comma-separated values. But it does not, as explained here. It only contains multiple entries when multiple Accept header lines are sent sequentially (or when short-circuited, as in our tests).

There seems no way to bypass the internal comma-separated values parsing that occurs in integration tests. Even passing a single comma-delimited string runs through an internal parser, producing a StringValues with multiple entries.

Fixes #970.

@maurei maurei merged commit 6289373 into master Mar 18, 2021
@maurei maurei deleted the accept-header-fix branch March 18, 2021 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Comma-delimited Accept header is not correctly parsed
2 participants