]> granicus.if.org Git - apache/commitdiff
Merge r1435178 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 21 Jan 2013 15:05:55 +0000 (15:05 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 21 Jan 2013 15:05:55 +0000 (15:05 +0000)
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.

Submitted by: rjung
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1436400 13f79535-47bb-0310-9956-ffa450edef68

STATUS
modules/proxy/ajp_header.c
modules/proxy/ajp_header.h

diff --git a/STATUS b/STATUS
index 240ec59b80d43cd85fb5abe0ed7f42de30434dc0..e97138fafa252af4163e2a87cc967abf54cbf9a2 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -91,16 +91,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: trunk patch works (minus docs/log-message-tags)
-    +1: rjung, covener, jim
 
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
index 3e9065141bd5d09c5430738f91670ae650dc8ee6..074f0a8d05bb8a9a1fb858cc2d76c549c882c415 100644 (file)
@@ -226,10 +226,10 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
     ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, "Into ajp_marshal_into_msgb");
 
     if ((method = sc_for_req_method_by_id(r)) == UNKNOWN_METHOD) {
-        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00967)
-               "ajp_marshal_into_msgb - No such method %s",
+        ap_log_rerror(APLOG_MARK, APLOG_TRACE8, 0, r, APLOGNO(02437)
+               "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);
@@ -404,6 +404,17 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *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_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02438)
+                          "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(),
index 18f67f121d3408041204fc63804a5d6acff7f624..22d890802c68b02d1f33fe6c264f43a50ec56b09 100644 (file)
@@ -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
 
 /*
 #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
 
 
 /*