Skip to content

Commit d53a66e

Browse files
committed
prioritize h2
1 parent ae46dfb commit d53a66e

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

httpcore/_async/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ async def _connect(self, request: Request) -> AsyncNetworkStream:
143143
if self._ssl_context is None
144144
else self._ssl_context
145145
)
146-
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
146+
alpn_protocols = ["h2", "http/1.1"] if self._http2 else ["http/1.1"]
147147
ssl_context.set_alpn_protocols(alpn_protocols)
148148

149149
kwargs = {

httpcore/_async/http_proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ async def handle_async_request(self, request: Request) -> Response:
304304
if self._ssl_context is None
305305
else self._ssl_context
306306
)
307-
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
307+
alpn_protocols = ["h2", "http/1.1"] if self._http2 else ["http/1.1"]
308308
ssl_context.set_alpn_protocols(alpn_protocols)
309309

310310
kwargs = {

httpcore/_async/socks_proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ async def handle_async_request(self, request: Request) -> Response:
252252
else self._ssl_context
253253
)
254254
alpn_protocols = (
255-
["http/1.1", "h2"] if self._http2 else ["http/1.1"]
255+
["h2", "http/1.1"] if self._http2 else ["http/1.1"]
256256
)
257257
ssl_context.set_alpn_protocols(alpn_protocols)
258258

httpcore/_sync/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def _connect(self, request: Request) -> NetworkStream:
143143
if self._ssl_context is None
144144
else self._ssl_context
145145
)
146-
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
146+
alpn_protocols = ["h2", "http/1.1"] if self._http2 else ["http/1.1"]
147147
ssl_context.set_alpn_protocols(alpn_protocols)
148148

149149
kwargs = {

httpcore/_sync/http_proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def handle_request(self, request: Request) -> Response:
304304
if self._ssl_context is None
305305
else self._ssl_context
306306
)
307-
alpn_protocols = ["http/1.1", "h2"] if self._http2 else ["http/1.1"]
307+
alpn_protocols = ["h2", "http/1.1"] if self._http2 else ["http/1.1"]
308308
ssl_context.set_alpn_protocols(alpn_protocols)
309309

310310
kwargs = {

httpcore/_sync/socks_proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def handle_request(self, request: Request) -> Response:
252252
else self._ssl_context
253253
)
254254
alpn_protocols = (
255-
["http/1.1", "h2"] if self._http2 else ["http/1.1"]
255+
["h2", "http/1.1"] if self._http2 else ["http/1.1"]
256256
)
257257
ssl_context.set_alpn_protocols(alpn_protocols)
258258

0 commit comments

Comments
 (0)