This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update HTTP-Tiny to CPAN version 0.029
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Fri, 24 May 2013 20:46:26 +0000 (21:46 +0100)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Fri, 24 May 2013 20:46:26 +0000 (21:46 +0100)
  [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]

16 files changed:
MANIFEST
Porting/Maintainers.pl
cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
cpan/HTTP-Tiny/t/00-compile.t
cpan/HTTP-Tiny/t/001_api.t
cpan/HTTP-Tiny/t/070_cookie_jar.t [new file with mode: 0644]
cpan/HTTP-Tiny/t/160_cookies.t [new file with mode: 0644]
cpan/HTTP-Tiny/t/BrokenCookieJar.pm [new file with mode: 0644]
cpan/HTTP-Tiny/t/SimpleCookieJar.pm [new file with mode: 0644]
cpan/HTTP-Tiny/t/cases/cookies-01.txt [new file with mode: 0644]
cpan/HTTP-Tiny/t/cases/cookies-02.txt [new file with mode: 0644]
cpan/HTTP-Tiny/t/cases/cookies-03.txt [new file with mode: 0644]
cpan/HTTP-Tiny/t/cases/cookies-04.txt [new file with mode: 0644]
cpan/HTTP-Tiny/t/cases/cookies-05.txt [new file with mode: 0644]
cpan/HTTP-Tiny/t/cases/cookies-06.txt [new file with mode: 0644]
cpan/HTTP-Tiny/t/cases/cookies-07.txt [new file with mode: 0644]

index ada4d8b..e3e3b8f 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1058,6 +1058,7 @@ cpan/HTTP-Tiny/t/030_response.t
 cpan/HTTP-Tiny/t/040_content.t
 cpan/HTTP-Tiny/t/050_chunked_body.t
 cpan/HTTP-Tiny/t/060_http_date.t
+cpan/HTTP-Tiny/t/070_cookie_jar.t
 cpan/HTTP-Tiny/t/100_get.t
 cpan/HTTP-Tiny/t/101_head.t
 cpan/HTTP-Tiny/t/102_put.t
@@ -1067,6 +1068,15 @@ cpan/HTTP-Tiny/t/110_mirror.t
 cpan/HTTP-Tiny/t/130_redirect.t
 cpan/HTTP-Tiny/t/140_proxy.t
 cpan/HTTP-Tiny/t/150_post_form.t
+cpan/HTTP-Tiny/t/160_cookies.t
+cpan/HTTP-Tiny/t/BrokenCookieJar.pm
+cpan/HTTP-Tiny/t/cases/cookies-01.txt
+cpan/HTTP-Tiny/t/cases/cookies-02.txt
+cpan/HTTP-Tiny/t/cases/cookies-03.txt
+cpan/HTTP-Tiny/t/cases/cookies-04.txt
+cpan/HTTP-Tiny/t/cases/cookies-05.txt
+cpan/HTTP-Tiny/t/cases/cookies-06.txt
+cpan/HTTP-Tiny/t/cases/cookies-07.txt
 cpan/HTTP-Tiny/t/cases/delete-01.txt
 cpan/HTTP-Tiny/t/cases/form-01.txt
 cpan/HTTP-Tiny/t/cases/form-02.txt
@@ -1114,6 +1124,7 @@ cpan/HTTP-Tiny/t/cases/redirect-06.txt
 cpan/HTTP-Tiny/t/cases/redirect-07.txt
 cpan/HTTP-Tiny/t/cases/redirect-08.txt
 cpan/HTTP-Tiny/t/cases/redirect-09.txt
+cpan/HTTP-Tiny/t/SimpleCookieJar.pm
 cpan/HTTP-Tiny/t/Util.pm
 cpan/IO-Compress/bin/zipdetails                                IO::Compress
 cpan/IO-Compress/Changes                               IO::Compress
index 628cde7..a570de8 100755 (executable)
@@ -926,7 +926,7 @@ use File::Glob qw(:case);
 
     'HTTP::Tiny' => {
         'MAINTAINER'   => 'dagolden',
-        'DISTRIBUTION' => 'DAGOLDEN/HTTP-Tiny-0.025.tar.gz',
+        'DISTRIBUTION' => 'DAGOLDEN/HTTP-Tiny-0.029.tar.gz',
         'FILES'        => q[cpan/HTTP-Tiny],
         'EXCLUDED'     => [
             't/00-report-prereqs.t',
index 333aab5..dfcf07b 100644 (file)
@@ -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.
index 6987686..6454c82 100644 (file)
@@ -70,4 +70,5 @@ $plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");
             script_compiles( $file, "$script script compiles" );
         }
     }
+
 }
index 4311c67..0083c2e 100644 (file)
@@ -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 (file)
index 0000000..bd09a54
--- /dev/null
@@ -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 (file)
index 0000000..899a197
--- /dev/null
@@ -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 (file)
index 0000000..f638e20
--- /dev/null
@@ -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 (file)
index 0000000..4c8fe08
--- /dev/null
@@ -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 (file)
index 0000000..e71bf01
--- /dev/null
@@ -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 (file)
index 0000000..7e7db2c
--- /dev/null
@@ -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 (file)
index 0000000..c7eab4e
--- /dev/null
@@ -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 (file)
index 0000000..7c9c1cb
--- /dev/null
@@ -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 (file)
index 0000000..0d41152
--- /dev/null
@@ -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 (file)
index 0000000..86632b0
--- /dev/null
@@ -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 (file)
index 0000000..69c4a62
--- /dev/null
@@ -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