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

fix HTTP/2 docs #3262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ requests and responses will be transported over HTTP/2, since both the client
*and* the server need to support HTTP/2. If you connect to a server that only
supports HTTP/1.1 the client will use a standard HTTP/1.1 connection instead.

To force HTTP/2 to be enabled, disable HTTP/1.1. Otherwise, the client will try to use HTTP/1.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't correct. Here's the deal...

  • Default. http1=True, http2=False - HTTP/1.1 will be used.
  • HTTP/2 support enabled. http1=True, http2=True - Either HTTP/1.1 or HTTP/2 will be used. The protocol negotiation (ALPN) occurs during the SSL setup.
  • Force HTTP/2. http1=False, http2=True - HTTP/2 will be used, without negotiation. Not a typically useful configuration, tho allows HTTP/2 over plain HTTP.

```python
client = httpx.AsyncClient(http1=False, http2=True)
# or
async with httpx.AsyncClient(http1=False, http2=True) as client:
```

You can determine which version of the HTTP protocol was used by examining
the `.http_version` property on the response.

Expand Down