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

Question about get_http_version() in SocketStream #123

Closed
ganeshmurthy opened this issue Jul 29, 2020 · 1 comment
Closed

Question about get_http_version() in SocketStream #123

ganeshmurthy opened this issue Jul 29, 2020 · 1 comment
Labels
http/2 question Further information is requested

Comments

@ganeshmurthy
Copy link

I was looking at the get_http_version() function in SocketStream:

class SocketStream(AsyncSocketStream):
    def __init__(
        self, stream_reader: asyncio.StreamReader, stream_writer: asyncio.StreamWriter,
    ):
        self.stream_reader = stream_reader
        self.stream_writer = stream_writer
        self.read_lock = asyncio.Lock()
        self.write_lock = asyncio.Lock()

    def get_http_version(self) -> str:
        ssl_object = self.stream_writer.get_extra_info("ssl_object")

        if ssl_object is None:
            return "HTTP/1.1"

So, it looks like if there is no SSL setup, the http version will always be HTTP/1.1
So, even if I specify http2=True with no SSL, the connection is always a HTTP/1.1 connection
Is there a way to do HTTP/2 over a connection with no SSL ?

Thanks.

@florimondmanca florimondmanca added http/2 question Further information is requested labels Aug 8, 2020
@florimondmanca
Copy link
Member

florimondmanca commented Aug 8, 2020

Hello!

Currently we only support HTTP/2 with HTTPS, which is why "no SSL" means "it must be HTTP/1.1".

There is related discussion about supporting unencrypted HTTP/2 (by adding support for h2c upgrades) here: encode/httpx#503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http/2 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants