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 and state machine 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.

continue_handler_cb

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

Callback to handle 100 Continue requests.

continue_timeout

    my $timeout = $tx->continue_timeout;
    $tx         = $tx->continue_timeout(3);

Timeout for 100 Continue requests.

continued

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

Transaction was continued.

handler_cb

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

Handler callback.

keep_alive

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

Connection can be kept alive.

req

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

HTTP 1.1 request.

res

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

HTTP 1.1 response.

upgrade_cb

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

WebSocket upgrade callback.

METHODS

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

client_leftovers

    my $leftovers = $tx->client_leftovers;

Leftovers from the client response, used for pipelining.

client_read

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

Read and process client data.

client_write

    my $chunk = $tx->client_write;

Write client data.

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://mojolicious.org.