Cassandane::TestSuite::HTTP
NAME
Cassandane::TestSuite::HTTP - HTTP/1.x tests
OVERVIEW
This suite tests the HTTP/1.x server at the wire level, in either of two
styles. http1_connect and its companions hand back a Net::HTTP socket:
the test writes its own request bytes but gets the response parsed for it,
which suits tests whose interest is in the reply. `http1_request`_instead assembles the request from named pieces and returns the response as
raw bytes, which suits tests of malformed framing a real client would never
produce, or of a connection the server answers on more than once.
METHODS
http1_request
my $res = $self->http1_request(
method => 'PUT',
path => '/dav/calendars/user/cassandane/Default/x.ics',
headers => [ 'transfer-encoding' => 'chunked',
'content-type' => 'text/calendar' ],
raw_body => "100000000\r\n\r\n...",
);
# $res->{raw} -- the full response, verbatim
# $res->{statuses} -- arrayref of the numeric statuses of each response
# seen on the connection (more than one indicates the
# server treated trailing bytes as a second request)
Sends a single HTTP/1.1 request on a new connection to the instance's httpservice and returns the raw response. The response is read until the server
closes the connection or an idle timeout elapses, so a keep-alive connection on
which the server answered more than once (e.g. after request smuggling) is
captured in full.
Options:
method/path
request method (default
GET) and target (default'/').
headers
arrayref of additional request header name/value pairs.
body
a request body;
Content-Lengthis added automatically.
raw_body
Body bytes sent verbatim, with no
Content-Lengthadded and no framing applied. Use this to craft chunked bodies (well-formed or not). Mutually exclusive withbody.
username/password
HTTP Basic credentials. Default to the
cassandanetest user; passusername => undeffor no auth.
timeout
Seconds to wait for response bytes (default 30)