
This is the patch posted to Bug #8334 in the Apache BTS.

diff -ruN -x Makefile.in -x configure -x *~ -x apache_1.3.22.orig -x ap_ctx.[ch] -x ap_hook.[ch] -x ap_mm.[ch] -x os-inline.c -x os.h apache_1.3.22.orig/src/main/http_core.c apache_1.3.22/src/main/http_core.c
--- build-tree/apache_1.3.26/src/main/http_core.c	Fri Jan 18 00:15:41 2002
+++ build-tree/apache_1.3.26/src/main/http_core.c	Fri Jan 18 00:10:45 2002
@@ -581,9 +581,16 @@
 {
     core_dir_config *conf;
 
-    conf = (core_dir_config *)ap_get_module_config(r->per_dir_config,
+    /* prefer per-request settings */
+    conf = (core_dir_config *)ap_get_module_config(r->request_config,
 						   &core_module); 
 
+    /* but if there aren't any,  try the dir config */
+    if ( conf == NULL ) {
+      conf = (core_dir_config *) ap_get_module_config(r->per_dir_config,
+                                                      &core_module);
+    }
+
     if (conf->response_code_strings == NULL) {
 	return NULL;
     }
@@ -1169,8 +1176,14 @@
 API_EXPORT(void) ap_custom_response(request_rec *r, int status, char *string)
 {
     core_dir_config *conf = 
-	ap_get_module_config(r->per_dir_config, &core_module);
+	ap_get_module_config(r->request_config, &core_module);
     int idx;
+
+    if(conf == NULL) {
+      /* if this doesn't exist,  we'll have to make one */
+      conf = (core_dir_config*) ap_pcalloc(r->pool, sizeof(core_dir_config));
+      ap_set_module_config(r->request_config, &core_module, conf);
+    }
 
     if(conf->response_code_strings == NULL) {
         conf->response_code_strings = 
