RobotsAndPencils / buford

A push notification delivery engine for the new HTTP/2 APNS service.
MIT License
474 stars 52 forks source link

parse GOAWAY error responses from Apple #71

Closed nathany closed 8 years ago

nathany commented 8 years ago

Thanks to @bradfitz for his work on x/net/http2. https://github.com/golang/go/issues/14627

fixes #33.

need latest http2: go get -u golang.org/x/net/http2

curtisallen commented 8 years ago

Nice looks good, Could you add a test for the GOAWAY case to service_test.go ? other than that LGTM

nathany commented 8 years ago

This is the GoAwayError from actually hitting Apple:

http2.GoAwayError{LastStreamID:0x0, ErrCode:0x0, DebugData:"{\"reason\":\"BadCertificateEnvironment\"}"}

I'm not sure how to get that to return from an http handler though. Any ideas?

nathany commented 8 years ago

I'm looking at https://github.com/golang/net/blob/master/http2/transport_test.go#L2028 to see if I can write a test for this.

nathany commented 8 years ago

Right now httptest.NewServer reports HTTP/1.1 for handlers (req.Proto).

curtisallen commented 8 years ago

my comment on the PR assumed you could use httptest one of my favorite features of go. I now see it’s so much more then I thought to be able to test this. If the Framer.WriteGoAway approach becomes to cumbersome, I’m okay with logging a issue and revisiting once httptest supports http/2