Class: PcapTools::HttpExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/pcap_tools/stream_processors/http.rb

Instance Method Summary collapse

Instance Method Details

#finalizeObject



21
22
# File 'lib/pcap_tools/stream_processors/http.rb', line 21

def finalize
end

#process_stream(stream) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pcap_tools/stream_processors/http.rb', line 5

def process_stream stream
  calls = []
  k = 0
  while k < stream[:data].size
    begin
      req = parse_request(stream[:data][k])
      resp = k + 1 < stream[:data].size ? parse_response(stream[:data][k + 1]) : nil
      calls << [stream[:index], req, resp]
    rescue Exception => e
      warn "Unable to parse http call in stream #{stream[:index]} : #{e}"
    end
    k += 2
  end
  calls
end