Net-Async-HTTP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

         * Clean up connection cache after resolve, connect or SSL failures
           (RT71530)

0.12    BUGFIXES:
         * Wait for connect to complete when pipelining multiple requests down
           the same connection initially (RT66189)
         * When serialising a request, handle a full protocol://authority URI
           by splitting protocol/authority parts out of it

0.11    BUGFIXES:
         * Fix stalling t/12request-streaming.t test script that causes lots
           of FAILs at test time

0.10    CHANGES:
         * Support streaming of request body content
         * Support HTTP::Cookies object as a cookie jar
         * Allow proxy_host and proxy_port as ->configure parameters, to set
           defaults for requests

0.09    CHANGES:
         * Use IO::Async::Protocol->connect from 0.34

0.08    CHANGES:
         * Support streaming of response body content
         * Support SSL if IO::Async::SSL is installed

0.07    CHANGES:
         * base on IO::Async::Protocol::Stream

0.06    CHANGES:
         * When POSTing content that isn't form data, expect to be given its
           content type

0.05    CHANGES:

MANIFEST  view on Meta::CPAN

t/00use.t
t/01request.t
t/02uri.t
t/03future.t
t/04fail.t
t/05redir.t
t/06close.t
t/07continue.t
t/08prepareprocess.t
t/09cookies.t
t/10request-streaming.t
t/11response-streaming.t
t/12conn-persistence.t
t/13conn-pipeline.t
t/14conn-max.t
t/15conn-errors.t
t/16max-in-flight.t
t/17on-write.t
t/18content-coding.t
t/19idle.t
t/20local-connect.t
t/21local-connect-ssl.t

t/10request-streaming.t  view on Meta::CPAN

   );


   # Wait for the client to send its request
   my $request_stream = "";
   wait_for_stream { $request_stream =~ m/$CRLF$CRLF/ } $peersock => $request_stream;

   $request_stream =~ s/^(.*)$CRLF//;
   my $req_firstline = $1;

   is( $req_firstline, "PUT /handler HTTP/1.1", 'First line for streaming PUT' );

   $request_stream =~ s/^(.*)$CRLF$CRLF//s;
   my %req_headers = map { m/^(.*?):\s+(.*)$/g } split( m/$CRLF/, $1 );

   is( \%req_headers,
      {
         'Host'           => "somewhere",
         'Content-Length' => 21,
         'Connection'     => 'keep-alive',
      },
      'Request headers for streaming PUT'
   );

   my $req_content;
   if( defined( my $len = $req_headers{'Content-Length'} ) ) {
      wait_for_stream { length( $request_stream ) >= $len } $peersock => $request_stream;

      $req_content = substr( $request_stream, 0, $len );
      substr( $request_stream, 0, $len ) = "";
   }

   is( $req_content, "Content from callback", 'Request content for streaming PUT' );

   $peersock->syswrite( "HTTP/1.1 201 Created$CRLF" . 
                        "Content-Length: 0$CRLF" .
                        "Connection: Keep-Alive$CRLF" .
                        $CRLF );

   wait_for { defined $response };

   is( $response->code, 201, 'Result code for streaming PUT' );

   my %res_headers = map { $_ => $response->header( $_ ) } $response->header_field_names;
   is( \%res_headers,
      {
         'Content-Length' => 0,
         'Connection'     => "Keep-Alive",
      },
      'Result headers for streaming PUT'
   );
}

{
   my $req = HTTP::Request->new( PUT => "/handler", [ Host => "somewhere" ]);
   $req->content_length( 15 );

   my $body_f = $loop->new_future;

   my $response;

t/10request-streaming.t  view on Meta::CPAN


   is( $request_stream, "Delayed content" );

   $peersock->syswrite( "HTTP/1.1 201 Created$CRLF" . 
                        "Content-Length: 0$CRLF" .
                        "Connection: Keep-Alive$CRLF" .
                        $CRLF );

   wait_for { defined $response };

   is( $response->code, 201, 'Result code for streaming PUT from Future' );
}

done_testing;



( run in 0.330 second using v1.01-cache-2.11-cpan-4d50c553e7e )