You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rj...@apache.org on 2013/02/15 16:09:44 UTC

svn commit: r1446624 - in /httpd/httpd/branches/2.2.x: ./ CHANGES STATUS docs/ modules/proxy/ajp_header.c modules/proxy/ajp_header.h

Author: rjung
Date: Fri Feb 15 15:09:44 2013
New Revision: 1446624

URL: http://svn.apache.org/r1446624
Log:
mod_proxy_ajp: Support unknown HTTP methods.
BZ 54416

Forward unknown methods as request attributes
using method id SC_M_JK_STORED=0xFF and
request attribute id SC_A_STORED_METHOD=13.

Code ported from mod_jk (which got it from mod_jk2).

Supported by Tomcat at least since TC 4.1.
Doesn't seem to be supported by Jetty though.

Backport of r1435178 from trunk resp. r1436400
from 2.4.x.

Submitted/backported by: rjung
Reviewed by: wrowe, rpluem

Modified:
    httpd/httpd/branches/2.2.x/   (props changed)
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/docs/   (props changed)
    httpd/httpd/branches/2.2.x/modules/proxy/ajp_header.c
    httpd/httpd/branches/2.2.x/modules/proxy/ajp_header.h

Propchange: httpd/httpd/branches/2.2.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1435178

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=1446624&r1=1446623&r2=1446624&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Fri Feb 15 15:09:44 2013
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.24
 
+  *) mod_proxy_ajp: Support unknown HTTP methods. PR 54416.
+     [Rainer Jung]
+
   *) mod_dir: Add support for the value 'disabled' in FallbackResource.
      [Vincent Deffontaines]
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=1446624&r1=1446623&r2=1446624&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Fri Feb 15 15:09:44 2013
@@ -94,21 +94,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * mod_proxy_ajp: Support unknown HTTP methods. PR54416.
-     Forward unknown methods as request attributes
-     using method id SC_M_JK_STORED=0xFF and
-     request attribute id SC_A_STORED_METHOD=13.
-     Code ported from mod_jk (which got it from mod_jk2).
-     Supported by Tomcat at least since TC 4.1.
-     Doesn't seem to be supported by Jetty though.
-     trunk patch: http://svn.apache.org/r1435178
-     2.4.x patch: http://svn.apache.org/r1436400
-                  plus http://svn.apache.org/r1436436 (CHANGES)
-     2.2.x patch: http://people.apache.org/~rjung/patches/httpd-2_2_x-ajp-unknown_-methods.patch
-                  plus CHANGES
-                  Difference to 2.4.x only in logging.
-     +1: rjung, wrowe, rpluem
-
    * mod_ssl: PR 52162: log revoked certificates at level INFO instead of DEBUG
      trunk/2.4.x: Changed as part of http://svn.apache.org/viewvc?rev=1165056&view=rev
      2.2.x patch: https://issues.apache.org/bugzilla/attachment.cgi?id=27913

Propchange: httpd/httpd/branches/2.2.x/docs/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk/docs:r1435178

Modified: httpd/httpd/branches/2.2.x/modules/proxy/ajp_header.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/ajp_header.c?rev=1446624&r1=1446623&r2=1446624&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/ajp_header.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/ajp_header.c Fri Feb 15 15:09:44 2013
@@ -225,10 +225,10 @@ static apr_status_t ajp_marshal_into_msg
                          "Into ajp_marshal_into_msgb");
 
     if ((method = sc_for_req_method_by_id(r)) == UNKNOWN_METHOD) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-               "ajp_marshal_into_msgb - No such method %s",
+        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+               "ajp_marshal_into_msgb - Sending unknown method %s as request attribute",
                r->method);
-        return AJP_EBAD_METHOD;
+        method = SC_M_JK_STORED;
     }
 
     is_ssl = (apr_byte_t) ap_proxy_conn_is_https(r->connection);
@@ -403,6 +403,17 @@ static apr_status_t ajp_marshal_into_msg
             }
         }
     }
+    /* If the method was unrecognized, encode it as an attribute */
+    if (method == SC_M_JK_STORED) {
+        if (ajp_msg_append_uint8(msg, SC_A_STORED_METHOD)
+            || ajp_msg_append_string(msg, r->method)) {
+            ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+                         "ajp_marshal_into_msgb: "
+                         "Error appending the method '%s' as request attribute",
+                         r->method);
+            return AJP_EOVERFLOW;
+        }
+    }
     /* Forward the remote port information, which was forgotten
      * from the builtin data of the AJP 13 protocol.
      * Since the servlet spec allows to retrieve it via getRemotePort(),

Modified: httpd/httpd/branches/2.2.x/modules/proxy/ajp_header.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/ajp_header.h?rev=1446624&r1=1446623&r2=1446624&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/ajp_header.h (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/ajp_header.h Fri Feb 15 15:09:44 2013
@@ -41,6 +41,7 @@
 #define SC_A_REQ_ATTRIBUTE      (unsigned char)10
 #define SC_A_SSL_KEY_SIZE       (unsigned char)11       /* only in if JkOptions +ForwardKeySize */
 #define SC_A_SECRET             (unsigned char)12
+#define SC_A_STORED_METHOD      (unsigned char)13
 #define SC_A_ARE_DONE           (unsigned char)0xFF
 
 /*
@@ -111,6 +112,7 @@
 #define SC_M_MERGE              (unsigned char)25
 #define SC_M_BASELINE_CONTROL   (unsigned char)26
 #define SC_M_MKACTIVITY         (unsigned char)27
+#define SC_M_JK_STORED          (unsigned char)0xFF
 
 
 /*