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

Commit 927f82e

Browse files
committed
Throw StreamResetError on stream reset
1 parent 56b5b4d commit 927f82e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

hyper/http20/stream.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
from ..common.headers import HTTPHeaderMap
1717
from ..packages.hyperframe.frame import (
1818
FRAME_MAX_LEN, FRAMES, HeadersFrame, DataFrame, PushPromiseFrame,
19-
WindowUpdateFrame, ContinuationFrame, BlockedFrame
19+
WindowUpdateFrame, ContinuationFrame, BlockedFrame, RstStreamFrame
2020
)
21-
from .exceptions import ProtocolError
21+
from .exceptions import ProtocolError, StreamResetError
2222
from .util import h2_safe_headers
2323
import collections
2424
import logging
@@ -233,6 +233,9 @@ def receive_frame(self, frame):
233233
w = WindowUpdateFrame(self.stream_id)
234234
w.window_increment = increment
235235
self._data_cb(w, True)
236+
elif frame.type == RstStreamFrame.type:
237+
self.close(0)
238+
raise StreamResetError("Stream forcefully closed.")
236239
elif frame.type in FRAMES:
237240
# This frame isn't valid at this point.
238241
raise ValueError("Unexpected frame %s." % frame)

0 commit comments

Comments
 (0)