httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Lowe <ha...@thebackrow.net>
Subject Re: [PATCH] fix segfaults related to ap_custom_response()
Date Tue, 21 Aug 2001 20:25:44 GMT
> Please resend your patch without the compression.   We like our 

Oops.  Here you go.

					Will

diff -ur apache_1.3.20/src/main/http_core.c apache_1.3.20-new/src/main/http_core.c
--- apache_1.3.20/src/main/http_core.c	Fri Mar  9 02:10:25 2001
+++ apache_1.3.20-new/src/main/http_core.c	Fri Aug 17 23:27:58 2001
@@ -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;
     }
@@ -1165,8 +1172,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 = 

Mime
View raw message