www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dion Almaer <d...@member.com>
Subject documentation/789: Bad Perl Code is mentioned in the FAQ, #31
Date Thu, 26 Jun 1997 07:30:02 GMT

>Number:         789
>Category:       documentation
>Synopsis:       Bad Perl Code is mentioned in the FAQ, #31
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache (Apache HTTP Project)
>State:          open
>Class:          doc-bug
>Submitter-Id:   apache
>Arrival-Date:   Thu Jun 26 00:30:01 1997
>Originator:     dion@member.com
>Organization:
apache
>Release:        1.2b8
>Environment:
All... it's in documentation
>Description:
The perl code example in #31 of the Apache FAQ is flawed in 3 ways.

a) the regex is wrong as it allows /foonph-cgi (due to the /*).
b) printf is not needed. print should be used.
c) no semi colon should be after the if statement.

see the way to fix it.
>How-To-Repeat:
  31.How can I get my script's output without Apache buffering it
in the FAQ
>Fix:
the perl code is now:
if ($0 =~ m:/*nph-:) { 
    $HTTP_headers =  "HTTP/1.1 200 OK\015\012"; 
    $HTTP_headers .=  "Connection: close\015\012"; 
    printf ($HTTP_headers); 
}; 

and it should 

a) the regex is wrong as it allows /foonph-cgi (due to the /*).
b) printf is not needed. print should be used.
c) no semi colon should be after the if statement.

if ($0 =~ m:/nph-:) { 
    $HTTP_headers =  "HTTP/1.1 200 OK\015\012"; 
    $HTTP_headers .=  "Connection: close\015\012"; 
    print $HTTP_headers; 
}
>Audit-Trail:
>Unformatted:



Mime
View raw message