File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -710,12 +710,12 @@ def serialize_body(self):
710
710
def parse_body (self , data ):
711
711
try :
712
712
origin_len = struct .unpack ("!H" , data [0 :2 ])[0 ]
713
- self .origin = data [2 :2 + origin_len ]
713
+ self .origin = data [2 :2 + origin_len ]. tobytes ()
714
714
715
715
if len (self .origin ) != origin_len :
716
716
raise InvalidFrameError ("Invalid ALTSVC frame body." )
717
717
718
- self .field = data [2 + origin_len :]
718
+ self .field = data [2 + origin_len :]. tobytes ()
719
719
except (struct .error , ValueError ):
720
720
raise InvalidFrameError ("Invalid ALTSVC frame body." )
721
721
Original file line number Diff line number Diff line change @@ -690,6 +690,13 @@ def test_altsvc_frame_without_origin_parses_properly(self):
690
690
assert f .body_len == 19
691
691
assert f .stream_id == 1
692
692
693
+ def test_altsvc_frame_without_origin_parses_with_good_repr (self ):
694
+ f = decode_frame (self .payload_without_origin )
695
+
696
+ assert repr (f ) == (
697
+ "AltSvcFrame(Stream: 1; Flags: None): 000068323d223a383030..."
698
+ )
699
+
693
700
def test_altsvc_frame_with_origin_and_stream_serializes_properly (self ):
694
701
# This frame is not valid, but we allow it to be serialized anyway.
695
702
f = AltSvcFrame (stream_id = 1 )
You can’t perform that action at this time.
0 commit comments