You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2021/05/20 14:28:07 UTC
[tomcat] branch 9.0.x updated: Avoid using local host name when not
needed
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 7919934 Avoid using local host name when not needed
7919934 is described below
commit 7919934187980339c0148d15f95b48d655ed779d
Author: remm <re...@apache.org>
AuthorDate: Thu May 20 16:13:34 2021 +0200
Avoid using local host name when not needed
BZ65301
---
java/org/apache/catalina/valves/RemoteIpValve.java | 6 ++++--
webapps/docs/changelog.xml | 4 ++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/valves/RemoteIpValve.java b/java/org/apache/catalina/valves/RemoteIpValve.java
index 2497b01..0dbd186 100644
--- a/java/org/apache/catalina/valves/RemoteIpValve.java
+++ b/java/org/apache/catalina/valves/RemoteIpValve.java
@@ -609,7 +609,7 @@ public class RemoteIpValve extends ValveBase {
final String originalScheme = request.getScheme();
final boolean originalSecure = request.isSecure();
final String originalServerName = request.getServerName();
- final String originalLocalName = request.getLocalName();
+ final String originalLocalName = isChangeLocalName() ? request.getLocalName() : null;
final int originalServerPort = request.getServerPort();
final int originalLocalPort = request.getLocalPort();
final String originalProxiesHeader = request.getHeader(proxiesHeader);
@@ -768,7 +768,9 @@ public class RemoteIpValve extends ValveBase {
request.setSecure(originalSecure);
request.getCoyoteRequest().scheme().setString(originalScheme);
request.getCoyoteRequest().serverName().setString(originalServerName);
- request.getCoyoteRequest().localName().setString(originalLocalName);
+ if (isChangeLocalName()) {
+ request.getCoyoteRequest().localName().setString(originalLocalName);
+ }
request.setServerPort(originalServerPort);
request.setLocalPort(originalLocalPort);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e1209f8..129dda5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -108,6 +108,10 @@
<subsection name="Catalina">
<changelog>
<fix>
+ <bug>65301</bug>: <code>RemoteIpValve</code> will now avoid getting
+ the local host name when it is not needed. (remm)
+ </fix>
+ <fix>
<bug>65308</bug>: NPE in JNDIRealm when no <code>userRoleAttribute</code>
is given. (fschumacher)
</fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org