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

close websocket if proxyReq is closed before upgrade #708

Merged
merged 2 commits into from
Oct 1, 2014

Conversation

minrk
Copy link
Contributor

@minrk minrk commented Sep 30, 2014

avoids leaving client sockets open when upstream connections are rejected before the upgrade event fires.

I'm not 100% sure about the style or logic of the patch, but the added test cases and my own code suggest that it is doing the right thing. Guidance would be appreciated.

closes #624
closes #627

should close the client socket with ECONNRESET,
but currently is left hanging.
@minrk
Copy link
Contributor Author

minrk commented Sep 30, 2014

Hm, on further testing, this isn't quite sufficient to fix my use case. I'll dig in some more.

@minrk
Copy link
Contributor Author

minrk commented Oct 1, 2014

Okay, this PR now actually fixes my problem. The key is handling the proxyReq response when upgrade won't fire. I think on('request') when response.upgrade is false is the right way to handle this.

avoids leaving client sockets open when upstream
connections are rejected.
@jcrugzz
Copy link
Contributor

jcrugzz commented Oct 1, 2014

@minrk based on what i understand here this looks like the correct behavior. Awesome job!

jcrugzz added a commit that referenced this pull request Oct 1, 2014
close websocket if proxyReq is closed before upgrade
@jcrugzz jcrugzz merged commit b065d92 into http-party:master Oct 1, 2014
@jcrugzz
Copy link
Contributor

jcrugzz commented Oct 1, 2014

@minrk my only question is if we should do something about the response as well in the case where it is not an upgrade request.

@minrk minrk deleted the close-closes branch October 1, 2014 02:46
@minrk
Copy link
Contributor Author

minrk commented Oct 1, 2014

Since the on('upgrade'... event registered just below fires in that case, I can't think of anything extra that you would do, but I'm new to this stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants