NAME

Net::IMP::HTTP::Example::SaveResponse - save response data to file system

SYNOPSIS

# use App::HTTP_Proxy_IMP to listen on 127.0.0.1:8000 and save all data 
# in myroot/
$ perl bin/imp_http_proxy --filter Example::SaveResponse=root=myroot 127.0.0.1:8000

DESCRIPTION

This module is used to save response data into the file system.

The module has the following arguments for new_analyzer:

root

The base directory for saving the data. This argument is required.

content_type

Limits saving of the response body the given content_types, either hash, string or regular expression. If not given everything can be saved.

method

Limits saving to the given methods, either hash, string or regular expression. If not given everything can be saved.

limit

No data will be saved, if the request or response body size is greater then the given limit. If not given a default of 10_000_000 will be assumed. For unlimited saving this can be set to 0.

ignore_parameters

If set the contents of the query string or the post data will not be used in creating the file name.

exclude_url

This regular expression describes, which URLs will not be saved. E.g. setting it to /\?/ causes no URLs with a query string to be saved. If not given everything can be saved.

only_url

If given, this regular expression limits saving to matching URLs. If not given everything can be saved.

The module has a single argument root for new_analyzer. root specifies the base directory, where the data get saved. The data are saved into a file root/host:port/method-md5path-md5data, where

  • method is the HTTP method, lower cased

  • md5path is the md5 hash of the path, e.g. excluding query string

  • md5data is the md5 hash over query string joined with post data

The contents of the saved file consists of the HTTP request header and body, followed by the response header and body. Chunking and content-encoding is removed from the body.. To speedup extraction of each of these 4 parts from the file an index of 16 byte is added at the end of the file consisisting of 4 32bit unsigned integers in network byte order, describing the size of each part.

AUTHOR

Steffen Ullrich <sullr@cpan.org>