Cliff Woolley wrote: > On Mon, 5 Apr 2004, Geoffrey Young wrote: > > >> ErrorDocument 500 default >> >>in core httpd, allowing users to effectively restore the canned server >>response for the scope of the current ErrorDocument. >> >>anyway, I'm just tossing the idea out there - if people like it I'll work up >>a patch. if not, no biggie. > > > Seems reasonable to me; +1 on concept.
cool. patch and self-contained test attached. --Geoff
Index: server/core.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/core.c,v
retrieving revision 1.270
diff -u -r1.270 core.c
--- server/core.c 25 Mar 2004 14:27:27 -0000 1.270
+++ server/core.c 6 Apr 2004 04:07:23 -0000
@@ -271,9 +271,7 @@
sizeof(*conf->response_code_strings) * RESPONSE_CODES);
for (i = 0; i < RESPONSE_CODES; ++i) {
- if (new->response_code_strings[i] != NULL) {
- conf->response_code_strings[i] = new->response_code_strings[i];
- }
+ conf->response_code_strings[i] = new->response_code_strings[i];
}
}
/* Otherwise we simply use the base->response_code_strings array
@@ -1178,13 +1176,21 @@
RESPONSE_CODES);
}
- /* hack. Prefix a " if it is a msg; as that is what
- * http_protocol.c relies on to distinguish between
- * a msg and a (local) path.
- */
- conf->response_code_strings[index_number] = (what == MSG) ?
- apr_pstrcat(cmd->pool, "\"",msg,NULL) :
- apr_pstrdup(cmd->pool, msg);
+ if (strcmp(msg, "default") == 0) {
+ /* special case: ErrorDocument 404 default restores the
+ * canned server error response
+ */
+ conf->response_code_strings[index_number] = NULL;
+ }
+ else {
+ /* hack. Prefix a " if it is a msg; as that is what
+ * http_protocol.c relies on to distinguish between
+ * a msg and a (local) path.
+ */
+ conf->response_code_strings[index_number] = (what == MSG) ?
+ apr_pstrcat(cmd->pool, "\"",msg,NULL) :
+ apr_pstrdup(cmd->pool, msg);
+ }
}
return NULL;
errordoc-restore.tar.gz
Description: GNU Zip compressed data
