summaryrefslogtreecommitdiff
path: root/cpan/HTTP-Tiny
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2013-05-24 21:46:26 +0100
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2013-05-24 21:46:26 +0100
commit107bec06d7f6354a0c05a5301ea02c2cc9d30840 (patch)
tree31b1459098d995f130a3da833be4e51c2b216cdf /cpan/HTTP-Tiny
parentee76e75720066eb0cd82eb280936c6b52bdddc7f (diff)
downloadperl-107bec06d7f6354a0c05a5301ea02c2cc9d30840.tar.gz
Update HTTP-Tiny to CPAN version 0.029
[DELTA] 0.029 2013-04-17 13:49:07 America/New_York [FIXED] - Checks for new enough OpenSSL library before using SNI (otherwise IO::Socket::SSL throws warnings) 0.028 2013-03-05 14:11:57 America/New_York [SUPPORT] - Fix repository/issue links to reflect proper repo name 0.027 2013-03-05 12:02:58 America/New_York [SUPPORT] - Changed metadata to point to the chansen github repository for code and issues [DOCUMENTATION] - Added hyperlink for HTTP::CookieJar 0.026 2013-03-04 22:53:39 America/New_York [ADDED] - Added cookie support if an HTTP::CookieJar object is provided in the 'cookie_jar' attribute [Edward Zborowski]
Diffstat (limited to 'cpan/HTTP-Tiny')
-rw-r--r--cpan/HTTP-Tiny/lib/HTTP/Tiny.pm139
-rw-r--r--cpan/HTTP-Tiny/t/00-compile.t1
-rw-r--r--cpan/HTTP-Tiny/t/001_api.t2
-rw-r--r--cpan/HTTP-Tiny/t/070_cookie_jar.t42
-rw-r--r--cpan/HTTP-Tiny/t/160_cookies.t79
-rw-r--r--cpan/HTTP-Tiny/t/BrokenCookieJar.pm24
-rw-r--r--cpan/HTTP-Tiny/t/SimpleCookieJar.pm29
-rw-r--r--cpan/HTTP-Tiny/t/cases/cookies-01.txt34
-rw-r--r--cpan/HTTP-Tiny/t/cases/cookies-02.txt52
-rw-r--r--cpan/HTTP-Tiny/t/cases/cookies-03.txt87
-rw-r--r--cpan/HTTP-Tiny/t/cases/cookies-04.txt37
-rw-r--r--cpan/HTTP-Tiny/t/cases/cookies-05.txt35
-rw-r--r--cpan/HTTP-Tiny/t/cases/cookies-06.txt51
-rw-r--r--cpan/HTTP-Tiny/t/cases/cookies-07.txt34
14 files changed, 627 insertions, 19 deletions
diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
index 333aab56f7..dfcf07be07 100644
--- a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
+++ b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
@@ -3,14 +3,14 @@ package HTTP::Tiny;
use strict;
use warnings;
# ABSTRACT: A small, simple, correct HTTP/1.1 client
-our $VERSION = '0.025'; # VERSION
+our $VERSION = '0.029'; # VERSION
use Carp ();
my @attributes;
BEGIN {
- @attributes = qw(agent default_headers local_address max_redirect max_size proxy timeout SSL_options verify_SSL);
+ @attributes = qw(agent cookie_jar default_headers local_address max_redirect max_size proxy timeout SSL_options verify_SSL);
no strict 'refs';
for my $accessor ( @attributes ) {
*{$accessor} = sub {
@@ -35,6 +35,8 @@ sub new {
$args{agent} .= $default_agent
if defined $args{agent} && $args{agent} =~ / $/;
+ $class->_validate_cookie_jar( $args{cookie_jar} ) if $args{cookie_jar};
+
for my $key ( @attributes ) {
$self->{$key} = $args{$key} if exists $args{$key}
}
@@ -157,7 +159,7 @@ sub www_form_urlencode {
(@_ == 2 && ref $data)
or Carp::croak(q/Usage: $http->www_form_urlencode(DATAREF)/ . "\n");
(ref $data eq 'HASH' || ref $data eq 'ARRAY')
- or Carp::croak("form data must be a hash or array reference");
+ or Carp::croak("form data must be a hash or array reference\n");
my @params = ref $data eq 'HASH' ? %$data : @$data;
@params % 2 == 0
@@ -216,13 +218,15 @@ sub _request {
$handle->connect($scheme, $host, $port);
}
- $self->_prepare_headers_and_cb($request, $args);
+ $self->_prepare_headers_and_cb($request, $args, $url);
$handle->write_request($request);
my $response;
do { $response = $handle->read_response_header }
until (substr($response->{status},0,1) ne '1');
+ $self->_update_cookie_jar( $url, $response ) if $self->{cookie_jar};
+
if ( my @redir_args = $self->_maybe_redirect($request, $response, $args) ) {
$handle->close;
return $self->_request(@redir_args, $args);
@@ -243,7 +247,7 @@ sub _request {
}
sub _prepare_headers_and_cb {
- my ($self, $request, $args) = @_;
+ my ($self, $request, $args, $url) = @_;
for ($self->{default_headers}, $args->{headers}) {
next unless defined;
@@ -277,6 +281,13 @@ sub _prepare_headers_and_cb {
$request->{trailer_cb} = $args->{trailer_callback}
if ref $args->{trailer_callback} eq 'CODE';
}
+
+ ### If we have a cookie jar, then maybe add relevant cookies
+ if ( $self->{cookie_jar} ) {
+ my $cookies = $self->cookie_jar->cookie_header( $url );
+ $request->{headers}{cookie} = $cookies if length $cookies;
+ }
+
return;
}
@@ -300,6 +311,31 @@ sub _prepare_data_cb {
return $data_cb;
}
+sub _update_cookie_jar {
+ my ($self, $url, $response) = @_;
+
+ my $cookies = $response->{headers}->{'set-cookie'};
+ return unless defined $cookies;
+
+ my @cookies = ref $cookies ? @$cookies : $cookies;
+
+ $self->cookie_jar->add( $url, $_ ) for @cookies;
+
+ return;
+}
+
+sub _validate_cookie_jar {
+ my ($class, $jar) = @_;
+
+ # duck typing
+ for my $method ( qw/add cookie_header/ ) {
+ Carp::croak(qq/Cookie jar must provide the '$method' method\n/)
+ unless ref($jar) && ref($jar)->can($method);
+ }
+
+ return;
+}
+
sub _maybe_redirect {
my ($self, $request, $response, $args) = @_;
my $headers = $response->{headers};
@@ -428,8 +464,10 @@ sub connect {
my ($self, $scheme, $host, $port) = @_;
if ( $scheme eq 'https' ) {
- die(qq/IO::Socket::SSL 1.56 must be installed for https support\n/)
- unless eval {require IO::Socket::SSL; IO::Socket::SSL->VERSION(1.56)};
+ # Need IO::Socket::SSL 1.42 for SSL_create_ctx_callback
+ die(qq/IO::Socket::SSL 1.42 must be installed for https support\n/)
+ unless eval {require IO::Socket::SSL; IO::Socket::SSL->VERSION(1.42)};
+ # Need Net::SSLeay 1.49 for MODE_AUTO_RETRY
die(qq/Net::SSLeay 1.49 must be installed for https support\n/)
unless eval {require Net::SSLeay; Net::SSLeay->VERSION(1.49)};
}
@@ -894,9 +932,13 @@ sub _find_CA_file {
sub _ssl_args {
my ($self, $host) = @_;
- my %ssl_args = (
- SSL_hostname => $host, # SNI
- );
+ my %ssl_args;
+
+ # This test reimplements IO::Socket::SSL::can_client_sni(), which wasn't
+ # added until IO::Socket::SSL 1.84
+ if ( Net::SSLeay::OPENSSL_VERSION_NUMBER() >= 0x01000000 ) {
+ $ssl_args{SSL_hostname} = $host, # Sane SNI support
+ }
if ($self->{verify_SSL}) {
$ssl_args{SSL_verifycn_scheme} = 'http'; # enable CN validation
@@ -923,13 +965,15 @@ __END__
=pod
+=encoding utf-8
+
=head1 NAME
HTTP::Tiny - A small, simple, correct HTTP/1.1 client
=head1 VERSION
-version 0.025
+version 0.029
=head1 SYNOPSIS
@@ -976,6 +1020,12 @@ A user-agent string (defaults to 'HTTP-Tiny/$VERSION'). If C<agent> ends in a sp
=item *
+C<cookie_jar>
+
+An instance of L<HTTP::CookieJar> or equivalent class that supports the C<add> and C<cookie_header> methods
+
+=item *
+
C<default_headers>
A hashref of default headers to apply to requests
@@ -1202,6 +1252,7 @@ reference. The key/value pairs in the resulting string will be sorted by key
and value.
=for Pod::Coverage agent
+cookie_jar
default_headers
local_address
max_redirect
@@ -1332,9 +1383,7 @@ always be set to C<close>.
=item *
-Cookies are not directly supported. Users that set a C<Cookie> header
-should also set C<max_redirect> to zero to ensure cookies are not
-inappropriately re-transmitted.
+Cookie support requires L<HTTP::CookieJar> or an equivalent class.
=item *
@@ -1390,7 +1439,7 @@ L<Net::SSLeay>
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
-at L<https://rt.cpan.org/Public/Dist/Display.html?Name=HTTP-Tiny>.
+at L<https://github.com/chansen/p5-http-tiny/issues>.
You will be notified automatically of any progress on your issue.
=head2 Source Code
@@ -1398,9 +1447,9 @@ You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for
public review and contribution under the terms of the license.
-L<https://github.com/dagolden/http-tiny>
+L<https://github.com/chansen/p5-http-tiny>
- git clone git://github.com/dagolden/http-tiny.git
+ git clone git://github.com/chansen/p5-http-tiny.git
=head1 AUTHORS
@@ -1414,15 +1463,69 @@ Christian Hansen <chansen@cpan.org>
David Golden <dagolden@cpan.org>
+=back
+
+=head1 CONTRIBUTORS
+
+=over 4
+
+=item *
+
+Alan Gardner <gardner@pythian.com>
+
+=item *
+
+Alessandro Ghedini <al3xbio@gmail.com>
+
+=item *
+
+Chris Nehren <apeiron@cpan.org>
+
+=item *
+
+Chris Weyl <cweyl@alumni.drew.edu>
+
+=item *
+
+Claes Jakobsson <claes@surfar.nu>
+
+=item *
+
+Craig Berry <cberry@cpan.org>
+
+=item *
+
+David Mitchell <davem@iabyn.com>
+
+=item *
+
+Edward Zborowski <ed@rubensteintech.com>
+
+=item *
+
+Jess Robinson <castaway@desert-island.me.uk>
+
+=item *
+
+Lukas Eklund <leklund@gmail.com>
+
=item *
Mike Doherty <doherty@cpan.org>
+=item *
+
+Serguei Trouchelle <stro@cpan.org>
+
+=item *
+
+Tony Cook <tony@develop-help.com>
+
=back
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2012 by Christian Hansen.
+This software is copyright (c) 2013 by Christian Hansen.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
diff --git a/cpan/HTTP-Tiny/t/00-compile.t b/cpan/HTTP-Tiny/t/00-compile.t
index 698768633c..6454c8201e 100644
--- a/cpan/HTTP-Tiny/t/00-compile.t
+++ b/cpan/HTTP-Tiny/t/00-compile.t
@@ -70,4 +70,5 @@ $plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");
script_compiles( $file, "$script script compiles" );
}
}
+
}
diff --git a/cpan/HTTP-Tiny/t/001_api.t b/cpan/HTTP-Tiny/t/001_api.t
index 4311c67a55..0083c2e2b4 100644
--- a/cpan/HTTP-Tiny/t/001_api.t
+++ b/cpan/HTTP-Tiny/t/001_api.t
@@ -7,7 +7,7 @@ use Test::More tests => 2;
use HTTP::Tiny;
my @accessors = qw(
- agent default_headers local_address max_redirect max_size proxy timeout SSL_options verify_SSL
+ agent default_headers local_address max_redirect max_size proxy timeout SSL_options verify_SSL cookie_jar
);
my @methods = qw(
new get head put post delete post_form request mirror www_form_urlencode
diff --git a/cpan/HTTP-Tiny/t/070_cookie_jar.t b/cpan/HTTP-Tiny/t/070_cookie_jar.t
new file mode 100644
index 0000000000..bd09a54fb5
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/070_cookie_jar.t
@@ -0,0 +1,42 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+use t::SimpleCookieJar;
+use t::BrokenCookieJar;
+use HTTP::Tiny;
+
+### a couple tests to ensure that:
+### * by default there is no cookie jar defined
+### * the correct cookie jar is returned when specified
+### * error when cookie jar does not support the add and cookie_header methods
+
+
+my $default = undef;
+my $jar = t::SimpleCookieJar->new();
+my $mug = t::BrokenCookieJar->new();
+my $dog = t::BrokenCookieJar2->new();
+
+{
+ my $ua = HTTP::Tiny->new();
+ is $ua->cookie_jar, $default, 'default cookie jar is as expected';
+}
+
+{
+ my $ua = HTTP::Tiny->new(cookie_jar => $jar);
+ is $ua->cookie_jar, $jar, 'cookie_jar is as expected';
+}
+
+{
+ my $ua = eval { HTTP::Tiny->new(cookie_jar => $mug) };
+ my $err = $@;
+ like( $err, qr/must provide .* 'add' method/
+ => 'invalid jar does not support add method' );
+
+ $ua = eval { HTTP::Tiny->new(cookie_jar => $dog) };
+ $err = $@;
+ like( $err, qr/must provide .* 'cookie_header' method/
+ => 'invalid jar does not support cookie_header method' );
+}
diff --git a/cpan/HTTP-Tiny/t/160_cookies.t b/cpan/HTTP-Tiny/t/160_cookies.t
new file mode 100644
index 0000000000..899a197a90
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/160_cookies.t
@@ -0,0 +1,79 @@
+#!perl
+
+use strict;
+use warnings;
+
+use File::Basename;
+use Test::More 0.96;
+use t::SimpleCookieJar;
+use t::Util qw[tmpfile rewind slurp monkey_patch dir_list parse_case
+ hashify connect_args clear_socket_source set_socket_source sort_headers
+ $CRLF $LF];
+
+use HTTP::Tiny;
+BEGIN { monkey_patch() }
+
+SKIP: for my $class ( qw/t::SimpleCookieJar HTTP::CookieJar/ ) {
+
+ subtest $class => sub {
+ eval "require $class; 1"
+ or plan skip_all => "Needs $class";
+
+ for my $file ( dir_list("t/cases", qr/^cookies/ ) ) {
+ my $label = basename($file);
+ my $data = do { local (@ARGV,$/) = $file; <> };
+ my @cases = split /--+\n/, $data;
+
+ my $jar = t::SimpleCookieJar->new();
+ my $http = undef;
+ while (@cases) {
+ my ($params, $expect_req, $give_res) = splice( @cases, 0, 3 );
+
+ my $case = parse_case($params);
+
+ my $url = $case->{url}[0];
+ my $method = $case->{method}[0] || 'GET';
+ my %headers = hashify( $case->{headers} );
+ my %new_args = hashify( $case->{new_args} );
+
+ if( exists $headers{Cookie} ) {
+ my $cookies = delete $headers{Cookie};
+ $jar->add( $url, $cookies );
+ }
+
+ if( exists $headers{'No-Cookie-Jar'} ) {
+ delete $headers{'No-Cookie-Jar'};
+ $jar = undef;
+ }
+
+ my %options;
+ $options{headers} = \%headers if %headers;
+
+ my $version = HTTP::Tiny->VERSION || 0;
+ my $agent = $new_args{agent} || "HTTP-Tiny/$version";
+
+ $new_args{cookie_jar} = $jar;
+
+ # cleanup source data
+ $expect_req =~ s{HTTP-Tiny/VERSION}{$agent};
+ s{\n}{$CRLF}g for ($expect_req, $give_res);
+
+ # setup mocking and test
+ my $res_fh = tmpfile($give_res);
+ my $req_fh = tmpfile();
+
+ $http = HTTP::Tiny->new(%new_args) if !defined $http;
+ clear_socket_source();
+ set_socket_source($req_fh, $res_fh);
+
+ my @call_args = %options ? ($url, \%options) : ($url);
+ my $response = $http->get(@call_args);
+
+ my $got_req = slurp($req_fh);
+ is( sort_headers($got_req), sort_headers($expect_req), "$label request data");
+ }
+ }
+ };
+}
+
+done_testing;
diff --git a/cpan/HTTP-Tiny/t/BrokenCookieJar.pm b/cpan/HTTP-Tiny/t/BrokenCookieJar.pm
new file mode 100644
index 0000000000..f638e20336
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/BrokenCookieJar.pm
@@ -0,0 +1,24 @@
+package t::BrokenCookieJar;
+
+use strict;
+use warnings;
+
+sub new {
+ my $class = shift;
+ return bless {} => $class;
+}
+
+package t::BrokenCookieJar2;
+
+use strict;
+use warnings;
+
+sub new {
+ my $class = shift;
+ return bless {} => $class;
+}
+
+sub add {
+}
+
+1;
diff --git a/cpan/HTTP-Tiny/t/SimpleCookieJar.pm b/cpan/HTTP-Tiny/t/SimpleCookieJar.pm
new file mode 100644
index 0000000000..4c8fe08312
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/SimpleCookieJar.pm
@@ -0,0 +1,29 @@
+package t::SimpleCookieJar;
+
+use strict;
+use warnings;
+
+sub new {
+ my $class = shift;
+ return bless {} => $class;
+}
+
+sub add {
+ my ($self, $url, $cookie) = @_;
+
+ my ($kv) = split qr/;/, $cookie;
+ my ($k, $v) = split qr/\s*=\s*/, $kv, 2;
+
+ $self->{$url}{$k} = $v;
+}
+
+sub cookie_header {
+ my ($self, $url) = @_;
+
+ my $cookies = $self->{$url}
+ or return '';
+
+ return join( "; ", map{ "$_=$cookies->{$_}" } sort keys %$cookies );
+}
+
+1;
diff --git a/cpan/HTTP-Tiny/t/cases/cookies-01.txt b/cpan/HTTP-Tiny/t/cases/cookies-01.txt
new file mode 100644
index 0000000000..e71bf014cd
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/cases/cookies-01.txt
@@ -0,0 +1,34 @@
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname=cvalue
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
diff --git a/cpan/HTTP-Tiny/t/cases/cookies-02.txt b/cpan/HTTP-Tiny/t/cases/cookies-02.txt
new file mode 100644
index 0000000000..7e7db2c742
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/cases/cookies-02.txt
@@ -0,0 +1,52 @@
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue01; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname=cvalue01
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue02; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname=cvalue02
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue02; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
diff --git a/cpan/HTTP-Tiny/t/cases/cookies-03.txt b/cpan/HTTP-Tiny/t/cases/cookies-03.txt
new file mode 100644
index 0000000000..c7eab4ef37
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/cases/cookies-03.txt
@@ -0,0 +1,87 @@
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue01; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname=cvalue01
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue02; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index02.html
+----------
+GET /index02.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue03; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname=cvalue02
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue02; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index02.html
+----------
+GET /index02.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname=cvalue03
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue03; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
diff --git a/cpan/HTTP-Tiny/t/cases/cookies-04.txt b/cpan/HTTP-Tiny/t/cases/cookies-04.txt
new file mode 100644
index 0000000000..7c9c1cb461
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/cases/cookies-04.txt
@@ -0,0 +1,37 @@
+url
+ http://example.com/index.html
+headers
+ Cookie: cname=cvalue05; domain=example.com; path=/
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname=cvalue05
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue06; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname=cvalue06
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue06; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
diff --git a/cpan/HTTP-Tiny/t/cases/cookies-05.txt b/cpan/HTTP-Tiny/t/cases/cookies-05.txt
new file mode 100644
index 0000000000..0d41152e99
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/cases/cookies-05.txt
@@ -0,0 +1,35 @@
+url
+ http://example.com/index.html
+headers
+ No-Cookie-Jar: 1
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue06; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname=cvalue06; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
diff --git a/cpan/HTTP-Tiny/t/cases/cookies-06.txt b/cpan/HTTP-Tiny/t/cases/cookies-06.txt
new file mode 100644
index 0000000000..86632b0156
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/cases/cookies-06.txt
@@ -0,0 +1,51 @@
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname1=cvalue01; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname1=cvalue01
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname2=cvalue02; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname1=cvalue01; cname2=cvalue02
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
diff --git a/cpan/HTTP-Tiny/t/cases/cookies-07.txt b/cpan/HTTP-Tiny/t/cases/cookies-07.txt
new file mode 100644
index 0000000000..69c4a62447
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/cases/cookies-07.txt
@@ -0,0 +1,34 @@
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Set-Cookie: cname1=cvalue01; domain=example.com; path=/
+Set-Cookie: cname2=cvalue02; domain=example.com; path=/
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+url
+ http://example.com/index.html
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Cookie: cname1=cvalue01; cname2=cvalue02
+
+----------
+HTTP/1.1 200 OK
+Date: Sat, 02 Mar 2013 00:00:00 GMT
+Content-Type: text/plain
+Content-Length: 44
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef