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

improve checks in stream? for http1 #58

Merged
merged 1 commit into from
Aug 29, 2023

Conversation

zarqman
Copy link
Contributor

@zarqman zarqman commented Aug 29, 2023

This PR tightens up the check in stream? for HTTP/1.1 requests by ensuring the sec-websocket-accept header was verified in addition to status == 101.

Before

Status not 101       : `stream?` => false
101 w/missing header : `stream?` => true
Bad header           : raises exception

After

Status not 101       : `stream?` => false
101 w/missing header : `stream?` => false
Bad header           : raises exception

Reference

RFC 6455, near the end of section 4.1, says that a WS connection must be failed if the header is missing or invalid (in point (4), at the bottom of page 19).

Types of Changes

  • Bug fix.

Contribution

@ioquatix ioquatix merged commit fd57e55 into socketry:main Aug 29, 2023
20 of 22 checks passed
@ioquatix
Copy link
Member

Thanks, this is a great addition.

@zarqman zarqman deleted the ensure-h1-verified branch August 30, 2023 22:29
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