Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Allow whitespace after HTTP response header name#9208

Merged
stephentoub merged 1 commit into
dotnet:masterfrom
stephentoub:fix_header_parsing
Jun 7, 2016
Merged

Allow whitespace after HTTP response header name#9208
stephentoub merged 1 commit into
dotnet:masterfrom
stephentoub:fix_header_parsing

Conversation

@stephentoub
Copy link
Copy Markdown
Member

Be a bit more lenient in what we allow in the formatting of response headers.

Fixes https://github.com/dotnet/corefx/issues/9201
cc: @davidsh, @ericeil, @RicardoRazz

}

internal static bool IsWhiteSpaceLatin1(byte c)
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should add a comment about the space character (' ') as well since you listed all the others.

Copy link
Copy Markdown
Member Author

@stephentoub stephentoub Jun 7, 2016

Choose a reason for hiding this comment

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

I didn't add this, just moved it from below (GitHub doesn't show that well). But I can augment it.

@davidsh
Copy link
Copy Markdown
Contributor

davidsh commented Jun 7, 2016

Add some comments. Otherwise, LGTM.

@stephentoub stephentoub force-pushed the fix_header_parsing branch 2 times, most recently from e22608d to 2efad8a Compare June 7, 2016 12:55
Be a bit more lenient in what we allow in the formatting of response headers on Unix. The RFC states that "Each header field consists of a case-insensitive field name followed by a colon (":"), optional leading whitespace, the field value, and optional trailing whitespace." However, whitespace between the header name and the colon is accepted by WinHttpHandler, by the .NET Framework, and by all browsers on which I tried it, and servers can easily include such whitespace; if they do and we're not tolerant of it, requests to such servers will fail.
@stephentoub stephentoub force-pushed the fix_header_parsing branch from 2efad8a to 888a01c Compare June 7, 2016 13:38
@stephentoub stephentoub merged commit ca0075e into dotnet:master Jun 7, 2016
@stephentoub stephentoub deleted the fix_header_parsing branch June 7, 2016 17:19
@karelz karelz modified the milestone: 1.1.0 Dec 3, 2016
@karelz karelz added os-linux Linux OS (any supported distro) and removed X-Plat labels Mar 8, 2017
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…sing

Allow whitespace after HTTP response header name

Commit migrated from dotnet/corefx@ca0075e
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Net os-linux Linux OS (any supported distro)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants