PcapFileEx.Flows.HTTP2.Flow (pcap_file_ex v0.5.5)
View SourceAn HTTP/2 flow containing streams (request/response exchanges).
Groups HTTP/2 streams that share the same client-server connection. Uses "streams" terminology to match the HTTP/2 specification.
Fields
flow- The baseFlowidentity (protocol, endpoints, display fields)streams- List ofHTTP2.Streamstructs (complete streams with flow_seq)incomplete- List ofIncompleteExchangestructs (not in timeline)stats- Aggregate statistics for this flow
Complete vs Incomplete
streamscontains exchanges that have both request and responseincompletecontains exchanges that were cut off (RST_STREAM, GOAWAY, truncated)- Only complete streams are included in the unified timeline
Examples
# Query flows from a specific client
result.http2
|> Enum.filter(fn f -> f.flow.from == "web-client" end)
|> Enum.flat_map(& &1.streams)
# Get all POST requests
result.http2
|> Enum.flat_map(& &1.streams)
|> Enum.filter(fn s -> s.exchange.request.method == "POST" end)
# Check for incomplete streams
result.http2
|> Enum.flat_map(& &1.incomplete)
|> Enum.each(fn incomplete ->
IO.puts("Incomplete stream #{incomplete.stream_id}: #{incomplete.reason}")
end)
Summary
Functions
Adds an incomplete exchange to the flow.
Adds a stream to the flow.
Finalizes the flow by computing stats from all streams.
Creates a new HTTP/2 flow.
Types
@type t() :: %PcapFileEx.Flows.HTTP2.Flow{ flow: PcapFileEx.Flow.t(), incomplete: [PcapFileEx.HTTP2.IncompleteExchange.t()], stats: PcapFileEx.Flows.Stats.t(), streams: [PcapFileEx.Flows.HTTP2.Stream.t()] }
Functions
@spec add_incomplete(t(), PcapFileEx.HTTP2.IncompleteExchange.t()) :: t()
Adds an incomplete exchange to the flow.
Parameters
http2_flow- The HTTP/2 flowincomplete- The incomplete exchange to add
@spec add_stream(t(), PcapFileEx.Flows.HTTP2.Stream.t()) :: t()
Adds a stream to the flow.
Parameters
http2_flow- The HTTP/2 flowstream- The stream to add
Finalizes the flow by computing stats from all streams.
Called after all streams have been added.
@spec new(PcapFileEx.Flow.t()) :: t()
Creates a new HTTP/2 flow.
Parameters
flow- The base Flow identity
Examples
alias PcapFileEx.{Flow, Endpoint}
alias PcapFileEx.Flows.HTTP2
client = Endpoint.new("10.0.0.1", 54321)
server = Endpoint.new("10.0.0.2", 8080)
flow = Flow.new(:http2, client, server)
http2_flow = HTTP2.Flow.new(flow)