python-hyper / hyper

HTTP/2 for Python.
http://hyper.rtfd.org/en/latest/
MIT License
1.05k stars 192 forks source link

Add a flag to connection and to response objects to find out connection type. #285

Closed fendouai closed 7 years ago

fendouai commented 8 years ago

I can not get the http version from headers,how to get the http version when i use http2.

Lukasa commented 8 years ago

@fendouai If you call type() on the response object you're holding, that will give you the object, which will be either a HTTP20Response or a HTTP11Response. That is enough to know the version.

However, I think we should add a feature that lets you consult a flag.

fendouai commented 8 years ago

Thank you. And I think the flag which shows the version of the http is important.

nateprewitt commented 8 years ago

Would you like to help contribute a patch for this @fendouai? If not, I'd be willing to pick this up.

fendouai commented 8 years ago

I am trying to find the version. I am not familiar with the project yet.If I have a solution,I will try to contribute a patch for this.

nateprewitt commented 7 years ago

@Lukasa I've had this sitting for a while (9286249). If we still want it, I can open the PR. I wasn't sure if standard practice was truncating ".0" from HTTP/2 or if we even wanted "HTTP" in the version flag.

Lukasa commented 7 years ago

I actually strongly recommend using the enum module and then using an enum to flag this. Let's pretend we're real programmers. ;)

Lukasa commented 7 years ago

Resolved by #296.