You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mt...@apache.org on 2005/04/09 10:37:08 UTC

svn commit: r160668 - httpd/httpd/trunk/modules/proxy/ajp.h httpd/httpd/trunk/modules/proxy/ajp_header.c

Author: mturk
Date: Sat Apr  9 01:37:06 2005
New Revision: 160668

URL: http://svn.apache.org/viewcvs?view=rev&rev=160668
Log:
Return 'real' error status codes instead APR_EGENERAL.
The return status code will be used to determine wether
the message is invalid or the remote host failed processing
the request. This is needed to mark the worker as in
error state in case it is member of load balancer.

Modified:
    httpd/httpd/trunk/modules/proxy/ajp.h
    httpd/httpd/trunk/modules/proxy/ajp_header.c

Modified: httpd/httpd/trunk/modules/proxy/ajp.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/ajp.h?view=diff&r1=160667&r2=160668
==============================================================================
--- httpd/httpd/trunk/modules/proxy/ajp.h (original)
+++ httpd/httpd/trunk/modules/proxy/ajp.h Sat Apr  9 01:37:06 2005
@@ -103,6 +103,9 @@
 #define AJP_EBAD_MESSAGE        (APR_OS_START_USERERR + 8) 
 /** Cant log via AJP14 */
 #define AJP_ELOGFAIL            (APR_OS_START_USERERR + 9) 
+/** Bad request method */
+#define AJP_EBAD_METHOD         (APR_OS_START_USERERR + 10) 
+
 
 /** A structure that represents ajp message */ 
 typedef struct ajp_msg ajp_msg_t;

Modified: httpd/httpd/trunk/modules/proxy/ajp_header.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/ajp_header.c?view=diff&r1=160667&r2=160668
==============================================================================
--- httpd/httpd/trunk/modules/proxy/ajp_header.c (original)
+++ httpd/httpd/trunk/modules/proxy/ajp_header.c Sat Apr  9 01:37:06 2005
@@ -220,9 +220,9 @@
 
     if ((method = sc_for_req_method_by_id(r->method_number)) == UNKNOWN_METHOD) { 
         ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-               "Error ajp_marshal_into_msgb - No such method %s",
+               "ajp_marshal_into_msgb - No such method %s",
                r->method);
-        return APR_EGENERAL;
+        return AJP_EBAD_METHOD;
     }
 
     /* XXXX need something */
@@ -249,7 +249,7 @@
         ajp_msg_append_uint16(msg, (apr_uint16_t) num_headers)) {
 
         ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-               "Error ajp_marshal_into_msgb - "
+               "ajp_marshal_into_msgb: "
                "Error appending the message begining");
         return APR_EGENERAL;
     }
@@ -262,25 +262,25 @@
         if ((sc = sc_for_req_header(elts[i].key)) != UNKNOWN_METHOD) {
             if (ajp_msg_append_uint16(msg, (apr_uint16_t)sc)) {
                 ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                       "Error ajp_marshal_into_msgb - "
+                       "ajp_marshal_into_msgb: "
                        "Error appending the header name");
-                return APR_EGENERAL;
+                return AJP_EOVERFLOW;
             }
         }
         else {
             if (ajp_msg_append_string(msg, elts[i].key)) {
                 ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                       "Error ajp_marshal_into_msgb - "
+                       "ajp_marshal_into_msgb: "
                        "Error appending the header name");
-                return APR_EGENERAL;
+                return AJP_EOVERFLOW;
             }
         }
         
         if (ajp_msg_append_string(msg, elts[i].val)) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                   "Error ajp_marshal_into_msgb - "
+                   "ajp_marshal_into_msgb: "
                    "Error appending the header value");
-            return APR_EGENERAL;
+            return AJP_EOVERFLOW;
         }
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                    "ajp_marshal_into_msgb: Header[%d] [%s] = [%s]",
@@ -303,18 +303,18 @@
         if (ajp_msg_append_uint8(msg, SC_A_REMOTE_USER) ||
             ajp_msg_append_string(msg, r->user)) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                   "Error ajp_marshal_into_msgb - "
+                   "ajp_marshal_into_msgb: "
                    "Error appending the remote user");
-            return APR_EGENERAL;
+            return AJP_EOVERFLOW;
         }
     }
     if (r->ap_auth_type) {
         if (ajp_msg_append_uint8(msg, SC_A_AUTH_TYPE) ||
             ajp_msg_append_string(msg, r->ap_auth_type)) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                   "Error ajp_marshal_into_msgb - "
+                   "ajp_marshal_into_msgb: "
                    "Error appending the auth type");
-            return APR_EGENERAL;
+            return AJP_EOVERFLOW;
         }
     }
     /* XXXX  ebcdic (args converted?) */
@@ -322,18 +322,18 @@
         if (ajp_msg_append_uint8(msg, SC_A_QUERY_STRING) ||
             ajp_msg_append_string(msg, uri->query)) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                   "Error ajp_marshal_into_msgb - "
+                   "ajp_marshal_into_msgb: "
                    "Error appending the query string");
-            return APR_EGENERAL;
+            return AJP_EOVERFLOW;
         }
     }
     if ((session_route = apr_table_get(r->notes, "session-route"))) {
         if (ajp_msg_append_uint8(msg, SC_A_JVM_ROUTE) ||
             ajp_msg_append_string(msg, session_route)) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                   "Error ajp_marshal_into_msgb - "
+                   "ajp_marshal_into_msgb: "
                    "Error appending the jvm route");
-            return APR_EGENERAL;
+            return AJP_EOVERFLOW;
         }
     }
 /* XXX: Is the subprocess_env a right place?
@@ -347,9 +347,9 @@
         if (ajp_msg_append_uint8(msg, SC_A_SSL_CERT) ||
             ajp_msg_append_string(msg, envvar)) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                   "Error ajp_marshal_into_msgb - "
+                   "ajp_marshal_into_msgb: "
                    "Error appending the SSL certificates");
-            return APR_EGENERAL;
+            return AJP_EOVERFLOW;
         }
     }
 
@@ -358,9 +358,9 @@
         if (ajp_msg_append_uint8(msg, SC_A_SSL_CIPHER) ||
             ajp_msg_append_string(msg, envvar)) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                   "Error ajp_marshal_into_msgb - "
+                   "ajp_marshal_into_msgb: "
                    "Error appending the SSL ciphers");
-            return APR_EGENERAL;
+            return AJP_EOVERFLOW;
         }
     }
 
@@ -369,9 +369,9 @@
         if (ajp_msg_append_uint8(msg, SC_A_SSL_SESSION) ||
             ajp_msg_append_string(msg, envvar)) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                   "Error ajp_marshal_into_msgb - "
+                   "ajp_marshal_into_msgb: "
                    "Error appending the SSL session");
-            return APR_EGENERAL;
+            return AJP_EOVERFLOW;
         }
     }
 
@@ -400,23 +400,23 @@
                 ajp_msg_append_string(msg, elts[i].key + 4)   ||
                 ajp_msg_append_string(msg, elts[i].val)) {
                 ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                        "Error ajp_marshal_into_msgb - "
+                        "ajp_marshal_into_msgb: "
                         "Error appending attribute %s=%s",
                         elts[i].key, elts[i].val);
-                return APR_EGENERAL;
+                return AJP_EOVERFLOW;
             }
         }
     }
 
     if (ajp_msg_append_uint8(msg, SC_A_ARE_DONE)) {
         ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-               "Error ajp_marshal_into_msgb - "
+               "ajp_marshal_into_msgb: "
                "Error appending the message end");
-        return APR_EGENERAL;
+        return AJP_EOVERFLOW;
     }
 
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
-           "ajp_marshal_into_msgb - Done");
+            "ajp_marshal_into_msgb: Done");
     return APR_SUCCESS;
 }
 
@@ -460,8 +460,8 @@
 
     if (rc != APR_SUCCESS) {
          ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-               "Error ajp_unmarshal_response - Null status");
-        return APR_EGENERAL;
+                "ajp_unmarshal_response: Null status");
+        return rc;
     }
     r->status = status;
 
@@ -496,7 +496,7 @@
         const char *value;
         rc  = ajp_msg_peek_uint16(msg, &name);
         if (rc != APR_SUCCESS) {
-            return APR_EGENERAL;
+            return rc;
         }
                 
         if ((name & 0XFF00) == 0XA000) {
@@ -504,19 +504,19 @@
             stringname = long_res_header_for_sc(name);
             if (stringname == NULL) {
                 ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                       "Error ajp_unmarshal_response - "
+                       "ajp_unmarshal_response: "
                        "No such sc (%08x)",
                        name);
-                return APR_EGENERAL;
+                return AJP_EBAD_HEADER;
             }
         } else {
             name = 0;
             rc = ajp_msg_get_string(msg, &stringname);
             if (rc != APR_SUCCESS) {
                 ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                       "Error ajp_unmarshal_response - "
+                       "ajp_unmarshal_response: "
                        "Null header name");
-                return APR_EGENERAL;
+                return rc;
             }
 #if defined(AS400) || defined(_OSD_POSIX)
             ap_xlate_proto_from_ascii(stringname, strlen(stringname));
@@ -526,9 +526,9 @@
         rc = ajp_msg_get_string(msg, &value);
         if (rc != APR_SUCCESS) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                   "Error ajp_unmarshal_response - "
+                   "ajp_unmarshal_response: "
                    "Null header value");
-            return APR_EGENERAL;
+            return rc;
         }
 
         /* Set-Cookie need additional processing */
@@ -655,7 +655,7 @@
     if (result != CMD_AJP13_SEND_HEADERS) {
         ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                "ajp_parse_headers: wrong type %02x expecting 0x04", result);
-        return APR_EGENERAL;
+        return AJP_EBAD_HEADER;
     }
     return ajp_unmarshal_response(msg, r, conf);
 }
@@ -676,11 +676,11 @@
     if (result != CMD_AJP13_SEND_BODY_CHUNK) {
         ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                "ajp_parse_data: wrong type %02x expecting 0x03", result);
-        return APR_EGENERAL;
+        return AJP_EBAD_HEADER;
     }
     rc = ajp_msg_get_uint16(msg, len);
     if (rc != APR_SUCCESS) {
-        return APR_EGENERAL;
+        return rc;
     }
     *ptr = (char *)&(msg->buf[msg->pos]);
     return APR_SUCCESS;