File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -710,12 +710,12 @@ def serialize_body(self):
710710 def parse_body (self , data ):
711711 try :
712712 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 ()
714714
715715 if len (self .origin ) != origin_len :
716716 raise InvalidFrameError ("Invalid ALTSVC frame body." )
717717
718- self .field = data [2 + origin_len :]
718+ self .field = data [2 + origin_len :]. tobytes ()
719719 except (struct .error , ValueError ):
720720 raise InvalidFrameError ("Invalid ALTSVC frame body." )
721721
Original file line number Diff line number Diff line change @@ -690,6 +690,13 @@ def test_altsvc_frame_without_origin_parses_properly(self):
690690 assert f .body_len == 19
691691 assert f .stream_id == 1
692692
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+
693700 def test_altsvc_frame_with_origin_and_stream_serializes_properly (self ):
694701 # This frame is not valid, but we allow it to be serialized anyway.
695702 f = AltSvcFrame (stream_id = 1 )
You can’t perform that action at this time.
0 commit comments