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

Http2 support for middleware, fixes #123 #128

Merged
merged 10 commits into from
Jan 6, 2017
Merged

Http2 support for middleware, fixes #123 #128

merged 10 commits into from
Jan 6, 2017

Conversation

pkieltyka
Copy link
Member

Copy link
Contributor

@lclarkmichalek lclarkmichalek left a comment

Choose a reason for hiding this comment

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

Sorry for being so slow to get to this! Looks good, I like the changes to reduce the amount of stuff in the 1.8 specific files. I've added a couple of comments. This doesn't handle the compression middleware atm I think?

_, rf := w.(io.ReaderFrom)

bw := basicWriter{ResponseWriter: w}
if protoMajor == 2 {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is much nicer

bw := basicWriter{ResponseWriter: w}
if protoMajor == 2 {
_, ps := w.(http.Pusher)
if cn && fl && ps && rf {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think HTTP2 requests have ReaderFrom


server := http.Server{
Addr: ":7072",
Handler: handler,
Copy link
Contributor

Choose a reason for hiding this comment

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

This handler should be wrapped in a middleware to have this test check that the response writer still has the interfaces expected after wrapping.

handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, cn := w.(http.CloseNotifier)
if !cn {
t.Fatal("request should have been a http.CloseNotifier")
Copy link
Contributor

Choose a reason for hiding this comment

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

Now I think about it, these messages should probably all read ResponseWriter should have been ...

@pkieltyka
Copy link
Member Author

pkieltyka commented Jan 5, 2017 via email

@pkieltyka
Copy link
Member Author

all done. thanks for the feedback

@pkieltyka pkieltyka merged commit 49a0ea6 into master Jan 6, 2017
@pkieltyka pkieltyka deleted the http2 branch January 6, 2017 20:48
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