rust-lang / rust-lang/rust-analyzer
Content-Length parsing too strict?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Hi,
I'm using a fork of Emacs that handles jsonrpc processing on a separate thread, and that version currently emits more than one space character between the 'Content-Length:' header and the actual field value. While I can easily change that fork to emit just a single space, I believe the standard allows for any amount of whitespace (RFC 2616, 4.2?). Also, I think the header names are supposed to be case-insensitive which as far as I can see isn't how the lsp-server crate handles the Content-Length header.
Looks to me like (if I'm interpreting the standard correctly) both would be fixed easily by adding one trim() and one to_lowercase() within lsp-server/src/msg.rs (read_msg_text)?
thanks,
Sebastian
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lsp-server/src/msg.rs at read_msg_text and review how the Content-Length header is parsed. Verify the stated whitespace and header-name case behavior against the referenced RFC, then confirm the parser accepts valid variations without changing other message handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100