PcapFileEx.Flows.HTTP1.Flow (pcap_file_ex v0.5.5)
View SourceAn HTTP/1.x flow containing request/response exchanges.
Groups HTTP/1.x exchanges that share the same client-server connection.
Fields
flow- The baseFlowidentity (protocol, endpoints, display fields)exchanges- List ofHTTP1.Exchangestructsstats- Aggregate statistics for this flow
Examples
# Query flows from a specific client
result.http1
|> Enum.filter(fn f -> f.flow.from == "web-client" end)
|> Enum.flat_map(& &1.exchanges)
# Get all GET requests
result.http1
|> Enum.flat_map(& &1.exchanges)
|> Enum.filter(fn ex -> ex.request.method == "GET" end)
Summary
Functions
Adds an exchange to the flow and updates stats.
Finalizes the flow by setting the stats from all exchanges.
Creates a new HTTP/1 flow.
Types
@type t() :: %PcapFileEx.Flows.HTTP1.Flow{ exchanges: [PcapFileEx.Flows.HTTP1.Exchange.t()], flow: PcapFileEx.Flow.t(), stats: PcapFileEx.Flows.Stats.t() }
Functions
@spec add_exchange(t(), PcapFileEx.Flows.HTTP1.Exchange.t()) :: t()
Adds an exchange to the flow and updates stats.
Parameters
http1_flow- The HTTP/1 flowexchange- The exchange to add
Examples
http1_flow = HTTP1.Flow.add_exchange(http1_flow, exchange)
Finalizes the flow by setting the stats from all exchanges.
Called after all exchanges have been added to compute final stats.
@spec new(PcapFileEx.Flow.t()) :: t()
Creates a new HTTP/1 flow.
Parameters
flow- The base Flow identity
Examples
alias PcapFileEx.{Flow, Endpoint}
alias PcapFileEx.Flows.HTTP1
client = Endpoint.new("10.0.0.1", 54321)
server = Endpoint.new("10.0.0.2", 80)
flow = Flow.new(:http1, client, server)
http1_flow = HTTP1.Flow.new(flow)