Skip to content

jsonrpc2: fix Content-Length header parsing to be case-insensitive#789

Merged
maciej-kisiel merged 1 commit intomodelcontextprotocol:mainfrom
nithinputhenveettil:fix/content-length-case-insensitive
Feb 16, 2026
Merged

jsonrpc2: fix Content-Length header parsing to be case-insensitive#789
maciej-kisiel merged 1 commit intomodelcontextprotocol:mainfrom
nithinputhenveettil:fix/content-length-case-insensitive

Conversation

@nithinputhenveettil
Copy link
Contributor

Fix Content-Length header parsing to be case-insensitive as per LSP specification.

All unit tests pass locally (go test ./...).

Fixes #787

@nithinputhenveettil
Copy link
Contributor Author

@maciej-kisiel :

Like you mentioned in the issue, I also feel a simple strings.EqualFold should do the job. All unit tests are passing successfully. I also changed Content-Length in the line below to different variations like content-length, COntent-LeNgth, etc., and in all cases the tests ran successfully.

https://github.com/modelcontextprotocol/go-sdk/blob/main/internal/jsonrpc2/frame.go#L203

Copy link
Contributor

@maciej-kisiel maciej-kisiel left a comment

Choose a reason for hiding this comment

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

Thanks for contributing!

@maciej-kisiel maciej-kisiel merged commit 23ab1bf into modelcontextprotocol:main Feb 16, 2026
6 checks passed
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.

HeaderFramer rejects lowercase content-length header (case-insensitive per RFC)

2 participants