tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r757223 - in /tomcat/trunk/java/org/apache: coyote/ajp/AjpAprProcessor.java coyote/ajp/AjpProcessor.java coyote/ajp/Constants.java jk/common/AjpConstants.java jk/common/HandlerRequest.java
Date Sun, 22 Mar 2009 17:55:36 GMT
Author: rjung
Date: Sun Mar 22 17:55:35 2009
New Revision: 757223

URL: http://svn.apache.org/viewvc?rev=757223&view=rev
Log:
Followup to r756926 (forward remote port via AJP13).
- Use a more private attribute name and
  define it in the Constants class.
- Do not set the attribute on the request,
  only use it for 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/coyote/ajp/Constants.java
    tomcat/trunk/java/org/apache/jk/common/AjpConstants.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=757223&r1=757222&r2=757223&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Sun Mar 22 17:55:35 2009
@@ -715,18 +715,20 @@
                 String n = tmpMB.toString();
                 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.
+                 * Allow the AJP connector to add this info via
+                 * a private request attribute.
+                 * We will accept the forwarded data as the remote port,
+                 * and remove it from the public list of request attributes.
                  */
-                if(n.equals("REMOTE_PORT")) {
+                if(n.equals(Constants.SC_A_REQ_REMOTE_PORT)) {
                     try {
                         request.setRemotePort(Integer.parseInt(v));
                     } catch (NumberFormatException nfe) {
                     }
+                } else {
+                    request.setAttribute(n, v);
                 }
                 break;
 

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=757223&r1=757222&r2=757223&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Sun Mar 22 17:55:35 2009
@@ -721,18 +721,20 @@
                 String n = tmpMB.toString();
                 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.
+                 * Allow the AJP connector to add this info via
+                 * a private request attribute.
+                 * We will accept the forwarded data as the remote port,
+                 * and remove it from the public list of request attributes.
                  */
-                if(n.equals("REMOTE_PORT")) {
+                if(n.equals(Constants.SC_A_REQ_REMOTE_PORT)) {
                     try {
                         request.setRemotePort(Integer.parseInt(v));
                     } catch (NumberFormatException nfe) {
                     }
+                } else {
+                    request.setAttribute(n, v );
                 }
                 break;
 

Modified: tomcat/trunk/java/org/apache/coyote/ajp/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/Constants.java?rev=757223&r1=757222&r2=757223&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/Constants.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/Constants.java Sun Mar 22 17:55:35 2009
@@ -88,6 +88,11 @@
     // Used for attributes which are not in the list above
     public static final byte SC_A_REQ_ATTRIBUTE = 10;
 
+    /**
+     * AJP private request attributes
+     */
+    public static final String SC_A_REQ_REMOTE_PORT = "AJP_REMOTE_PORT";
+
     // Terminates list of attributes
     public static final byte SC_A_ARE_DONE      = (byte)0xFF;
 

Modified: tomcat/trunk/java/org/apache/jk/common/AjpConstants.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jk/common/AjpConstants.java?rev=757223&r1=757222&r2=757223&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jk/common/AjpConstants.java (original)
+++ tomcat/trunk/java/org/apache/jk/common/AjpConstants.java Sun Mar 22 17:55:35 2009
@@ -97,6 +97,11 @@
     public static final byte SC_A_REQ_ATTRIBUTE = 10; 
 
     /**
+     * AJP private request attributes
+     */
+    public static final String SC_A_REQ_REMOTE_PORT = "AJP_REMOTE_PORT";
+
+    /**
      * Terminates list of attributes
      */
     public static final byte SC_A_ARE_DONE      = (byte)0xFF;

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=757223&r1=757222&r2=757223&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jk/common/HandlerRequest.java (original)
+++ tomcat/trunk/java/org/apache/jk/common/HandlerRequest.java Sun Mar 22 17:55:35 2009
@@ -454,20 +454,22 @@
                 String n=tmpMB.toString();
                 msg.getBytes( tmpMB );
                 String v=tmpMB.toString();
-                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.
+                 * Allow the AJP connector to add this info via
+                 * a private request attribute.
+                 * We will accept the forwarded data as the remote port,
+                 * and remove it from the public list of request attributes.
                  */
-                if(n.equals("REMOTE_PORT")) {
+                if(n.equals(AjpConstants.SC_A_REQ_REMOTE_PORT)) {
                     try {
                         req.setRemotePort(Integer.parseInt(v));
                     } catch (NumberFormatException nfe) {
                     }
+                } else {
+                    req.setAttribute(n, v );
+                    if(log.isTraceEnabled())
+                        log.trace("jk Attribute set " + n + "=" + v);
                 }
             }
 



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


Mime
View raw message