APACHE 2.0 STATUS: -*-text-*-
-Last modified at [$Date: 2004/03/25 00:15:21 $]
+Last modified at [$Date: 2004/03/25 02:07:27 $]
Release:
server/listen.c: r1.101
+1: trawick, stoddard, rederpj
- *) Fix memory corruption problem with ap_custom_response()
- function. This turns Apache + a popular third-party module
- into a crash-a-matic :(
- include/http_core.h: r1.82
- server/core.c: r1.268
- +1: trawick, stoddard, rederpj
-
*) Limit the concurrency in 'ab' to MAX_CONCURRENCY to prevent a
segmentation fault.
support/ab.c: r1.140, r1.141
* won't actually be delivered as the response for the non-GET method.
*/
int deliver_script;
+
+ /* Custom response strings registered via ap_custom_response(),
+ * or NULL; check per-dir config if nothing found here
+ */
+ char **response_code_strings; /* from ap_custom_response(), not from
+ * ErrorDocument
+ */
} core_request_config;
/* Standard entries that are guaranteed to be accessible via
* This lets us do quick merges in merge_core_dir_configs().
*/
- char **response_code_strings;
+ char **response_code_strings; /* from ErrorDocument, not from
+ * ap_custom_response() */
/* Hostname resolution etc */
#define HOSTNAME_LOOKUP_OFF 0
char *ap_response_code_string(request_rec *r, int error_index)
{
- core_dir_config *conf;
+ core_dir_config *dirconf;
+ core_request_config *reqconf;
- conf = (core_dir_config *)ap_get_module_config(r->per_dir_config,
- &core_module);
+ /* check for string registered via ap_custom_response() first */
+ reqconf = (core_request_config *)ap_get_module_config(r->request_config,
+ &core_module);
+ if (reqconf->response_code_strings != NULL &&
+ reqconf->response_code_strings[error_index] != NULL) {
+ return reqconf->response_code_strings[error_index];
+ }
- if (conf->response_code_strings == NULL) {
- return NULL;
+ /* check for string specified via ErrorDocument */
+ dirconf = (core_dir_config *)ap_get_module_config(r->per_dir_config,
+ &core_module);
+
+ if (dirconf->response_code_strings == NULL) {
+ return NULL;
}
- return conf->response_code_strings[error_index];
+ return dirconf->response_code_strings[error_index];
}
AP_DECLARE(void) ap_custom_response(request_rec *r, int status,
const char *string)
{
- core_dir_config *conf =
- ap_get_module_config(r->per_dir_config, &core_module);
+ core_request_config *conf =
+ ap_get_module_config(r->request_config, &core_module);
int idx;
- if(conf->response_code_strings == NULL) {
+ if (conf->response_code_strings == NULL) {
conf->response_code_strings =
apr_pcalloc(r->pool,
sizeof(*conf->response_code_strings) * RESPONSE_CODES);