MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_https_record_alpn

Method test_https_record_alpn

test/mitmproxy/test_dns.py:97–113  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

95 assert rr.https_ech is None
96
97 def test_https_record_alpn(self):
98 rr = dns.ResourceRecord(
99 "test", dns.types.ANY, dns.classes.IN, dns.ResourceRecord.DEFAULT_TTL, b""
100 )
101 record = dns.https_records.HTTPSRecord(1, "example.org", {})
102 rr.data = dns.https_records.pack(record)
103
104 assert rr.https_alpn is None
105 assert rr.data == b"\x00\x01\x07example\x03org\x00"
106
107 rr.https_alpn = [b"h2", b"h3"]
108 assert rr.https_alpn == (b"h2", b"h3")
109 assert rr.data == b"\x00\x01\x07example\x03org\x00\x00\x01\x00\x06\x02h2\x02h3"
110
111 rr.https_alpn = None
112 assert rr.https_alpn is None
113 assert rr.data == b"\x00\x01\x07example\x03org\x00"
114
115
116class TestMessage:

Callers

nothing calls this directly

Calls 1

packMethod · 0.80

Tested by

no test coverage detected