File tree 3 files changed +32
-0
lines changed
3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 77
77
.. autoclass :: h2.events.AlternativeServiceAvailable
78
78
:members:
79
79
80
+ .. autoclass :: h2.events.UnknownFrameReceived
81
+ :members:
82
+
80
83
81
84
Exceptions
82
85
----------
Original file line number Diff line number Diff line change @@ -574,6 +574,28 @@ def __repr__(self):
574
574
)
575
575
576
576
577
+ class UnknownFrameReceived (Event ):
578
+ """
579
+ The UnknownFrameReceived event is fired when the remote peer sends a frame
580
+ that hyper-h2 does not understand. This occurs primarily when the remote
581
+ peer is employing HTTP/2 extensions that hyper-h2 doesn't know anything
582
+ about.
583
+
584
+ RFC 7540 requires that HTTP/2 implementations ignore these frames. hyper-h2
585
+ does so. However, this event is fired to allow implementations to perform
586
+ special processing on those frames if needed (e.g. if the implementation
587
+ is capable of handling the frame itself).
588
+
589
+ .. versionadded:: 2.7.0
590
+ """
591
+ def __init__ (self ):
592
+ #: The hyperframe Frame object that encapsulates the received frame.
593
+ self .frame = None
594
+
595
+ def __repr__ (self ):
596
+ return "<UnknownFrameReceived>"
597
+
598
+
577
599
def _bytes_representation (data ):
578
600
"""
579
601
Converts a bytestring into something that is safe to print on all Python
Original file line number Diff line number Diff line change @@ -323,6 +323,13 @@ def test_alternativeserviceavailable_repr(self):
323
323
'field_value:h2=":8000"; ma=60>'
324
324
)
325
325
326
+ def test_unknownframereceived_repr (self ):
327
+ """
328
+ UnknownFrameReceived has a useful debug representation.
329
+ """
330
+ e = h2 .events .UnknownFrameReceived ()
331
+ assert repr (e ) == '<UnknownFrameReceived>'
332
+
326
333
327
334
def all_events ():
328
335
"""
You can’t perform that action at this time.
0 commit comments