Closed ojii closed 7 years ago
@ojii Thanks for this patch, this looks like a good change. Do you mind adding a test to confirm that the message is present? That way we won't accidentally regress it.
@Lukasa will try. Had issues running the test suite (related to my network setup, not the test suite itself from what I can see), which is why there's no test included for now.
@Lukasa I've added a test, though I had to mock out all of wrap_socket
. I hope this is okay.
Looks like https://github.com/ojii/hyper/blob/bdcf38e403c1f669d8d66d760ad16ee4c7153451/test/test_integration.py#L38breaks the other tests. proto
becomes None
in wrap_socket
, but the next assertion that proto
is in H2_NPN_PROTOCOLS
passes because None
is allowed.
Of course with my extra check, this fails now with the explicit check against None
.
Not sure what the best way to proceed is.
So, is there any reason not to extend the assertion below rather than add a new one? If not, you should assert that the protocol is in H2_NPN_PROTOCOLS
.
Looks like a comment got moved.
Really sorry about how messy this pull request got. Should I re-open another PR with the changes as one commit?
There's no need: if you rebase the branch to squash the commits down and then force push to the same branch, GitHub will work it out. =D
I hope it's fine now. Let me know if there's any other changes that are needed.
Looks good to me. Good work @ojii! :sparkles:
Thank you for your great work bringing HTTP2 to Python.
Today I ran into an issue with hyper, where the OpenSSL version in my environment was too old (1.0.1) so it did not have ALPN, which was required by the server. This is of course not a bug/problem with hyper itself, however the error message I got from hyper was not that helpful (it was an
AssertionError
with no help message). This pull request suggests a new check after wrapping the socket in SSL to see if a protocol was selected and if not tells the user that none was selected and suggests the user check their OpenSSL version.