Author: rjung
Date: Sat Mar 21 12:51:39 2009
New Revision: 756926

URL: http://svn.apache.org/viewvc?rev=756926&view=rev
Log:
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.

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
    tomcat/trunk/java/org/apache/jk/common/HandlerRequest.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=756926&r1=756925&r2=756926&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Sat Mar 21 
12:51:39 2009
@@ -716,6 +716,18 @@
                 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 :

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=756926&r1=756925&r2=756926&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Sat Mar 21 
12:51:39 2009
@@ -722,6 +722,18 @@
                 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 :

Modified: tomcat/trunk/java/org/apache/jk/common/HandlerRequest.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jk/common/HandlerRequest.java?rev=756926&r1=756925&r2=756926&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jk/common/HandlerRequest.java (original)
+++ tomcat/trunk/java/org/apache/jk/common/HandlerRequest.java Sat Mar 21 
12:51:39 2009
@@ -457,6 +457,18 @@
                 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) {
+                    }
+                }
             }
 
 



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

Reply via email to