MCPcopy Create free account
hub / github.com/secdev/scapy / _parse

Method _parse

scapy/contrib/http2.py:1212–1223  ·  view source on GitHub ↗

:param bool t: whether this string is a huffman compressed string. :param str s: the string to parse. :return: HPackStringsInterface: either a HPackLiteralString or HPackZString, depending on t. # noqa: E501 :raises: InvalidEncodingException

(t, s)

Source from the content-addressed store, hash-verified

1210
1211 @staticmethod
1212 def _parse(t, s):
1213 # type: (bool, str) -> HPackStringsInterface
1214 """
1215 :param bool t: whether this string is a huffman compressed string.
1216 :param str s: the string to parse.
1217 :return: HPackStringsInterface: either a HPackLiteralString or HPackZString, depending on t. # noqa: E501
1218 :raises: InvalidEncodingException
1219 """
1220 if t:
1221 i, ibl = HPackZString.huffman_conv2bitstring(s)
1222 return HPackZString(HPackZString.huffman_decode(i, ibl))
1223 return HPackLiteralString(s)
1224
1225 def getfield(self, pkt, s):
1226 # type: (packet.Packet, str) -> Tuple[str, HPackStringsInterface]

Callers 2

getfieldMethod · 0.95
m2iMethod · 0.95

Calls 4

HPackZStringClass · 0.85
HPackLiteralStringClass · 0.85
huffman_decodeMethod · 0.80

Tested by

no test coverage detected