Why

Connection caching/keep-alive, thread safety (?), highly interfaceable. Loosely modeled on the golang http library with the goal of having a strong separation of components to allow easy interchangability.

Coming soon

Cookies, multipart posting

How do I...?

Use a proxy

Simply add a proxy method to your client or transport object. For instance, to simply return a url from a string you could do:

A high level round-robin implementation that attempts connection caching and is thread safe. For a user-agent level implementation that handles cookies, redirects, auth, etc then use a Net::HTTP::Client. Can provide an alternative Response object as an argument.

Net::HTTP::Client

# NYI

Highest level of http client implementation.

Interface Default Implementations

Most Net::HTTP components can be swapped out for generic alternatives. Net::HTTP provides a set of interfaces (see: Net::HTTP::Interfaces) and the other included classes in Net::HTTP can be viewed as default implementations.

Net::HTTP::URL

my $url = Net::HTTP::URL.new("http://google.com/");

Create a url object to provide an api to the url parts, such as scheme, host, and port.

> say ~$url
http://google.com/
> say $url.host;
google.com

Net::HTTP::Request

Create a Request object which provides an api to generating an over-the-wire or human readable representation of an http request. .raw gives a binary representation, and .Str gives a utf8 encoded version.