The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojo::Transaction::HTTP - HTTP 1.1 Transaction Container

SYNOPSIS

  use Mojo::Transaction::HTTP;

  my $tx = Mojo::Transaction::HTTP->new;

  my $req = $tx->req;
  my $res = $tx->res;

  my $keep_alive = $tx->keep_alive;

DESCRIPTION

Mojo::Transaction::HTTP is a container for HTTP 1.1 transactions as described in RFC 2616.

ATTRIBUTES

Mojo::Transaction::HTTP inherits all attributes from Mojo::Transaction and implements the following new ones.

on_upgrade

  my $cb = $tx->on_upgrade;
  $tx    = $tx->on_upgrade(sub {...});

Callback to be invoked for WebSocket upgrades.

on_request

  my $cb = $tx->on_request;
  $tx    = $tx->on_request(sub {...});

Callback to be invoked for requests.

req

  my $req = $tx->req;
  $tx     = $tx->req(Mojo::Message::Request->new);

HTTP 1.1 request, by default a Mojo::Message::Request object.

res

  my $res = $tx->res;
  $tx     = $tx->res(Mojo::Message::Response->new);

HTTP 1.1 response, by default a Mojo::Message::Response object.

METHODS

Mojo::Transaction::HTTP inherits all methods from Mojo::Transaction and implements the following new ones.

client_read

  $tx = $tx->client_read($chunk);

Read and process client data.

client_write

  my $chunk = $tx->client_write;

Write client data.

keep_alive

  my $keep_alive = $tx->keep_alive;
  $tx            = $tx->keep_alive(1);

Connection can be kept alive.

server_leftovers

  my $leftovers = $tx->server_leftovers;

Leftovers from the server request, used for pipelining.

server_read

  $tx = $tx->server_read($chunk);

Read and process server data.

server_write

  my $chunk = $tx->server_write;

Write server data.

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicio.us.