X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP.pm;h=6f66a39199fc082d369058d0aecdd31358b0adb1;hb=e73e3bad5248d5d16e6b32024ca341d1208e7bcb;hp=ec4ad866fc8dba835de01efc1cf59167d85d4617;hpb=e2b0ddd34989844e13aa57483888973068d62dbe;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/HTTP.pm index ec4ad86..6f66a39 100644 --- a/lib/Catalyst/Engine/HTTP.pm +++ b/lib/Catalyst/Engine/HTTP.pm @@ -263,14 +263,15 @@ sub run { if ( !$self->_read_headers ) { # Error reading, give up + close Remote; next LISTEN; } my ( $method, $uri, $protocol ) = $self->_parse_request_line; + + next unless $method; DEBUG && warn "Parsed request: $method $uri $protocol\n"; - - next unless $method; unless ( uc($method) eq 'RESTART' ) { @@ -333,7 +334,7 @@ sub run { use Config; $ENV{PERL5LIB} .= join $Config{path_sep}, @INC; - exec $^X . ' "' . $0 . '" ' . join( ' ', @{ $options->{argv} } ); + exec $^X, $0, @{ $options->{argv} }; } exit; @@ -419,9 +420,14 @@ sub _read_headers { while (1) { my $read = sysread Remote, my $buf, CHUNKSIZE; - - if ( !$read ) { - DEBUG && warn "EOF or error: $!\n"; + + if ( !defined $read ) { + next if $! == EWOULDBLOCK; + DEBUG && warn "Error reading headers: $!\n"; + return; + } + elsif ( $read == 0 ) { + DEBUG && warn "EOF\n"; return; } @@ -437,7 +443,8 @@ sub _parse_request_line { my $self = shift; # Parse request line - if ( $self->{inputbuf} !~ s/^(\w+)[ \t]+(\S+)(?:[ \t]+(HTTP\/\d+\.\d+))?[^\012]*\012// ) { + # Leading CRLF sometimes sent by buggy IE versions + if ( $self->{inputbuf} !~ s/^(?:\x0D\x0A)?(\w+)[ \t]+(\S+)(?:[ \t]+(HTTP\/\d+\.\d+))?[^\012]*\012// ) { return (); } @@ -527,17 +534,11 @@ sub _inet_addr { unpack "N*", inet_aton( $_[0] ) } =head1 SEE ALSO -L, L. +L, L =head1 AUTHORS -Sebastian Riedel, - -Dan Kubb, - -Sascha Kiefer, - -Andy Grundman, +Catalyst Contributors, see Catalyst.pm =head1 THANKS