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: [email protected]
Reporter: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]