Cassandane::Cyrus::HttpH2

NAME

Cassandane::Cyrus::HttpH2 - HTTP/2 tests

OVERVIEW

This suite provides the method `http2_request`_ for testing HTTP/2.

Tests speak cleartext HTTP/2 using the "prior knowledge" connection preface (RFC 7540 section 3.4): no TLS, and no Upgrade: h2c handshake. Cyrus accepts this on any plain http service, so a test can open an ordinary socket and start sending HTTP/2 frames.

METHODS

http2_request

my $res = $self->http2_request(
    method  => 'PUT',
    path    => '/dav/calendars/user/cassandane/Default/x.ics',
    headers => [ 'content-type' => 'text/calendar' ],
    body    => $ical,
);
# $res->{status}, $res->{headers} (hashref), $res->{body}

Performs a single HTTP/2 request over cleartext on a new connection to the instance's http service, and returns the response as a hashref with status (the :status pseudo-header, an integer), headers (a hashref of the remaining response headers), and body (the response body).

Options:

  • method

the request method (default GET).

  • path

the request target (default '/').

  • headers

an arrayref of additional request header name/value pairs.

  • body

the request body, sent as HTTP/2 DATA frames. No content-length is sent; the body is delimited by end-of-stream, as HTTP/2 allows.

  • username / password

HTTP Basic credentials to send. Default to the cassandane test user; pass username => undef for no auth.

  • timeout

seconds to wait for the response (default 30)