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

Added support for CloseNotify in the event stream #45

Merged
merged 4 commits into from Sep 9, 2015

Conversation

dlclark
Copy link
Contributor

@dlclark dlclark commented Sep 6, 2015

StreamHandlers were hanging around after clients disconnected and creating noise. I suppose with enough hits to ServeHTTP it could have eventually impacted legitimate clients via port exhaustion, etc.

@afex
Copy link
Owner

afex commented Sep 6, 2015

is there a test you can write verifying the old behavior is fixed?

@dlclark
Copy link
Contributor Author

dlclark commented Sep 6, 2015

Originally I had confirmed the code manually via curl.

Getting Go1.4 to behave properly with request cancellations is a bit ugly, but after a few gyrations I got it working. Apparently 1.5 adds a http.Request.Cancel channel to make canceling long-running responses easier (learned this today in my research), but I didn't want to presume people had upgraded to 1.5 yet.

buf := []byte{0}
res, err := client.Do(req)
if err != nil {
log.Fatal(err)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these logging statements necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I'll remove them.

@afex
Copy link
Owner

afex commented Sep 9, 2015

thanks for this fix!

afex added a commit that referenced this pull request Sep 9, 2015
Added support for CloseNotify in the event stream
@afex afex merged commit 9351b72 into afex:master Sep 9, 2015
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.

None yet

2 participants