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

HTTP::Server: defer request upgrade (aka: WebSockets) #9243

Merged
merged 1 commit into from May 11, 2020

Conversation

waj
Copy link
Member

@waj waj commented May 7, 2020

Currently when a HTTP request is upgraded, the block is invoked synchronously, not returning from the handler and thus not allowing the request to be logged for example.

With this change, the handover is done right after the current request is finished. For example, if the LogHandler is enabled, the protocol switch is logged right before the websocket starts, instead of when the websocket connection is finished.

Also, because of this simplification, I was able to move the closing of the IO to the caller of the RequestProcessor (the HTTP::Server). The upgrade handler is not responsible anymore of closing the socket.

@jhass jhass added this to the 0.35.0 milestone May 8, 2020
@waj waj merged commit 8e382d7 into crystal-lang:master May 11, 2020
@waj waj deleted the fix/http-server-defer-upgrade branch May 11, 2020 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants