Finishing up the last few glitches of the webapp_module and I found a couple
of inconsistencies between Apache, the servlet spec and Tomcat.

I have a couple of virtual hosts on the same IP address on two ports under
apache:
    www.betaversion.org
And
    kali.betaversion.org

They use both ports 80 and 8080, BUT I have only one definition for the
server: www:80 (www:8080, kali:80 and kali:8080 are configured to be exactly
equal to www:80).

Now, when I call my CGI, for ALL these four requests
    http://www.betaversion.org:80/cgi_bin/test
    http://www.betaversion.org:8080/cgi_bin/test
    http://kali.betaversion.org:80/cgi_bin/test
    http://kali.betaversion.org:8080/cgi_bin/test
I find out that
    SERVER_NAME is always www.betaversion.org
And
    SERVER_PORT is always 80

But, if with the same configuration I run tomcat, the SnoopServlet returns:
    http://www.betaversion.org:80/cgi_bin/test
        getServerName() -> www.betaversion.org
        getServerPort() -> 80
    http://www.betaversion.org:8080/cgi_bin/test
        getServerName() -> www.betaversion.org
        getServerPort() -> 8080
    http://kali.betaversion.org:80/cgi_bin/test
        getServerName() -> kali.betaversion.org
        getServerPort() -> 80
    http://kali.betaversion.org:8080/cgi_bin/test
        getServerName() -> kali.betaversion.org
        getServerPort() -> 8080

So, something is wrong, since the spec says that calling
    ServletRequest.getServerName() is equal to the SERVER_NAME CGI variable
And 
    ServletRequest.getServerPort() is equal to the SERVER_PORT CGI variable

At the end, what should I use? Wich one is correct? The CONFIGURED server
name and port or the one derived from the Host: ...... Header????
(Right now I'm using the second one, like Tomcat does)...

    Pier

-- 
Pier P. Fumagalli  Apache Software Foundation  <mailto:[EMAIL PROTECTED]>
----------------------------------------------------------------------------
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur,
adipisci velit...                             (Cicero: "De Finibus" 1.10.32)


Reply via email to