Skip to content

Fix non-ASCII headers in the legacy HTTP parser - #1758

Open
thorvald-oai wants to merge 1 commit into
python-websockets:mainfrom
thorvald-oai:thorvald/fix-legacy-non-ascii-headers
Open

Fix non-ASCII headers in the legacy HTTP parser#1758
thorvald-oai wants to merge 1 commit into
python-websockets:mainfrom
thorvald-oai:thorvald/fix-legacy-non-ascii-headers

Conversation

@thorvald-oai

Copy link
Copy Markdown

Preserve non-ASCII header values in the legacy HTTP parser by avoiding a second validation after surrogate decoding. Raw header validation remains in place.

Includes a regression test for a UTF-8 header value. This applies the modern parser's existing fix to the legacy parser.

@thorvald-oai
thorvald-oai marked this pull request as ready for review September 10, 2026 20:20
@aaugustin

Copy link
Copy Markdown
Member

I didn't change the behavior of the legacy parser on purpose because it's only used by people who don't maintain their software at this point and I didn't want to break it for them.

@aaugustin aaugustin closed this Sep 11, 2026
@aaugustin

Copy link
Copy Markdown
Member

Sorry I misunderstood what you were proposing. I thought you were proposing to change the encoding, while you're actually only avoiding the double validation.

@aaugustin aaugustin reopened this Sep 11, 2026
@aaugustin

aaugustin commented Sep 11, 2026

Copy link
Copy Markdown
Member

For my understanding, what is it that led you to propose this change?

Just trying to maintain some understanding of how websockets is used and what problems occur :-)

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.

2 participants