Changeset 17712 for lang

Show
Ignore:
Timestamp:
08/16/08 19:46:28 (5 years ago)
Author:
tokuhirom
Message:

no HTTP::Request::AsCGI;

Location:
lang/perl/HTTP-Engine/trunk/lib/HTTP/Engine
Files:
2 added
3 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/HTTP-Engine/trunk/lib/HTTP/Engine/Interface/POE.pm

    r17711 r17712  
    66    Component::Server::TCP 
    77/; 
    8 use POE::Filter::HTTPD; 
     8use HTTP::Engine::Interface::POE::Filter; 
    99use HTTP::Request::AsCGI; 
     10use IO::Scalar; 
     11use URI::WithBase; 
    1012 
    1113has host => ( 
     
    3335        Port         => $self->port, 
    3436        Address      => $self->host, 
    35         ClientFilter => 'POE::Filter::HTTPD', 
     37        ClientFilter => 'HTTP::Engine::Interface::POE::Filter', 
    3638        ( $self->alias ? ( Alias => $self->alias ) : () ), 
    3739        ClientInput  => _client_input($self), 
    3840    ); 
    3941} 
     42 
     43our $CLIENT; 
    4044 
    4145sub _client_input { 
     
    5054        # the responses as they are and finish up. 
    5155        if ( $request->isa('HTTP::Response') ) { 
    52             $heap->{client}->put($request); 
     56            $heap->{client}->put($request->as_string); 
    5357            $kernel->yield('shutdown'); 
    5458            return; 
     
    5660 
    5761        # follow is normal workflow. 
    58         my $ascgi = HTTP::Request::AsCGI->new($request)->setup; 
    5962        do { 
    60             my $env = \%ENV; 
     63            local $CLIENT = $heap->{client}; 
    6164 
    6265            my $host = $request->header('Host'); 
     
    7073                request_args => { 
    7174                    headers => $request->headers, 
     75                    uri     => URI::WithBase->new($uri), 
    7276                    connection_info => { 
    7377                        address    => $heap->{remote_ip}, 
     
    7882                        protocol   => $request->protocol(), 
    7983                    }, 
     84                    _connection => { 
     85                        input_handle  => do { 
     86                            my $stdinbuf = $request->content; 
     87                            IO::Scalar->new( \$stdinbuf ); 
     88                        }, 
     89                        output_handle => undef, 
     90                        env           => \%ENV, 
     91                    }, 
    8092                }, 
    8193            ); 
    8294        }; 
    83         $ascgi->restore; 
    8495 
    85         $heap->{client}->put($ascgi->response); 
    8696        $kernel->yield('shutdown'); 
    8797    } 
  • lang/perl/HTTP-Engine/trunk/lib/HTTP/Engine/Interface/POE/RequestBuilder.pm

    r17711 r17712  
    11package HTTP::Engine::Interface::POE::RequestBuilder; 
    22use Moose; 
    3 extends 'HTTP::Engine::RequestBuilder'; 
    43 
    5 sub _build_connection_info { die "explicit parameter" } 
     4with qw( 
     5    HTTP::Engine::Role::RequestBuilder::Standard 
     6    HTTP::Engine::Role::RequestBuilder::HTTPBody 
     7); 
     8 
     9# all of these will be passed to handle_request 
     10sub _build_connection { die "explicit parameter" } 
     11sub _build_uri { die "explicit parameter" } 
     12sub _build_connection_info { die "explicit parameter" }; 
     13sub _build_headers { die "explicit parameter" }; 
    614 
    7151; 
  • lang/perl/HTTP-Engine/trunk/lib/HTTP/Engine/ResponseWriter.pm

    r17699 r17712  
    3434    } 
    3535 
    36     local *STDOUT = $req->_connection->{output_handle}; 
     36    local *STDOUT = $req->_connection->{output_handle} if $req->_connection->{output_handle}; 
    3737    $self->_prepare_write; 
    3838    $self->_write($self->_response_line($res) . $CRLF) if $self->should_write_response_line;