httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 11971] - HTTP proxy header "Via" with wrong hostname if ServerName not set or UseCanonicalName Off
Date Thu, 06 Apr 2006 19:15:13 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=11971>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=11971





------- Additional Comments From francois.pesce@gmail.com  2006-04-06 20:15 -------
Created an attachment (id=18036)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18036&action=view)
patch to fix proxy's port in Via: header when ServerName not set ot set or
UseCanonicalName Off

I did'nt know that patch was already in 2.2 !
Funny to see how similar it is!

For the port part, the problem is the same than server_name, ap_get_server_port
returns the port of the destination URI specified in the request, not the port
of the proxy, thus if the port is specified into the requested URI like in this
example:

echo -e "GET http://host:6672/ HTTP/1.1\r\nHost: host:6672\r\n\r\n" | nc proxy
8081

The host receive a request with Via set like this:
Via: 1.1 host:6672

either the host and the port are wrong.

with a patched servername it will receive :
Via: 1.1 proxy:6672

host correct but port wrong

In the summary of the bug, I suppose the initial reporter of the bug did'nt
notice this, because he set the port of the proxy with ServerName directive.
But if you just set the hostname (without a final :port) AND the request
contains a specific port, the Via: will display correct proxy host with
incorrect port (the destination one).

the bug happens because ap_get_server_port returns :
	r->parsed_uri.port_str ? r->parsed_uri.port :
	       r->server->port ? r->server->port :
	       ap_default_port(r);
What we want here is the server port, if i understand correctly, not the
parsed_uri port.

BTW, imho there is some refactoring to do here, because the server name stuff
is duplicated code, and may be generated in the same code area than the server
port.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message