NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/48810: httpd does not use cgi handler for index



>Number:         48810
>Category:       bin
>Synopsis:       httpd does not use cgi handler for index
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 14 13:45:00 +0000 2014
>Originator:     Stephen Borrill
>Release:        NetBSD 6.1_STABLE
>Organization:

>Environment:


System: NetBSD 6.1_STABLE NetBSD 6.1_STABLE (XEN3_DOMU) amd64
Architecture: x86_64
Machine: amd64
>Description:
httpd -C allows you to specify a cgi handler for a certain file extension.
-x allows you to set the default index document.
If you combine the two and set an index document with an extension that
should be handled by a cgi handler, you get the raw contents of the
document, instead of it being passed to the cgi handler.

The bozohttpd changelog suggests this was fixed years ago:

changes since bozohttpd 20021106:
[snip]
         o  allow -x (index.html) mode to work with CGI handlers

>How-To-Repeat:
In inetd.conf set httpd -C .sh /bin/sh -x index.sh /var/www
Create /var/www/index.sh (and chmod +x it):
#!/bin/sh
echo "Content-Type: text/plain"
echo
echo "Hello"

Visit http://localhost/ and you will see the raw contents of index.sh
Visit http://localhost/index.sh and you will see the processed output.
Alternatively, use telnet:
test# telnet localhost 80
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.0 200 OK
Date: Wed, 14 May 2014 13:38:43 GMT
Server: bozohttpd/20111118
Accept-Ranges: bytes
Last-Modified: Wed, 14 May 2014 13:35:08 GMT
Content-Length: 61

#!/bin/sh
echo "Content-Type: text/plain"
echo
echo "Hello"
Connection closed by foreign host.
test# telnet localhost 80
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /index.sh HTTP/1.0

HTTP/1.0 200 OK
Content-Type: text/plain

Hello
Connection closed by foreign host.
>Fix:

>Unformatted:
 
 


Home | Main Index | Thread Index | Old Index