httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Skolnick <cl...@steam.com>
Subject [PATCH] 500 errors not giving error-notes (related to PR #3455)
Date Mon, 25 Jan 1999 18:59:35 GMT

Here's a patch to allow apache acting as a proxy server to relay the real
reason of a failure to a client rather than the "internal server error" it
does currently.  I started to add a "ExposeErrors to" directive which would
expose more than just proxy errors to a list of IP's, but it did not seems
like a good idea after thinking about it.  If pestered I'll finish coding
and testing that mechanism.

This is a bit more of a general solution than the patch included in PR
#3455, since any module who wished to expose error-notes to all clients can
set "verbose-errors-to" to "*" at the time of setting "error-notes" rather
than changing the error status.

Cliff


Index: src/main/http_protocol.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.253
diff -u -r1.253 http_protocol.c
--- http_protocol.c	1999/01/08 17:54:41	1.253
+++ http_protocol.c	1999/01/25 10:01:37
@@ -2498,7 +2498,19 @@
                      "accepted by the server for this resource.\n", fd);
 	    break;
 	default:            /* HTTP_INTERNAL_SERVER_ERROR */
-	    ap_bvputs(fd, "The server encountered an internal error or\n"
+	    /*
+	     * This comparison to expose error-notes could be modified to
+	     * use a configuration directive and export based on that 
+	     * directive.  For now "*" is used to designate an error-notes
+	     * that is totally safe for any user to see (ie lacks paths,
+	     * database passwords, etc.)
+	     */
+	    if (((error_notes = ap_table_get(r->notes, "error-notes")) != NULL)
+		&& (strncmp(ap_table_get(r->notes, "verbose-error-to"), "*", 1)
+		    == 0)) {
+	        ap_bvputs(fd, error_notes, "<P>\n", NULL);
+	    } else {
+	        ap_bvputs(fd, "The server encountered an internal error or\n"
 	             "misconfiguration and was unable to complete\n"
 	             "your request.<P>\n"
 	             "Please contact the server administrator,\n ",
@@ -2508,6 +2520,7 @@
 	             "caused the error.<P>\n"
 		     "More information about this error may be available\n"
 		     "in the server error log.<P>\n", NULL);
+	    }
 	 /*
 	  * It would be nice to give the user the information they need to
 	  * fix the problem directly since many users don't have access to
Index: src/modules/proxy/proxy_util.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
retrieving revision 1.74
diff -u -r1.74 proxy_util.c
--- proxy_util.c	1999/01/01 19:05:03	1.74
+++ proxy_util.c	1999/01/25 10:02:07
@@ -842,6 +842,7 @@
 			     "<EM><A HREF=\"", r->uri, "\">",
 			     r->method, "&nbsp;", r->uri, "</A></EM>.<P>\n"
 			     "Reason: <STRONG>", message, "</STRONG>", NULL));
+    ap_table_setn(r->notes, "verbose-error-to", ap_pstrcat(r->pool, "*"));
     r->status_line = "500 Proxy Error";
     return HTTP_INTERNAL_SERVER_ERROR;
 }

--
Cliff Skolnick
Steam Tunnel Operations
cliff@steam.com
http://www.steam.com/




Mime
View raw message