Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 31cbc84

Browse files
committed
Merge pull request #185 from irvind/slight-http2conn-changes
Minor HTTP20Connection changes
2 parents 46f4b1b + dcf46d1 commit 31cbc84

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

hyper/http20/connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def _new_stream(self, stream_id=None, local_closed=False):
511511
s = Stream(
512512
stream_id or self.next_stream_id, self._send_cb, self._recv_cb,
513513
self._close_stream, self.encoder, self.decoder,
514-
self.__wm_class(65535), local_closed
514+
self.__wm_class(window_size), local_closed
515515
)
516516
s._out_flow_control_window = self._out_flow_control_window
517517
self.streams[s.stream_id] = s
@@ -723,6 +723,8 @@ def _recv_cb(self):
723723
except ConnectionResetError:
724724
break
725725

726+
count -= 1
727+
726728
def _send_rst_frame(self, stream_id, error_code):
727729
"""
728730
Send reset stream frame with error code and remove stream from map.

test/test_hyper.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,24 @@ def test_that_using_proxy_keeps_http_headers_intact(self):
509509
(':path', '/'),
510510
]
511511

512+
def test_recv_cb_n_times(self):
513+
sock = DummySocket()
514+
sock.can_read = True
515+
516+
c = HTTP20Connection('www.google.com')
517+
c._sock = sock
518+
519+
mutable = {'counter': 0}
520+
521+
def consume_single_frame():
522+
mutable['counter'] += 1
523+
524+
c._consume_single_frame = consume_single_frame
525+
c._recv_cb()
526+
527+
assert mutable['counter'] == 10
528+
529+
512530
class TestServerPush(object):
513531
def setup_method(self, method):
514532
self.frames = []

0 commit comments

Comments
 (0)