Bug 26724

Summary: 'Action' directives involving 'non-parsed-headers' CGI modules do not work correctly.
Product: Apache httpd-2 Reporter: Chris Munt <cm>
Component: mod_actionsAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 2.0.48   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Chris Munt 2004-02-06 13:01:16 UTC
The following configuration construct (in httpd.conf) does not work with 'non 
parsed headers' CGI modules.

Example:

Action my-handler /cgi-bin/nph-cm.pl
AddHandler my-handler csp cls

This should invoke the script 'nph-cm.pl' for requests for files with 
extension 'csp' or 'cls'.  Apache should allow the CGI script to return its 
own header without interfering:

Script nph-cm.pl:

#!C:/perl/bin/perl.exe

print "$ENV{SERVER_PROTOCOL} 200 OK\n";
print "Server: $ENV{SERVER_SOFTWARE}\n";
print "Content-type: text/html\n";
print "Connection: close\n\n";

print "<html><head><title>Test</title></head>\n";
print "<h2>Process: ";
print $ENV{"PATH_TRANSLATED"};
print "</h2>\n";
print "</html>\n";


What actually gets returned (for /csp/samples/loop.csp) is:

HTTP/1.1 200 OK
Server: Apache/2.0.48 (Win32)
Content-type: text/html
Connection: close
 
<html><head><title>Test</title></head>
<h2>Process: C:\cachesys\csp\samples\loop.csp</h2>
</html>
HTTP/1.1 200 OK
Date: Fri, 06 Feb 2004 12:28:04 GMT
Server: Apache/2.0.48 (Win32)
Content-Length: 0
Content-Type: text/csp


Note that Apache tried insert an header at the end of the transmission for 
some reason.  It also hangs for quite a while (around 5 seconds) whilst 
returning this content to the client.  Incidentally, calling the CGI module 
directly through a browser (/cgi-bin/nph-cm.pl) works OK.


Removing the 'nph-' requirement works as expected:

In httpd.conf:

Action my-handler /cgi-bin/cm.pl
AddHandler my-handler csp cls

The script cm.pl:

#!C:/perl/bin/perl.exe

print "Content-type: text/html\n";
print "Connection: close\n\n";

print "<html><head><title>Test</title></head>\n";
print "<h2>Process: ";
print $ENV{"PATH_TRANSLATED"};
print "</h2>\n";
print "</html>\n";
Comment 1 Joe Orton 2004-06-03 16:19:29 UTC

*** This bug has been marked as a duplicate of 22898 ***