From 51c197f956c9fa748e18ae26f348d39359a53d84 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 21 Aug 2024 16:42:50 -0700 Subject: [PATCH] Fix ENABLE_PUSH --- hyper/http20/connection.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hyper/http20/connection.py b/hyper/http20/connection.py index b8be292b..5be9162c 100644 --- a/hyper/http20/connection.py +++ b/hyper/http20/connection.py @@ -32,6 +32,12 @@ import threading import itertools +try: + from h2.settings import ENABLE_PUSH +except ImportError: + from h2.settings import SettingCodes + ENABLE_PUSH = SettingCodes.ENABLE_PUSH + log = logging.getLogger(__name__) DEFAULT_WINDOW_SIZE = 65535 @@ -403,7 +409,7 @@ def _connect_upgrade(self, sock): with self._conn as conn: conn.initiate_upgrade_connection() conn.update_settings( - {h2.settings.ENABLE_PUSH: int(self._enable_push)} + {ENABLE_PUSH: int(self._enable_push)} ) self._send_outstanding_data() @@ -424,7 +430,7 @@ def _send_preamble(self): with self._conn as conn: conn.initiate_connection() conn.update_settings( - {h2.settings.ENABLE_PUSH: int(self._enable_push)} + {ENABLE_PUSH: int(self._enable_push)} ) self._send_outstanding_data()