You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2013/07/03 02:54:24 UTC

[Bug 55186] New: useIPVHosts=true , incorrect to get Request.localName

https://issues.apache.org/bugzilla/show_bug.cgi?id=55186

            Bug ID: 55186
           Summary: useIPVHosts=true , incorrect to get Request.localName
           Product: Tomcat 7
           Version: 7.0.30
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
          Assignee: dev@tomcat.apache.org
          Reporter: jmwmj208@163.com

I configured useIPVHosts=true.
&set up two hosts :
<Host name="localhost" appBase="webapps" />
<Host name="www.jm.com" appBase="webapps2" />
&my pc has two ip: 10.10.4.48 and 192.168.56.1
&HOSTS file is:
~~~~~~~~~~~~~~~~~~
127.0.0.1 localhost
192.168.56.1 www.jm.com
~~~~~~~~~~~~~~~~~~
& the Host localhost has a app named examples. the other Host www.jm.com has a
app named examples2.

start Tomcat,
visit http://www.jm.com:8080/examples2/test/ is ok. but i changed to visit 
http://localhost:8080/examples/test without restart tc, it didn't work.
then i traced the codes,i found that :
~~~~~~~~~~~~~~~~~~~~~~~
        if (connector.getUseIPVHosts()) {
            serverName = req.localName(); //line 624
            if (serverName.isNull()) {
                // well, they did ask for it
                res.action(ActionCode.REQ_LOCAL_NAME_ATTRIBUTE, null);
            }
        } else {
            serverName = req.serverName();
        }
~~~~~~~~~~~~~~~~~~~~~~~
at line 624 the value of serverName is still "www.jm.com" . it will still find 
the Host www.jm.com to handle with the request.but this host doesn't have the
examples app, so it can't make it.

if i annotate the "if condition" , it works.
~~~~~~~~~~~~~~~~~~~~~
if (connector.getUseIPVHosts()) {
            serverName = req.localName(); //line 624
            //if (serverName.isNull()) { 
//annotate if , execute action every time.
                // well, they did ask for it
                res.action(ActionCode.REQ_LOCAL_NAME_ATTRIBUTE, null);
            //}
        } else {
            serverName = req.serverName();
        }
~~~~~~~~~~~~~~~~~~~~

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 55186] useIPVHosts=true , incorrect to get Request.localName

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55186

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Thanks for the report. This has been fixed in trunk and 7.0.x and will be
included in 7.0.43 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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