Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 72678
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: joey [...] kitenet.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: thttpd HTTP_HOST does not include a port
tftpd sets CGI variables like this: SERVER_PORT=8181 HTTP_HOST=localhost The virtual_port method assumes that if there's a HTTP_HOST, any port is included in it (like "localhost:8181"). When there's no port, it assumes 80 (or 443). That works with Apache, but this variable does not seem to be part of the spec for CGI, and tftpd has other ideas. I think that CGI.pm should support tftpd, which could be done by looking at SERVER_PORT when HTTP_HOST has no port. Example breakage due to this bug, also includes a patch to fix thttpd: http://ikiwiki.info/bugs/Running_on_an_alternative_port_fails/ version: CGI.pm 3.52 from perl 5.14.2
Could you cite the specific relevant passages of the CGI spec to show where CGI.pm is non-compliant?
On Mon Nov 28 11:24:08 2011, MARKSTOS wrote: Show quoted text
> Could you cite the specific relevant passages of the CGI spec to show > where CGI.pm is non-compliant?
I cannot find HTTP_HOST in any spec, so it seems that CGI.pm needs to support the differing ways web servers use the variable.
Joey, In the HTTP RFC 2616, the definition of the "Host:" field is clear that it includes a port number: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23 The CGI spec refers to this at the section named "4.1.18. Protocol-Specific Meta-Variables" "Meta-variables with names beginning with "HTTP_" contain values read from the client request header fields, if the protocol used is HTTP." http://www.faqs.org/rfcs/rfc3875.html So, the HTTP_HOST variable should follow the HTTP specification for the HTTP "Host:" header, which is defined to include the port number. It appears to me that the mentioned web server should be updated to include the port number here.
Based on my previous research, it looks like the web server was at fault for not following the HTTP spec and including a port number in the "Host:" header, so I'm considering this resolved. Mark