401904 fixed getRemoteAddr to return IP instead of hostname
This commit is contained in:
parent
41f7df18a6
commit
3bc0411e65
|
@ -702,7 +702,12 @@ public class Request implements HttpServletRequest
|
||||||
public String getLocalAddr()
|
public String getLocalAddr()
|
||||||
{
|
{
|
||||||
InetSocketAddress local=_channel.getLocalAddress();
|
InetSocketAddress local=_channel.getLocalAddress();
|
||||||
return local.getAddress().getHostAddress();
|
if (local==null)
|
||||||
|
return "";
|
||||||
|
InetAddress address = local.getAddress();
|
||||||
|
if (address==null)
|
||||||
|
return local.getHostString();
|
||||||
|
return address.getHostAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -919,7 +924,14 @@ public class Request implements HttpServletRequest
|
||||||
if (remote==null)
|
if (remote==null)
|
||||||
remote=_channel.getRemoteAddress();
|
remote=_channel.getRemoteAddress();
|
||||||
|
|
||||||
return remote==null?"":remote.getHostString();
|
if (remote==null)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
InetAddress address = remote.getAddress();
|
||||||
|
if (address==null)
|
||||||
|
return remote.getHostString();
|
||||||
|
|
||||||
|
return address.getHostAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
Loading…
Reference in New Issue