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

Commit b877cfc

Browse files
committed
Merge branch 'development' into override-default-headers
2 parents e412120 + 31cbc84 commit b877cfc

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

hyper/http20/connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def _new_stream(self, stream_id=None, local_closed=False):
513513
s = Stream(
514514
stream_id or self.next_stream_id, self._send_cb, self._recv_cb,
515515
self._close_stream, self.encoder, self.decoder,
516-
self.__wm_class(65535), local_closed
516+
self.__wm_class(window_size), local_closed
517517
)
518518
s._out_flow_control_window = self._out_flow_control_window
519519
self.streams[s.stream_id] = s
@@ -725,6 +725,8 @@ def _recv_cb(self):
725725
except ConnectionResetError:
726726
break
727727

728+
count -= 1
729+
728730
def _send_rst_frame(self, stream_id, error_code):
729731
"""
730732
Send reset stream frame with error code and remove stream from map.

test/test_hyper.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,23 @@ def test_that_using_proxy_keeps_http_headers_intact(self):
554554
(b':path', b'/'),
555555
]
556556

557+
def test_recv_cb_n_times(self):
558+
sock = DummySocket()
559+
sock.can_read = True
560+
561+
c = HTTP20Connection('www.google.com')
562+
c._sock = sock
563+
564+
mutable = {'counter': 0}
565+
566+
def consume_single_frame():
567+
mutable['counter'] += 1
568+
569+
c._consume_single_frame = consume_single_frame
570+
c._recv_cb()
571+
572+
assert mutable['counter'] == 10
573+
557574

558575
class TestServerPush(object):
559576
def setup_method(self, method):

0 commit comments

Comments
 (0)