Пример #1
0
    def test_altsvc_frame_with_origin_and_stream_serializes_properly(self):
        # This frame is not valid, but we allow it to be serialized anyway.
        f = AltSvcFrame(stream_id=1)
        f.origin = b'example.com'
        f.field = b'Alt-Svc: h2=":443"; ma=2592000; persist=1'

        assert f.serialize() == self.payload_with_origin_and_stream
Пример #2
0
    def test_altsvc_frame_with_origin_and_stream_serializes_properly(self):
        # This frame is not valid, but we allow it to be serialized anyway.
        f = AltSvcFrame(stream_id=1)
        f.origin = b'example.com'
        f.field = b'Alt-Svc: h2=":443"; ma=2592000; persist=1'

        assert f.serialize() == self.payload_with_origin_and_stream
Пример #3
0
    def test_altsvc_frame_with_origin_serializes_properly(self):
        f = AltSvcFrame(stream_id=0)
        f.origin = b'example.com'
        f.field = b'h2="alt.example.com:8000", h2=":443"'

        s = f.serialize()
        assert s == self.payload_with_origin
Пример #4
0
    def test_altsvc_frame_with_origin_serializes_properly(self):
        f = AltSvcFrame(stream_id=0)
        f.origin = b'example.com'
        f.field = b'h2="alt.example.com:8000", h2=":443"'

        s = f.serialize()
        assert s == self.payload_with_origin
Пример #5
0
 def build_alt_svc_frame(self, stream_id, origin, field):
     """
     Builds a single ALTSVC frame.
     """
     f = AltSvcFrame(stream_id)
     f.origin = origin
     f.field = field
     return f
Пример #6
0
 def build_alt_svc_frame(self, stream_id, origin, field):
     """
     Builds a single ALTSVC frame.
     """
     f = AltSvcFrame(stream_id)
     f.origin = origin
     f.field = field
     return f
Пример #7
0
 def advertise_alternative_service(self, field_value):
     """
     Advertise an RFC 7838 alternative service. The semantics of this are
     better documented in the ``H2Connection`` class.
     """
     self.state_machine.process_input(StreamInputs.SEND_ALTERNATIVE_SERVICE)
     asf = AltSvcFrame(self.stream_id)
     asf.field = field_value
     return [asf]
Пример #8
0
 def advertise_alternative_service(self, field_value):
     """
     Advertise an RFC 7838 alternative service. The semantics of this are
     better documented in the ``H2Connection`` class.
     """
     self.state_machine.process_input(StreamInputs.SEND_ALTERNATIVE_SERVICE)
     asf = AltSvcFrame(self.stream_id)
     asf.field = field_value
     return [asf]
Пример #9
0
 def test_repr(self):
     f = AltSvcFrame(0)
     assert repr(f).endswith("origin=b'', field=b''")
     f.field = b'h2="alt.example.com:8000", h2=":443"'
     assert repr(f).endswith(
         "origin=b'', field=b'h2=\"alt.example.com:8000\", h2=\":443\"'")
     f.origin = b'example.com'
     assert repr(f).endswith(
         "origin=b'example.com', field=b'h2=\"alt.example.com:8000\", h2=\":443\"'"
     )