Changeset 11766

Show
Ignore:
Timestamp:
05/17/08 19:11:29 (5 years ago)
Author:
yappo
Message:

fcgi broken

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

Legend:

Unmodified
Added
Removed
  • lang/perl/HTTP-Engine/trunk/examples/lighty/test_fastcgi.pl

    r11120 r11766  
    22use strict; 
    33use warnings; 
    4 warn "OKGE"; 
     4use FindBin '$Bin'; 
    55use HTTP::Engine; 
    66use Data::Dumper; 
     
    1010        module => 'FCGI', 
    1111        args   => { 
    12             request_handler => sub { 
    13                     my $c = shift; 
     12#            listen => $FindBin::Bin . 'test.socket', 
     13        }, 
     14        request_handler => sub { 
     15            my $c = shift; 
    1416 
    15                     $c->res->content_type('text/html'); 
     17            $c->res->content_type('text/html'); 
    1618 
    17                     $c->res->body( render_body( Dumper($c->req) ) ); 
    18               } 
    19         }, 
     19            $c->res->body( render_body( Dumper($c->req) ) ); 
     20         } 
    2021    }, 
    2122)->run; 
  • lang/perl/HTTP-Engine/trunk/lib/HTTP/Engine/Interface/FCGI.pm

    r11690 r11766  
    4949has listen => ( 
    5050    is  => 'ro', 
    51     isa => 'Int', 
     51    isa => 'Str', 
    5252); 
    5353 
     
    137137} 
    138138 
     139 
     140use HTTP::Engine::ResponseWriter; 
     141HTTP::Engine::ResponseWriter->meta->add_method( write => sub { 
     142    my($self, $buffer) = @_; 
     143 
     144    unless ( $self->{_prepared_write} ) { 
     145        $self->prepare_write; 
     146        $self->{_prepared_write} = 1; 
     147    } 
     148 
     149    # XXX: We can't use Engine's write() method because syswrite 
     150    # appears to return bogus values instead of the number of bytes 
     151    # written: http://www.fastcgi.com/om_archive/mail-archive/0128.html 
     152 
     153    # FastCGI does not stream data properly if using 'print $handle', 
     154    # but a syswrite appears to work properly. 
     155    *STDOUT->syswrite($buffer); 
     156}); 
     157 
    1391581; 
    140159__END__