File pr-402-h2-settings-fix.patch of Package python-hyper
From 88d4e67ce68abad64647582a95a1b786394109b5 Mon Sep 17 00:00:00 2001
From: John Vandenberg <jayvdb@gmail.com>
Date: Thu, 28 Mar 2019 15:13:16 +0700
Subject: [PATCH 1/2] HTTP20Connection: Fix use of h2.settings
Fixes https://github.com/Lukasa/hyper/issues/372
---
hyper/http20/connection.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hyper/http20/connection.py b/hyper/http20/connection.py
index b8be292b..c6df953f 100644
--- a/hyper/http20/connection.py
+++ b/hyper/http20/connection.py
@@ -7,7 +7,7 @@
"""
import h2.connection
import h2.events
-import h2.settings
+from h2.settings import SettingCodes
from ..compat import ssl
from ..tls import wrap_socket, H2_NPN_PROTOCOLS, H2C_PROTOCOL
@@ -403,7 +403,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)}
+ {SettingCodes.ENABLE_PUSH: int(self._enable_push)}
)
self._send_outstanding_data()
@@ -424,7 +424,7 @@ def _send_preamble(self):
with self._conn as conn:
conn.initiate_connection()
conn.update_settings(
- {h2.settings.ENABLE_PUSH: int(self._enable_push)}
+ {SettingCodes.ENABLE_PUSH: int(self._enable_push)}
)
self._send_outstanding_data()
From cf3bef7ab81ee559c7f13ff094dfd5382884ee1f Mon Sep 17 00:00:00 2001
From: John Vandenberg <jayvdb@gmail.com>
Date: Thu, 28 Mar 2019 19:20:33 +0700
Subject: [PATCH 2/2] tests: Fix use of h2.settings
---
test/test_hyper.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/test/test_hyper.py b/test/test_hyper.py
index b826c63c..9b220ca3 100644
--- a/test/test_hyper.py
+++ b/test/test_hyper.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
-import h2.settings
-
from h2.frame_buffer import FrameBuffer
from h2.connection import ConnectionState
+from h2.settings import SettingCodes
from hyperframe.frame import (
Frame, DataFrame, RstStreamFrame, SettingsFrame, PushPromiseFrame,
WindowUpdateFrame, HeadersFrame, ContinuationFrame, GoAwayFrame,
@@ -766,7 +765,7 @@ def test_incrementing_window_after_close(self):
# the default max frame size (16,384 bytes). That will, on the third
# frame, trigger the processing to increment the flow control window,
# which should then not happen.
- f = SettingsFrame(0, settings={h2.settings.INITIAL_WINDOW_SIZE: 100})
+ f = SettingsFrame(0, settings={SettingCodes.INITIAL_WINDOW_SIZE: 100})
c = HTTP20Connection('www.google.com')
c._sock = DummySocket()