Skip to content

fix: preserve close directive after whitespace - #899

Open
ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:fix/connection-close-ows
Open

ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:fix/connection-close-ows

Conversation

@ShogunPanda

Copy link
Copy Markdown
Contributor

Summary

Preserve a recognized Connection: close directive when optional whitespace is followed by another token.

Changes

  • Add close-specific parser states without changing malformed keep-alive or upgrade handling.
  • Cover whitespace continuations, token-prefix behavior, pipelined requests, and responses.

Additional Informations

AI-assisted work. All changes reviewed by a human.

@Vizonex Vizonex left a comment

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.

Decided to review because llhttp has been pretty inactive in the past and I felt
like contributing to keep everything alive. I feel that changing the name from header_value_connection_ws
to header_value_connection_close is a pretty smart approach as the HEADER_STATE
Reflects the node's initial name to advance to, after skimming through the new test, it all seems to align up perfectly. Feel free to correct me if I'm wrong about anything however, this is my first time reviewing something in this repo after all.

@ShogunPanda

Copy link
Copy Markdown
Contributor Author

Thanks a lot for taking the time to review, it's much appreciated!

Small clarification: header_value_connection_ws isn't renamed. The PR adds two new close-specific states (header_value_connection_close and header_value_connection_close_ws), while header_value_connection_ws is left untouched for keep-alive and upgrade. That's intentional: a malformed keep-alive foo must still not set the keep-alive flag (covered by the new "Not setting keep-alive on malformed whitespace-separated value" test), whereas a recognized close stays effective, since failing to close is the riskier direction (e.g. pipelined data after Connection: close).

This branch has not been deployed

No deployments
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