HTTP/2 - Hypertext Transfer Protocol¶
pcapkit.protocols.application.httpv2.protocol contains
HTTPv2
only, which implements an extractor for Hypertext Transfer
Protocol (HTTP/2) [*], whose structure is:
Octets |
Bits |
Name |
Description |
|---|---|---|---|
0 |
0 |
|
Payload Length |
3 |
24 |
|
Type |
4 |
32 |
|
Flags |
5 |
40 |
Reserved |
|
5 |
41 |
|
Stream Identifier |
9 |
72 |
|
Frame Payload |
Frames in One Segment¶
A whole frame after the first in a TCP segment is dissected as a further
HTTPv2 layer, the previous
frame’s payload (#2536), as
TLS chains records: a SETTINGS
frame followed by a WINDOW_UPDATE reads TCP:HTTP/2:HTTP/2. The
exceptions:
A whole frame that fails to decode becomes
Rawtogether with everything after it, with the parser’serror.A frame the segment ends inside, its header or its payload cut short, stays raw, with no error.
A parse told to stop at HTTP/2 (
protocol='HTTP/2'orlayer='Application') keeps the rest of the segment raw.Each frame is a layer, so
FRAME_LAYER_LIMITbounds how many are dissected.
Changed in version 1.5.0: A frame’s Length counts its payload alone, not the 9-octet frame header,
as RFC 9113 Section 4.1 defines it, and the payload is read to that
Length rather than to the end of the buffer (#1121,
#1243). A frame rebuilds byte for byte: END_STREAM, undefined
flag bits, the reserved bits, a zero Pad Length, duplicate SETTINGS
entries and the payload of an unpadded DATA, HEADERS or PUSH_PROMISE frame
are kept (#652, #668, #1244, #1245,
#1246, #1247).
Removed in version 1.6.0: pcapkit.protocols.application.httpv2.HTTP, with no alias. The
class is renamed HTTPv2,
after its module (#2529).
- class pcapkit.protocols.application.httpv2.protocol.HTTPv2(file=None, length=None, **kwargs)[source]¶
-
This class implements Hypertext Transfer Protocol (HTTP/2).
The HTTP/2 frames it parses, by
pcapkit.const.http.frame.Frametype:Frame Code
Frame Parser
Frame Constructor
Changed in version 1.6.0:
A payload opening with the connection preface parses, with the preface kept as
prefaceand counted inlength, andmake()takespreface, since a dispatched HTTP/2 payload reaches this class rather thanHTTP(#2524).A whole frame after the first in a segment is a further layer of this class, where it was kept as
Raw(#2536).A
SETTINGSframe the capture cut inside its settings parses, with the setting the cut lands inside read as zeros past it, as a cutDATAframe’s data is, and no setting past the data, where it wasRaw(#2659, #2686, #2756).Each enumeration field of
make()and of the frame makers takes a member or anintcode, resolved with the enumeration’sget; a name, aboolfor a field wider than one bit, or a code the field cannot carry raisesProtocolError, rather than resolving against an enumeration inferred from the caller’s frame or writing a different value (#2594).
Removed in version 1.6.0: The
type_default,type_namespaceandtype_reversedarguments ofmake(), and theerror_default,error_namespaceanderror_reversedarguments of theRST_STREAMandGOAWAYframe makers; resolve a name withresolve_index()first (#2594).- __frame__: DefaultDict[Frame | int, str | tuple[Callable[[FrameType, HTTPv2], HTTPv2], Callable[[HTTPv2 | None, Any], Tuple[FrameType, Flags]]]]¶
Frame code to method mapping. A
strvalue names the_read_http_${name}and_make_http_${name}methods, which fall back to_read_http_noneand_make_http_nonewhen not defined, as an unregistered code does; any other value is a(parser, constructor)pair of callables.
- property length: int¶
Header length of current protocol – the 9-octet frame header, after the 24-octet connection preface when one opens the payload.
- unpack(length=None, **kwargs)[source]¶
Unpack (parse) packet data.
- Parameters:
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the packet is malformed.
Notes
This guards ahead of
Schema.unpackrather than leaving the check toread(), because a buffer shorter than the fixed 9-octet header cannot be parsed meaningfully.pkt['__length__']there is decremented by each field’s nominal width regardless of how many octets the buffer had, so it goes negative and the frame payload’s length-derived fields (e.g. an unpaddedDATAframe’sdata: BytesField(length=lambda pkt: pkt['__length__'])) resolve to a negative width. Rejecting here keeps such a frame from reaching that arithmetic. An inner field can still drive it negative on a buffer that clears nine (e.g. aGOAWAYframe at 9-16 octets, whose fixedstreamanderrorfields alone consume eight); the schema layer raisesProtocolErrorfor that itself.lengthis resolved againstlen()only for this method’s own check, and the original argument –Noneincluded – is what is forwarded toProtocol.unpack. CollapsingNoneto a concrete0would change whatSchema.unpack’s ownpreparedecorator does with an exhausted stream: it raisesStreamEOFError(anEOFError, the documented “no more packets” signal) only when the caller leftlengthunspecified, and a resolved0would report an exhausted stream as a malformed packet. A non-zero short buffer is malformed either way, so it is rejected here whether or notlengthwas given.A payload opening with the HTTP/2 connection preface (RFC 9113 Section 3.4) has the frame parsed from the octets after it, as
HTTP._guess_versionparses it, since a dispatched payload reaches this class rather than that one (#2524); the preface counts towardslength. A preface with no frame after it is refused, since the data model holds one frame per packet and has no form for a frameless segment.
- read(length=None, **kwargs)[source]¶
Read Hypertext Transfer Protocol (HTTP/2).
Structure of HTTP/2 packet [RFC 7540]:
+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +=+=============================================================+ | Frame Payload (0...) ... +---------------------------------------------------------------+
- Parameters:
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the packet is malformed.
- make(type=Frame.DATA, flags=0, reserved=0, sid=0, frame=None, payload=b'', preface=False, **kwargs)[source]¶
Make (construct) packet data.
- Parameters:
flags (
Flags) – Flags of HTTP/2 frame, combined with those the frame constructor derives fromframe.reserved (
int) – Reserved bit of the frame header.sid (
int) – Stream ID of HTTP/2 frame.frame (
bytes|HTTPv2|FrameType|dict[str,Any] |None) – Frame data of HTTP/2 frame. Omitted (None), the frame type’s own default payload is built, as for{}; abytesvalue,b''included, is packed as raw octets.payload (
bytes|ProtocolBase|Schema) – Octets after the frame, e.g. the next frame.preface (
bool) – Whether the HTTP/2 connection preface goes ahead of the frame;pack()writes it.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed packet data.
- Raises:
ProtocolError – If
typeis a name, abool, or a member or code the 8-bit Type field cannot carry; or ifframeis none of the forms this maker reads – rawbytes, adictof frame arguments, anHTTPv2data model or aSchema.
Changed in version 1.5.0:
reservedis a new parameter beforesid, so a 1.4.x positional argument meant forsidorframelands one parameter early (#1246).framedefaults toNoneand dispatches to the frame type’s constructor, since the formerb''default is shorter than the payload a frame type of fixed or minimum size needs, so such a frame could not be built at all (#2274).
- classmethod id()[source]¶
Index ID of the protocol.
RFC 9113 names the protocol
HTTP/2.Changed in version 1.6.0:
('HTTP/2',), narrowed to this class, where it was('HTTP', 'HTTPv2')(#2524).
- classmethod register_frame(code, meth)[source]¶
Register a frame parser.
- Parameters:
- Warns:
RegistryWarning– If a different entry is already registered forcode; it is overwritten. Handing back the entry already stored, or one equal to it, is a silent no-op. The entrycodeshipped with is accepted like any other, so an override can be undone (#1362, #1363).
- _read_http_none(schema, *, header)[source]¶
Read HTTP packet with unassigned type.
- Parameters:
schema (
UnassignedFrame) – Parsed frame schema.header (
HTTPv2) – Parsed HTTP/2 header schema.
- Return type:
- Returns:
Parsed packet data.
- _read_http_data(schema, *, header)[source]¶
Read HTTP/2
DATAframes.Structure of HTTP/2
DATAframe [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------+-----------------------------------------------+ |Pad Length? (8)| +---------------+-----------------------------------------------+ | Data (*) ... +---------------------------------------------------------------+ | Padding (*) ... +---------------------------------------------------------------+
- _read_http_headers(schema, *, header)[source]¶
Read HTTP/2
HEADERSframes.Structure of HTTP/2
HEADERSframe [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------+-----------------------------------------------+ |Pad Length? (8)| +-+-------------+-----------------------------------------------+ |E| Stream Dependency? (31) | +-+-------------+-----------------------------------------------+ | Weight? (8) | +-+-------------+-----------------------------------------------+ | Header Block Fragment (*) ... +---------------------------------------------------------------+ | Padding (*) ... +---------------------------------------------------------------+
- Parameters:
schema (
HeadersFrame) – Parsed frame schema.header (
HTTPv2) – Parsed HTTP/2 header schema.
- Return type:
- Returns:
Parsed packet data.
- _read_http_priority(schema, *, header)[source]¶
Read HTTP/2
PRIORITYframes.Structure of HTTP/2
PRIORITYframe [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +-+-------------------------------------------------------------+ |E| Stream Dependency (31) | +-+-------------+-----------------------------------------------+ | Weight (8) | +-+-------------+
- Parameters:
schema (
PriorityFrame) – Parsed frame schema.header (
HTTPv2) – Parsed HTTP/2 header schema.
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the packet is malformed.
- _read_http_rst_stream(schema, *, header)[source]¶
Read HTTP/2
RST_STREAMframes.Structure of HTTP/2
RST_STREAMframe [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------------------------------------------------------+ | Error Code (32) | +---------------------------------------------------------------+
- Parameters:
schema (
RSTStreamFrame) – Parsed frame schema.header (
HTTPv2) – Parsed HTTP/2 header schema.
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the packet is malformed.
- _read_http_settings(schema, *, header)[source]¶
Read HTTP/2
SETTINGSframes.Structure of HTTP/2
SETTINGSframe [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------------------------------------------------------+ | Identifier (16) | +-------------------------------+-------------------------------+ | Value (32) | +---------------------------------------------------------------+ | ...... |
- Parameters:
schema (
SettingsFrame) – Parsed frame schema.header (
HTTPv2) – Parsed HTTP/2 header schema.
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the packet is malformed.
- _read_http_push_promise(schema, *, header)[source]¶
Read HTTP/2
PUSH_PROMISEframes.Structure of HTTP/2
PUSH_PROMISEframe [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------+-----------------------------------------------+ |Pad Length? (8)| +-+-------------+-----------------------------------------------+ |R| Promised Stream ID (31) | +-+-----------------------------+-------------------------------+ | Header Block Fragment (*) ... +---------------------------------------------------------------+ | Padding (*) ... +---------------------------------------------------------------+
- Parameters:
schema (
PushPromiseFrame) – Parsed frame schema.header (
HTTPv2) – Parsed HTTP/2 header schema.
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the packet is malformed.
- _read_http_ping(schema, *, header)[source]¶
Read HTTP/2
PINGframes.Structure of HTTP/2
PINGframe [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------------------------------------------------------+ | | | Opaque Data (64) | | | +---------------------------------------------------------------+
- Parameters:
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the packet is malformed.
- _read_http_goaway(schema, *, header)[source]¶
Read HTTP/2
GOAWAYframes.Structure of HTTP/2
GOAWAYframe [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +-+-------------+---------------+-------------------------------+ |R| Last-Stream-ID (31) | +-+-------------------------------------------------------------+ | Error Code (32) | +---------------------------------------------------------------+ | Additional Debug Data (*) | +---------------------------------------------------------------+
- Parameters:
schema (
GoawayFrame) – Parsed frame schema.header (
HTTPv2) – Parsed HTTP/2 header schema.
- Return type:
- Returns:
Parsed packet data.
- _read_http_window_update(schema, *, header)[source]¶
Read HTTP/2
WINDOW_UPDATEframes.Structure of HTTP/2
WINDOW_UPDATEframe [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +-+-------------+---------------+-------------------------------+ |R| Window Size Increment (31) | +-+-------------------------------------------------------------+
- Parameters:
schema (
WindowUpdateFrame) – Parsed frame schema.header (
HTTPv2) – Parsed HTTP/2 header schema.
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the packet is malformed.
- _read_http_continuation(schema, *, header)[source]¶
Read HTTP/2
CONTINUATIONframes.Structure of HTTP/2
CONTINUATIONframe [RFC 7540]:+-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | +-+-------------+---------------+-------------------------------+ |R| Stream Identifier (31) | +---------------------------------------------------------------+ | Header Block Fragment (*) ... +---------------------------------------------------------------+
- Parameters:
schema (
ContinuationFrame) – Parsed frame schema.header (
HTTPv2) – Parsed HTTP/2 header schema.
- Return type:
- Returns:
Parsed packet data.
- _make_http_none(frame=None, *, data=b'', **kwargs)[source]¶
Make HTTP/2 unassigned frame type.
- Parameters:
frame (
UnassignedFrame|None) – Frame data model.data (
bytes) – Unspecified frame data.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed frame schema and updated flags.
- _make_http_data(frame=None, *, end_stream=False, padded=False, pad_len=0, data=b'', padding=b'', **kwargs)[source]¶
Make HTTP/2
DATAframe.- Parameters:
- Return type:
- Returns:
Constructed frame schema and updated flags.
- _make_http_headers(frame=None, *, end_stream=False, end_headers=False, padded=False, pad_len=0, excl_dep=False, sid_dep=None, weight=0, fragment=b'', padding=b'', **kwargs)[source]¶
Make HTTP/2
HEADERSframe.- Parameters:
frame (
HeadersFrame|None) – Frame data model.end_stream (
bool) – End of stream flag.end_headers (
bool) – End of headers flag.padded (
bool) – Padded flag, implied by a non-zeropad_len.pad_len (
int) – Padding length.excl_dep (
bool) – Exclusive dependency flag.sid_dep (
int|None) – Dependency stream identifier. Giving one sets thePRIORITYflag.weight (
int) – Priority weight value.fragment (
bytes) – Header block fragment.padding (
bytes) – Padding octets, truncated or zero-filled topad_lenoctets.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed frame schema and updated flags.
- _make_http_priority(frame=None, *, sid_dep=0, excl_dep=False, weight=0, **kwargs)[source]¶
Make HTTP/2
PRIORITYframe.- Parameters:
- Return type:
- Returns:
Constructed frame schema and updated flags.
- _make_http_rst_stream(frame=None, *, error=ErrorCode.NO_ERROR, **kwargs)[source]¶
Make HTTP/2
RST_STREAMframe.- Parameters:
frame (
RSTStreamFrame|None) – Frame data model.error (
ErrorCode|int) – Error code,NO_ERRORunless given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed frame schema and updated flags.
- Raises:
ProtocolError – If
erroris a name, abool, or a member or code the 32-bit Error Code field cannot carry.
Changed in version 1.5.0:
errordefaults toNO_ERROR, the code RFC 9113 Section 7 gives a condition that is not the result of an error, rather thanHTTP_1_1_REQUIRED, which asks the peer to use HTTP/1.1 instead (#2311).
- _make_http_settings(frame=None, *, ack=False, settings=None, **kwargs)[source]¶
Make HTTP/2
SETTINGSframe.- Parameters:
frame (
SettingsFrame|None) – Frame data model.ack (
bool) – Acknowledge flag.settings (
OrderedMultiDict[Setting|int,int] |dict[Setting|int,int] |bytes|list[SettingPair|tuple[Setting|int,int]] |None) – Settings, as raw octets, anOrderedMultiDict, a plaindictof identifier to value or a list of(identifier, value)pairs.None, the default, carries no parameters at all.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed frame schema and updated flags.
- Raises:
ProtocolError – If
settingsis notbytes, adict, alistorNone, or if an identifier other than aSettingPair’s is a name, abool, or a member or code the 16-bit Identifier field cannot carry.
Changed in version 1.5.0:
settingsofNone, the default, builds aSETTINGSframe with no parameters, which RFC 9113 Section 6.5 permits, rather than being rejected (#2274).Changed in version 1.6.0: A
framethe capture cut inside its settings, as its__short_read__records, packs the settings its parse read from the octets itspacketholds with zeros after them to the Length it declares, since that parse reads no setting past the data, so its rebuild declares that Length too; with its settings edited, the Length is computed as for a whole frame (#2756).
- _make_http_push_promise(frame=None, *, end_headers=False, padded=False, pad_len=0, promised_reserved=0, promised_sid=0, fragment=b'', padding=b'', **kwargs)[source]¶
Make HTTP/2
PUSH_PROMISEframe.- Parameters:
frame (
PushPromiseFrame|None) – Frame data model.end_headers (
bool) – End of headers flag.padded (
bool) – Padded flag, implied by a non-zeropad_len.pad_len (
int) – Padding length.promised_reserved (
int) – Reserved bit of the promised stream identifier.promised_sid (
int) – Promised stream identifier.fragment (
bytes) – Header block fragment.padding (
bytes) – Padding octets, truncated or zero-filled topad_lenoctets.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed frame schema and updated flags.
- _make_http_ping(frame=None, *, ack=False, opaque_data=bytes(8), **kwargs)[source]¶
Make HTTP/2
PINGframe.- Parameters:
- Return type:
- Returns:
Constructed frame schema and updated flags.
- Raises:
ProtocolError – If
opaque_datais not 8 octets long.
- _make_http_goaway(frame=None, *, last_reserved=0, last_sid=0, error=ErrorCode.NO_ERROR, debug_data=b'', **kwargs)[source]¶
Make HTTP/2
GOAWAYframe.- Parameters:
frame (
GoawayFrame|None) – Frame data model.last_reserved (
int) – Reserved bit of the last stream identifier.last_sid (
int) – Last stream identifier.error (
ErrorCode|int) – Error code,NO_ERRORunless given.debug_data (
bytes) – Additional debug data.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed frame schema and updated flags.
- Raises:
ProtocolError – If
erroris a name, abool, or a member or code the 32-bit Error Code field cannot carry.
Changed in version 1.5.0:
errordefaults toNO_ERROR, the code RFC 9113 Section 7 gives a condition that is not the result of an error, rather thanHTTP_1_1_REQUIRED, which asks the peer to use HTTP/1.1 instead (#2311).
- _make_http_window_update(frame=None, *, incr_reserved=0, incr=0, **kwargs)[source]¶
Make HTTP/2
WINDOW_UPDATEframe.- Parameters:
frame (
WindowUpdateFrame|None) – Frame data model.incr_reserved (
int) – Reserved bit of the window size increment.incr (
int) – Window size increment.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed frame schema and updated flags.
- _make_http_continuation(frame=None, *, end_headers=False, fragment=b'', **kwargs)[source]¶
Make HTTP/2
CONTINUATIONframe.- Parameters:
frame (
ContinuationFrame|None) – Frame data model.end_headers (
bool) – End of headers flag.fragment (
bytes) – Header block fragment.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed frame schema and updated flags.
Header Schemas¶
Removed in version 1.6.0: pcapkit.protocols.schema.application.httpv2, with no alias: the module moved here
(#2534).
Removed in version 1.6.0: pcapkit.protocols.schema.application.httpv2.HTTP, with no alias. The
class is renamed HTTPv2,
after its module (#2529).
- class pcapkit.protocols.application.httpv2.schema.HTTPv2(length=NO_VALUE, type=NO_VALUE, flags=NO_VALUE, stream=NO_VALUE, frame=NO_VALUE, payload=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for HTTP/2 packet.
- flags: FrameFlags = <BitField flags>¶
Frame specific flags.
- class pcapkit.protocols.application.httpv2.schema.FrameType(*args, **kwargs)[source]¶
Bases:
EnumSchema[Frame]Header schema for HTTP/2 frame payload.
- class Flags(*values)[source]¶
Bases:
EnumLookup,IntFlagFlags enumeration for HTTP/2 frames.
Built on
EnumLookup, the lookup contract shared by every non-registry enumeration. The concrete per-frame subclasses below each declareclass Flags(FrameType.Flags):with no base list of their own, so they inheritEnumLookuptransitively rather than needing it repeated.
- class pcapkit.protocols.application.httpv2.schema.UnassignedFrame(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for unassigned HTTP/2 frame payload.
- class pcapkit.protocols.application.httpv2.schema.DataFrame(pad_len=NO_VALUE, data=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for HTTP/2
DATAframes.
- class pcapkit.protocols.application.httpv2.schema.HeadersFrame(pad_len=NO_VALUE, stream_dep=NO_VALUE, weight=NO_VALUE, fragment=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for HTTP/2
HEADERSframes.- stream_dep: StreamDependency = <ConditionalField stream_dep>¶
Stream dependency.
- class pcapkit.protocols.application.httpv2.schema.PriorityFrame(stream=NO_VALUE, weight=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for HTTP/2
PRIORITYframes.- stream: StreamDependency = <BitField stream>¶
Stream dependency (exclusive, stream ID).
- class pcapkit.protocols.application.httpv2.schema.RSTStreamFrame(error=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for HTTP/2
RST_STREAMframes.
- class pcapkit.protocols.application.httpv2.schema.SettingPair(id=NO_VALUE, value=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for HTTP/2
SETTINGSframe setting pairs.
- class pcapkit.protocols.application.httpv2.schema.SettingsFrame(settings=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for HTTP/2
SETTINGSframes.- settings: list[SettingPair] = <ListField settings>¶
Settings.
- class pcapkit.protocols.application.httpv2.schema.PushPromiseFrame(pad_len=NO_VALUE, stream=NO_VALUE, fragment=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for HTTP/2
PUSH_PROMISEframes.
- class pcapkit.protocols.application.httpv2.schema.PingFrame(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for HTTP/2
PINGframes.
- class pcapkit.protocols.application.httpv2.schema.GoawayFrame(stream=NO_VALUE, error=NO_VALUE, debug=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for HTTP/2
GOAWAYframes.
- class pcapkit.protocols.application.httpv2.schema.WindowUpdateFrame(size=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for HTTP/2
WINDOW_UPDATEframes.- size: WindowSize = <BitField size>¶
Window size increment.
- class pcapkit.protocols.application.httpv2.schema.ContinuationFrame(fragment=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
FrameTypeHeader schema for HTTP/2
CONTINUATIONframes.
Type Stubs¶
- class pcapkit.protocols.application.httpv2.schema.FrameFlags[source]¶
Bases:
TypedDictHTTP frame specific flags.
- class pcapkit.protocols.application.httpv2.schema.StreamID[source]¶
Bases:
TypedDictStream identifier.
Auxiliary Functions¶
- pcapkit.protocols.application.httpv2.schema.http_frame_selector(pkt)[source]¶
Selector function for
HTTPv2.framefield.
Data Models¶
Removed in version 1.6.0: pcapkit.protocols.data.application.httpv2, with no alias: the module moved here
(#2534).
Removed in version 1.6.0: pcapkit.protocols.data.application.httpv2.HTTP, with no alias. The
class is renamed HTTPv2,
after its module (#2529).
- class pcapkit.protocols.application.httpv2.data.HTTPv2(*args, **kwargs)[source]¶
Bases:
ProtocolData model for HTTP/2 protocol.
- class pcapkit.protocols.application.httpv2.data.Flags(*args, **kwargs)[source]¶
Bases:
DataData model for HTTP/2 flags.
- class pcapkit.protocols.application.httpv2.data.UnassignedFrame(length, type, reserved, sid, flags, data)[source]¶
Bases:
HTTPv2Data model for HTTP/2 unassigned frame.
- class pcapkit.protocols.application.httpv2.data.DataFrame(length, type, reserved, sid, flags, pad_len, data, padding)[source]¶
Bases:
HTTPv2Data model for HTTP/2
DATAframe.- flags: DataFrameFlags¶
Flags.
- class pcapkit.protocols.application.httpv2.data.DataFrameFlags(END_STREAM, PADDED)[source]¶
Bases:
FlagsData model for HTTP/2
DATAframe flags.
- class pcapkit.protocols.application.httpv2.data.HeadersFrame(length, type, reserved, sid, flags, pad_len, excl_dependency, stream_dependency, weight, fragment, padding)[source]¶
Bases:
HTTPv2Data model for HTTP/2
HEADERSframe.- flags: HeadersFrameFlags¶
Flags.
- class pcapkit.protocols.application.httpv2.data.HeadersFrameFlags(END_STREAM, END_HEADERS, PADDED, PRIORITY)[source]¶
Bases:
FlagsData model for HTTP/2
HEADERSframe flags.
- class pcapkit.protocols.application.httpv2.data.PriorityFrame(length, type, reserved, sid, flags, excl_dependency, stream_dependency, weight)[source]¶
Bases:
HTTPv2Data model for HTTP/2
PRIORITYframe.
- class pcapkit.protocols.application.httpv2.data.RSTStreamFrame(length, type, reserved, sid, flags, error)[source]¶
Bases:
HTTPv2Data model for HTTP/2
RST_STREAMframe.
- class pcapkit.protocols.application.httpv2.data.SettingsFrame(length, type, reserved, sid, flags, settings)[source]¶
Bases:
HTTPv2Data model for HTTP/2
SETTINGSframe.- flags: SettingsFrameFlags¶
Flags.
- class pcapkit.protocols.application.httpv2.data.Settings(mapping=None)[source]¶
Bases:
OrderedMultiInfo[Setting,int]Settings of an HTTP/2
SETTINGSframe.An identifier may repeat, and the values apply in order, so the last one wins (RFC 9113 Section 6.5). Every entry is kept in wire order, as
getlist()anditems(multi=True)show and the rebuild writes, but indexing,get(),values(),items()andto_dict(flat=True)answer with the last value of each identifier rather than the first.It is immutable, as an
OrderedMultiInfois, so it is built from the(identifier, value)pairs in one go, andto_dict()exports every pair as a plainOrderedMultiDict.
- class pcapkit.protocols.application.httpv2.data.SettingsFrameFlags(ACK)[source]¶
Bases:
FlagsData model for HTTP/2
SETTINGSframe flags.
- class pcapkit.protocols.application.httpv2.data.PushPromiseFrame(length, type, reserved, sid, flags, pad_len, promised_reserved, promised_sid, fragment, padding)[source]¶
Bases:
HTTPv2Data model for HTTP/2
PUSH_PROMISEframe.- flags: PushPromiseFrameFlags¶
Flags.
- class pcapkit.protocols.application.httpv2.data.PushPromiseFrameFlags(END_HEADERS, PADDED)[source]¶
Bases:
FlagsData model for HTTP/2
PUSH_PROMISEframe flags.
- class pcapkit.protocols.application.httpv2.data.PingFrame(length, type, reserved, sid, flags, data)[source]¶
Bases:
HTTPv2Data model for HTTP/2
PINGframe.- flags: PingFrameFlags¶
Flags.
- class pcapkit.protocols.application.httpv2.data.PingFrameFlags(ACK)[source]¶
Bases:
FlagsData model for HTTP/2
PINGframe flags.
- class pcapkit.protocols.application.httpv2.data.GoawayFrame(length, type, reserved, sid, flags, last_reserved, last_sid, error, debug_data)[source]¶
Bases:
HTTPv2Data model for HTTP/2
GOAWAYframe.
- class pcapkit.protocols.application.httpv2.data.WindowUpdateFrame(length, type, reserved, sid, flags, increment_reserved, increment)[source]¶
Bases:
HTTPv2Data model for HTTP/2
WINDOW_UPDATEframe.
- class pcapkit.protocols.application.httpv2.data.ContinuationFrame(length, type, reserved, sid, flags, fragment)[source]¶
Bases:
HTTPv2Data model for HTTP/2
CONTINUATIONframe.- flags: ContinuationFrameFlags¶
Flags.
- class pcapkit.protocols.application.httpv2.data.ContinuationFrameFlags(END_HEADERS)[source]¶
Bases:
FlagsData model for HTTP/2
CONTINUATIONframe flags.
Footnotes