Skip to content

Handle LSP header order and case when reading messages - #33

Open
blouirts123 wants to merge 1 commit into
python-lsp:developfrom
blouirts123:fix/lsp-header-parsing
Open

blouirts123 wants to merge 1 commit into
python-lsp:developfrom
blouirts123:fix/lsp-header-parsing

Conversation

@blouirts123

Copy link
Copy Markdown

Valid LSP messages are lost when Content-Type precedes Content-Length, or the length field uses mixed case: the reader examines only the first header line, fails to obtain a length, and reads subsequent frames into the same body.

Find the length throughout the header block and compare the field name case-insensitively, following the LSP base protocol and HTTP field semantics. A three-frame regression checks both header ordering and mixed case before a trailing frame, so reading to EOF cannot accidentally pass.

Validation on Windows: reader tests pass on Python 3.8.20 and 3.11.15; pycodestyle, pyflakes, and pylint pass. Full suites have 27 passes and one timezone-sensitive test_writer_bad_message failure on each version. A clean-base run in the same Python 3.11 environment has 26 passes and the identical failure (existing issue #6 / PR #32). Invalid framing and the existing reader error-handler limitation remain separate concerns.

@blouirts123
blouirts123 marked this pull request as draft October 16, 2026 04:52
@blouirts123
blouirts123 marked this pull request as ready for review October 16, 2026 05:24
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.

1 participant