dougm 98/08/06 12:23:47
Modified: src CHANGES
src/include http_core.h
src/main http_core.c
Log:
API: new ap_custom_response() function for hooking into the
ErrorDocument mechanism at runtime
Submitted by: Doug MacEachern
Reviewed by: Ralf
Revision Changes Path
1.1008 +3 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1007
retrieving revision 1.1008
diff -u -r1.1007 -r1.1008
--- CHANGES 1998/08/06 19:13:50 1.1007
+++ CHANGES 1998/08/06 19:23:41 1.1008
@@ -1,5 +1,8 @@
Changes with Apache 1.3.2
+ *) API: new ap_custom_response() function for hooking into the
+ ErrorDocument mechanism at runtime [Doug MacEachern]
+
*) API: new ap_uuencode() function [Doug MacEachern]
*) API: scan_script_header_err_core() now "public" and renamed
1.46 +2 -1 apache-1.3/src/include/http_core.h
Index: http_core.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/http_core.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- http_core.h 1998/08/06 17:30:24 1.45
+++ http_core.h 1998/08/06 19:23:43 1.46
@@ -131,7 +131,8 @@
API_EXPORT(char *) ap_construct_url(pool *p, const char *uri, const
request_rec *r);
API_EXPORT(const char *) ap_get_server_name(const request_rec *r);
API_EXPORT(unsigned) ap_get_server_port(const request_rec *r);
-
+API_EXPORT(void) ap_custom_response(request_rec *r, int status, char
*string);
+
/* Authentication stuff. This is one of the places where compatibility
* with the old config files *really* hurts; they don't discriminate at
* all between different authentication schemes, meaning that we need
1.217 +20 -0 apache-1.3/src/main/http_core.c
Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -r1.216 -r1.217
--- http_core.c 1998/08/06 17:30:28 1.216
+++ http_core.c 1998/08/06 19:23:46 1.217
@@ -813,6 +813,26 @@
return NULL;
}
+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);
+ int idx;
+
+ if(conf->response_code_strings == NULL) {
+ conf->response_code_strings =
+ ap_pcalloc(r->pool,
+ sizeof(*conf->response_code_strings) *
+ RESPONSE_CODES);
+ }
+
+ idx = ap_index_of_response(status);
+
+ conf->response_code_strings[idx] =
+ ((ap_is_url(string) || (*string == '/')) && (*string != '"')) ?
+ ap_pstrdup(r->pool, string) : ap_pstrcat(r->pool, "\"", string, NULL);
+}
+
static const char *set_error_document(cmd_parms *cmd, core_dir_config *conf,
char *line)
{