From: "Will Lowe" <[EMAIL PROTECTED]> To: "William A. Rowe, Jr." <[EMAIL PROTECTED]> Sent: Friday, August 24, 2001 1:24 PM Subject: Re: [PATCH] fix segfaults related to ap_custom_response()
> > I'd be happy to entertain a patch if you can avoid breaking binary compatibility. > > Mr. Rowe, here's a patch that doesn't break binary compatibility (uses > r->request_config instead of adding a field to request_rec). I posted > it to the list a while back, but didn't get any response, so I > figured I'd send it to you since you're the one who took interest in it > originally. I'm still interested in it, but I'm also slaughtered with work at the moment. I'm certain this is also pertinant to 2.0 - so here is the patch again for anyone willing to look at the issues, before I get my roundtuit. Bill > 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 = >