httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r448711 - in /httpd/httpd/trunk: include/httpd.h server/config.c
Date Thu, 21 Sep 2006 22:13:35 GMT
Author: niq
Date: Thu Sep 21 15:13:34 2006
New Revision: 448711

URL: http://svn.apache.org/viewvc?view=rev&rev=448711
Log:
Generic fix for PR#31759
If a handler returns a value that is neither reserved nor a valid
HTTP response code, log an error and substitute HTTP_INTERNAL_SERVER_ERROR.
Allow a handler to override this explicitly by setting a note.

Modified:
    httpd/httpd/trunk/include/httpd.h
    httpd/httpd/trunk/server/config.c

Modified: httpd/httpd/trunk/include/httpd.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/httpd.h?view=diff&rev=448711&r1=448710&r2=448711
==============================================================================
--- httpd/httpd/trunk/include/httpd.h (original)
+++ httpd/httpd/trunk/include/httpd.h Thu Sep 21 15:13:34 2006
@@ -529,6 +529,8 @@
 #define ap_is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))
 /** is the status code a server error  */
 #define ap_is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))
+/** is the status code a (potentially) valid response code?  */
+#define ap_is_HTTP_VALID_RESPONSE(x) (((x) >= 100)&&((x) < 600))
 
 /** should the status code drop the connection */
 #define ap_status_drops_connection(x) \

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?view=diff&rev=448711&r1=448710&r2=448711
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Thu Sep 21 15:13:34 2006
@@ -332,6 +332,7 @@
     const char *p;
     int result;
     const char *old_handler = r->handler;
+    const char *ignore;
 
     /*
      * The new insert_filter stage makes the most sense here.  We only use
@@ -381,6 +382,22 @@
     if (result == DECLINED && r->handler && r->filename) {
         ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
             "handler \"%s\" not found for: %s", r->handler, r->filename);
+    }
+    if ((result != OK) && (result != DONE) && (result != DECLINED)
+        && !ap_is_HTTP_VALID_RESPONSE(result)) {
+        /* If a module is deliberately returning something else
+         * (request_rec in non-HTTP or proprietary extension?)
+         * let it set a note to allow it explicitly.
+         * Otherwise, a return code that is neither reserved nor HTTP
+         * is a bug, as in PR#31759.
+         */
+        ignore = apr_table_get(r->notes, "HTTP_IGNORE_RANGE");
+        if (!ignore) {
+            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                          "Handler for %s returned invalid result code %d",
+                          r->handler, result);
+            result = HTTP_INTERNAL_SERVER_ERROR;
+        }
     }
 
     return result == DECLINED ? HTTP_INTERNAL_SERVER_ERROR : result;



Mime
View raw message