use strict;
use warnings;
# ABSTRACT: A small, simple, correct HTTP/1.1 client
-our $VERSION = '0.041'; # VERSION
+our $VERSION = '0.042'; # VERSION
use Carp ();
# reference. If data is provided as a hash reference, the key/value pairs in the
# resulting string will be sorted by key and value for consistent ordering.
#
-# To preserve the order (r
-#
-#
# =cut
sub www_form_urlencode {
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
+# PERL_HTTP_TINY_IPV4_ONLY is a private environment variable to force old
+# behavior if someone is unable to boostrap CPAN from a new perl install; it is
+# not intended for general, per-client use and may be removed in the future
+my $SOCKET_CLASS =
+ $ENV{PERL_HTTP_TINY_IPV4_ONLY} ? 'IO::Socket::INET' :
+ eval { require IO::Socket::IP; IO::Socket::IP->VERSION(0.25) } ? 'IO::Socket::IP' :
+ 'IO::Socket::INET';
+
sub BUFSIZE () { 32768 } ## no critic
my $Printable = sub {
elsif ( $scheme ne 'http' ) {
die(qq/Unsupported URL scheme '$scheme'\n/);
}
- $self->{fh} = 'IO::Socket::INET'->new(
+ $self->{fh} = $SOCKET_CLASS->new(
PeerHost => $host,
PeerPort => $port,
$self->{local_address} ?
=head1 VERSION
-version 0.041
+version 0.042
=head1 SYNOPSIS
=head1 DESCRIPTION
-This is a very simple HTTP/1.1 client, designed for doing simple GET
+This is a very simple HTTP/1.1 client, designed for doing simple
requests without the overhead of a large framework like L<LWP::UserAgent>.
It is more correct and more complete than L<HTTP::Lite>. It supports
proxies and redirection. It also correctly resumes after EINTR.
+If L<IO::Socket::IP> 0.25 or later is installed, HTTP::Tiny will use it instead
+of L<IO::Socket::INET> for transparent support for both IPv4 and IPv6.
+
+Cookie support requires L<HTTP::CookieJar> or an equivalent class.
+
=head1 METHODS
=head2 new
reference. If data is provided as a hash reference, the key/value pairs in the
resulting string will be sorted by key and value for consistent ordering.
-To preserve the order (r
-
=for Pod::Coverage SSL_options
agent
cookie_jar
=item *
-Cookie support requires L<HTTP::CookieJar> or an equivalent class.
-
-=item *
-
There is no provision for delaying a request body using an C<Expect> header.
Unexpected C<1XX> responses are silently ignored as per the specification.
There is no support for a Request-URI of '*' for the 'OPTIONS' request.
-=item *
-
-There is no support for IPv6 of any kind.
-
=back
-Despite the limitations listed above, HTTP::Tiny is considered nearly
-feature-complete. If there are enhancements unrelated to the underlying
-transport, please consider them for L<HTTP::Tiny::UA> instead.
+Despite the limitations listed above, HTTP::Tiny is considered
+feature-complete. New feature requests should be directed to
+L<HTTP::Tiny::UA>.
=head1 SEE ALSO
=item *
-L<HTTP::Tiny::UA> — Higher level UA features for HTTP::Tiny
+L<HTTP::Tiny::UA> - Higher level UA features for HTTP::Tiny
=item *
=item *
+L<IO::Socket::IP> - Required for IPv6 support
+
+=item *
+
L<IO::Socket::SSL> - Required for SSL support
=item *