Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
prioritize h2
  • Loading branch information
soundofspace committed Jun 10, 2025
commit d53a66ea7efd95f0150eb91b25f289e8c22301ea
2 changes: 1 addition & 1 deletion httpcore/_async/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ async def _connect(self, request: Request) -> AsyncNetworkStream:
if self._ssl_context is None
else self._ssl_context
)
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
alpn_protocols = ["h2", "http/1.1"] if self._http2 else ["http/1.1"]
ssl_context.set_alpn_protocols(alpn_protocols)

kwargs = {
Expand Down
2 changes: 1 addition & 1 deletion httpcore/_async/http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ async def handle_async_request(self, request: Request) -> Response:
if self._ssl_context is None
else self._ssl_context
)
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
alpn_protocols = ["h2", "http/1.1"] if self._http2 else ["http/1.1"]
ssl_context.set_alpn_protocols(alpn_protocols)

kwargs = {
Expand Down
2 changes: 1 addition & 1 deletion httpcore/_async/socks_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ async def handle_async_request(self, request: Request) -> Response:
else self._ssl_context
)
alpn_protocols = (
["http/1.1", "h2"] if self._http2 else ["http/1.1"]
["h2", "http/1.1"] if self._http2 else ["http/1.1"]
)
ssl_context.set_alpn_protocols(alpn_protocols)

Expand Down
2 changes: 1 addition & 1 deletion httpcore/_sync/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _connect(self, request: Request) -> NetworkStream:
if self._ssl_context is None
else self._ssl_context
)
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
alpn_protocols = ["h2", "http/1.1"] if self._http2 else ["http/1.1"]
ssl_context.set_alpn_protocols(alpn_protocols)

kwargs = {
Expand Down
2 changes: 1 addition & 1 deletion httpcore/_sync/http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def handle_request(self, request: Request) -> Response:
if self._ssl_context is None
else self._ssl_context
)
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
alpn_protocols = ["h2", "http/1.1"] if self._http2 else ["http/1.1"]
ssl_context.set_alpn_protocols(alpn_protocols)

kwargs = {
Expand Down
2 changes: 1 addition & 1 deletion httpcore/_sync/socks_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def handle_request(self, request: Request) -> Response:
else self._ssl_context
)
alpn_protocols = (
["http/1.1", "h2"] if self._http2 else ["http/1.1"]
["h2", "http/1.1"] if self._http2 else ["http/1.1"]
)
ssl_context.set_alpn_protocols(alpn_protocols)

Expand Down