tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeanfrancois Arcand <jfarc...@apache.org>
Subject Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java
Date Tue, 02 Dec 2003 19:34:32 GMT


Hans Bergsten wrote:

> Remy Maucherat wrote:
>
>> [...]
>> Now the big question is actually what the new getLocalPort call 
>> should return. If you need an extra localPort (and its friend 
>> getLocalName - did you notice the getLocalName() call was always 
>> returning whatever hostname was in the host header) field in the 
>> request because it doesn't correspond to vhosting (I consider it 
>> would be yet another major blunder of the Servlet spec, but what can 
>> I do ...), then so be it.
>
>
> The getLocalXXX() methods are intended to provide information about
> where the request was _recieved_ by the container, rather than where
> it was _sent_ by the client, which is useful information for some types
> of applications, for instance to detect if there's any vhosting
> involved.
>
> So you have three sets of methods for getting address/port info.
> * Where the request was received (server socket):
> getLocalName()
> getLocalPort()
> getLocalAddr()
>
> * Where the request was sent (Host header info):
> getServerName()
> getServerPort()
>
> * Where the request comes from (client socket):
> getRemoteName()
> getRemotePort()
> getRemoteAddr()
>
> With an HTTP/1.1 request with a Host header "foo.com" value, proxied
> through Apache to Tomcat listening on port 8005, from a client (or a
> proxy) at 4.62.132.17 (bar.com) port 1766, the methods should return
> these values:
>
> getLocalName() -> localhost (or some other local interface)
> getLocalPort() -> 8005
> getLocalAddr() -> 127.0.0.1 (or some other local interface)
>
> getServerName() -> foo.com
> getServerPort() -> 80
>
> getRemoteName() -> bar.com
> getRemotePort() -> 1766
> getRemoteAddr() -> 4.62.132.17
>
> Without proxying through Apache, a Host header "localhost:8080"
> value and Tomcat listening on port 8080, it would look like this
> instead:
>
> getLocalName() -> localhost
> getLocalPort() -> 8080
> getLocalAddr() -> 127.0.0.1
>
> getServerName() -> localhost
> getServerPort() -> 8080
>
> getRemoteName() -> bar.com
> getRemotePort() -> 1766
> getRemoteAddr() -> 4.62.132.17

Then today's commit implemented that behaviour except for getLocalName(0 
which is still broken.Will fix it). Before getLocalPort() was calling 
getServerPort() (my mistake back in 03/05). I think the spec should be 
clarified with an example like this one ;-)

Thanks for the clarification.

-- Jeanfrancois




>
> HTH,
> Hans



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message