From: rjung Date: Sat, 21 Mar 2009 12:51:39 +0000 (+0000) Subject: AJP13 misses to forward the remotePort. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f30f066a9d2be2b7165f8742bfab5a329900f5af;p=tomcat7.0 AJP13 misses to forward the remotePort. Apache automatically sets the env variable REMOTE_PORT to the remote port. Allow the user to set "JkEnvVar REMOTE_PORT" and let us accept the port in the forwarded attribute as the remote port. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@756926 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/coyote/ajp/AjpAprProcessor.java b/java/org/apache/coyote/ajp/AjpAprProcessor.java index 14bcd9fcf..560b45711 100644 --- a/java/org/apache/coyote/ajp/AjpAprProcessor.java +++ b/java/org/apache/coyote/ajp/AjpAprProcessor.java @@ -716,6 +716,18 @@ public class AjpAprProcessor implements ActionHook { requestHeaderMessage.getBytes(tmpMB); String v = tmpMB.toString(); request.setAttribute(n, v); + /* + * AJP13 misses to forward the remotePort. + * Apache automatically sets REMOTE_PORT to the remote port. + * Allow the user to set "JkEnvVar REMOTE_PORT" and + * let us accept the forwarded port as the remote port. + */ + if(n.equals("REMOTE_PORT")) { + try { + request.setRemotePort(Integer.parseInt(v)); + } catch (NumberFormatException nfe) { + } + } break; case Constants.SC_A_CONTEXT : diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java b/java/org/apache/coyote/ajp/AjpProcessor.java index ba2b8810f..f4e20b35f 100644 --- a/java/org/apache/coyote/ajp/AjpProcessor.java +++ b/java/org/apache/coyote/ajp/AjpProcessor.java @@ -722,6 +722,18 @@ public class AjpProcessor implements ActionHook { requestHeaderMessage.getBytes(tmpMB); String v = tmpMB.toString(); request.setAttribute(n, v); + /* + * AJP13 misses to forward the remotePort. + * Apache automatically sets REMOTE_PORT to the remote port. + * Allow the user to set "JkEnvVar REMOTE_PORT" and + * let us accept the forwarded port as the remote port. + */ + if(n.equals("REMOTE_PORT")) { + try { + request.setRemotePort(Integer.parseInt(v)); + } catch (NumberFormatException nfe) { + } + } break; case Constants.SC_A_CONTEXT : diff --git a/java/org/apache/jk/common/HandlerRequest.java b/java/org/apache/jk/common/HandlerRequest.java index 15a174d16..0810e7dca 100644 --- a/java/org/apache/jk/common/HandlerRequest.java +++ b/java/org/apache/jk/common/HandlerRequest.java @@ -457,6 +457,18 @@ public class HandlerRequest extends JkHandler req.setAttribute(n, v ); if(log.isTraceEnabled()) log.trace("jk Attribute set " + n + "=" + v); + /* + * AJP13 misses to forward the remotePort. + * Apache automatically sets REMOTE_PORT to the remote port. + * Allow the user to set "JkEnvVar REMOTE_PORT" and + * let us accept the forwarded port as the remote port. + */ + if(n.equals("REMOTE_PORT")) { + try { + req.setRemotePort(Integer.parseInt(v)); + } catch (NumberFormatException nfe) { + } + } }