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

Document protocol versions and negotiation mechanism #192

Closed
qwerty32123 opened this issue Aug 5, 2019 · 7 comments
Closed

Document protocol versions and negotiation mechanism #192

qwerty32123 opened this issue Aug 5, 2019 · 7 comments
Labels
good first issue Good for newcomers

Comments

@qwerty32123
Copy link

qwerty32123 commented Aug 5, 2019

I need to make a http2 get requests, i tried with hyper but having issues with headers my question is if i can make these same requests with httpx
python-hyper/hyper#416
I dont see in documentation anything about requests compatibility or about using http2 when doing the requests

also it has proxy support?

@sethmlarson
Copy link
Contributor

Currently httpx supports HTTP/2 via ALPN (meaning HTTPS-only) and does so automatically (We negotiate which protocol version to use before issuing requests).

We could add a section in the documentation about which protocols we support and via what mechanism they are negotiated.

Proxy support is planned, see #163

@sethmlarson sethmlarson changed the title Make a http2 requests? Document protocol versions and negotiation mechanism Aug 6, 2019
@sethmlarson sethmlarson added the good first issue Good for newcomers label Aug 6, 2019
@jlaine
Copy link

jlaine commented Aug 14, 2019

Looking a bit further into the future how do we plan to support HTTP/3? Unlike HTTP/2, support can only be determined after a first request completes, if the Alt-Svc header is present.

https://http3-explained.haxx.se/en/h3-altsvc.html

curl has flags which allow you to force the http version, do we want something similar?

@sethmlarson
Copy link
Contributor

sethmlarson commented Aug 14, 2019

Yep, it's a completely different deal. I've got a couple thoughts on how we can support H3:

  • Make it a Dispatcher, probably the easiest but the least integrated. It could be bundled with httpx or a separate library.
  • Integrate directly with httpx, maybe controllable on the client (allow_http3?) and then we have a client session data storage mechanism. Could be used for alt-svc, cookies, hsts that aren't on the preload list, with a middleware could be used as a cache, all sorts of important things that HTTP clients should remember.

I'd prefer option 2 for multiple reasons, because I feel like the client session storage should be a feature regardless of whether we integrate HTTP/3 natively

@tomchristie
Copy link
Member

Integrate directly with httpx

Yup, we'd want to go down this route.

On a first pass we probably wouldn't bother storing info about "is an HTTP/3 service available for this host", but instead just rely on "Is there an existing H3 connection, or an existing upgradable H1/2 connection"? Our standard connection keep-alive policy would be enough to make sure that users would end up on HTTP/3 services where available.

curl has flags which allow you to force the http version, do we want something similar?

Yes - we'll want something like an http_version(s) argument & property on the Client and top-level API, which can be used to specify which of 1.1 / 2 / 3 should be supported.

@sethmlarson
Copy link
Contributor

sethmlarson commented Aug 15, 2019

Do we really want it for the top level API? I'm talking about the httpx.request() APIs. Tbh I don't see a point to doing anything except HTTP/1 on those short-lived connections.

@tomchristie
Copy link
Member

Yes true - wasn't really thinking there.

@florimondmanca
Copy link
Member

Closing this as most likely stale now - see HTTP/2 Support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants