Changeset 1948

Show
Ignore:
Timestamp:
08/18/2007 11:35:27 AM (12 months ago)
Author:
jan
Message:

fixed extracting status code from NPH scripts (fixes #1125)

Location:
branches/lighttpd-1.4.x
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-1.4.x/NEWS

    r1947 r1948  
    2121  * fixed extra Content-Length header on 1xx, 204 and 304 (#1002) 
    2222  * fixed handling of duplicate If-Modified-Since to return 304  
     23  * fixed extracting status code from NPH scripts (#1125) 
    2324  * removed config-check if passwd files exist (#1188) 
    2425   
  • branches/lighttpd-1.4.x/src/mod_cgi.c

    r1937 r1948  
    256256                                status = strtol(s+9, NULL, 10); 
    257257 
    258                                 if (con->http_status >= 100 && 
    259                                     con->http_status < 1000) { 
     258                                if (status >= 100 && 
     259                                    status < 1000) { 
    260260                                        /* we expected 3 digits and didn't got them */ 
    261261                                        con->parsed_response |= HTTP_STATUS; 
  • branches/lighttpd-1.4.x/tests/docroot/www/nph-status.pl

    r1374 r1948  
    11#!/usr/bin/perl 
    22 
    3 print "HTTP/1.0 30 FooBar\r\n"; 
     3my $status = 200; 
     4 
     5if (defined $ENV{"QUERY_STRING"}) { 
     6        $status = $ENV{"QUERY_STRING"}; 
     7} 
     8 
     9print "HTTP/1.0 ".$status." FooBar\r\n"; 
    410print "\r\n"; 
  • branches/lighttpd-1.4.x/tests/mod-cgi.t

    r1925 r1948  
    99use strict; 
    1010use IO::Socket; 
    11 use Test::More tests => 16; 
     11use Test::More tests => 18; 
    1212use LightyTest; 
    1313 
     
    4141 
    4242$t->{REQUEST}  = ( <<EOF 
    43 GET /nph-status.pl HTTP/1.0 
     43GET /nph-status.pl?30 HTTP/1.0 
    4444EOF 
    4545 ); 
    4646$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; 
    47 ok($tf->handle_http($t) == 0, 'NPH + perl, Bug #14'); 
     47ok($tf->handle_http($t) == 0, 'NPH + perl, invalid status-code (#14)'); 
     48 
     49$t->{REQUEST}  = ( <<EOF 
     50GET /nph-status.pl?304 HTTP/1.0 
     51EOF 
     52 ); 
     53$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ]; 
     54ok($tf->handle_http($t) == 0, 'NPH + perl, setting status-code (#1125)'); 
     55 
     56$t->{REQUEST}  = ( <<EOF 
     57GET /nph-status.pl?200 HTTP/1.0 
     58EOF 
     59 ); 
     60$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; 
     61ok($tf->handle_http($t) == 0, 'NPH + perl, setting status-code'); 
    4862 
    4963$t->{REQUEST} = ( <<EOF