On Jul 11, 2006, at 6:53 PM, [EMAIL PROTECTED] wrote:
However, getting the right hostname is a confusing and error-prone activity. As a data point, this call takes about 30 seconds on my current nameserver, and ends up getting the wrong information anyway (it should be using my NAT-external address, but instead it ends up using my internal address). It's also made in the server code unconditionally: the host address information is used only in the path where there is no Host: header but we block anyway. If there is a transient DNS failure, we cache the numeric host name for a process lifetime (e.g. forever) anyway.

Given that I think it would be best to at least be consistent, and always use the numeric in the case where we don't know.

The webserver mainly needs to know its name for generating URLs for redirects etc when the client doesn't send a host header. In apache, the problem is solved by using the machine's "hostname" for the default server name, unless otherwise configured with the "ServerName" config parameter. if you want it to use a different default "self"-name per IP address, you need to use vhost sections to configure that. Upon reflection, this seems like a better thing to do, and the current hack should be dispensed with. (Trusting "hostname" to give you a valid hostname has its own set of issues but hey, that's why its overrideable.) And of course none of this is really important if the client sends a Host header, which nearly all do anyhow.

See <http://httpd.apache.org/docs/2.0/mod/core.html#servername> and <http://httpd.apache.org/docs/2.0/mod/core.html#usecanonicalname>.

James

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to