# Copyright (C) 2008-2009, Sebastian Riedel. =head1 NAME Mojo::Manual::HTTPGuide - HTTP Guide =head1 OVERVIEW L contains a full featured HTTP 1.1 client/server implementation. There are similarities to L, but L is much more server oriented. In fact the HTTP client was built specifically for testing web applications. One of the main design goals was portability, so it features pure Perl implementations of FastCGI, CGI and a single process test server. =head1 CLIENT The L was specifically built for stress testing web applications and uses asynchronous io operations to do this in a very portable way, without the need to use multiple processes. =head2 A Simple Request Here is a simple example to get you an idea of how it will look in action. use Mojo::Client; use Mojo::Transaction; # Build a new client my $client = Mojo::Client->new; # Build a new transaction my $tx = Mojo::Transaction->new_post('http://kraih.com'); # Configure the request $tx->req->body->content('foo bar baz' x 1024); # Process the transaction in a blocking operation $client->process_all($tx); # Play with the response print $tx->res->headers->content_type; =head2 Parallel Requests Parallel requests are equally simple. use Mojo::Client; use Mojo::Transaction; # Build a new client my $client = Mojo::Client->new; # Build new transactions my $tx1 = Mojo::Transaction->new_post('http://kraih.com'); my $tx2 = Mojo::Transaction->new_get'http://labs.kraih.com'); # Configure the requests $tx1->req->headers->expect('100-continue'); $tx1->req->body->content('foo bar baz' x 1024); $tx2->req->body->content('foo bar baz'); # Process the transactions in a blocking operation $client->process_all($tx1, $tx2); # Play with the responses print $tx1->res->headers->content_type; print $tx2->res->headers->content_type; =cut