Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper message termination on half-closed socket #140

Closed
kenballus opened this issue Jul 4, 2024 · 0 comments · Fixed by #142
Closed

Improper message termination on half-closed socket #140

kenballus opened this issue Jul 4, 2024 · 0 comments · Fixed by #142

Comments

@kenballus
Copy link
Contributor

When WEBrick receives a request with no message body that is missing the final CRLF pair after the headers, and then the connection is closed for writing by the client, WEBrick responds to the request as though it were complete.

For example, if WEBrick receives the following request, (notice the missing final CRLF)

GET / HTTP/1.1\r\n
Host: whatever\r\n

and the client then half-closes the socket, WEBrick will still respond to the request. This request should be considered incomplete and rejected. This is what nearly every other HTTP implementation does.

jeremyevans added a commit to jeremyevans/webrick that referenced this issue Jul 5, 2024
Fix tests that did not have correctly formatted headers.

Fixes ruby#140
jeremyevans added a commit to jeremyevans/webrick that referenced this issue Jul 5, 2024
Fix tests that did not have correctly formatted headers.

Fixes ruby#140
jeremyevans added a commit to jeremyevans/webrick that referenced this issue Jul 11, 2024
Fix tests that did not have correctly formatted headers.

This changes one test, with a request line that ends in
bare LF instead of CRLF, from raising BadRequest to raising
EOFError, but that seems reasonable.

Fixes ruby#140
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant