I missed a couple of files (notably mod_rewrite.c) in the original patch.
Here is an updated version.
--Brian
Index: include/httpd.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/include/httpd.h,v
retrieving revision 1.165
diff -u -r1.165 httpd.h
--- include/httpd.h 2001/09/14 23:30:41 1.165
+++ include/httpd.h 2001/09/16 23:42:13
@@ -733,9 +733,6 @@
* The difference between headers_out and err_headers_out is that the
* latter are printed even on error, and persist across internal redirects
* (so the headers printed for ErrorDocument handlers will have them).
- *
- * The 'notes' apr_table_t is for notes from one module to another, with no
- * other set purpose in mind...
*/
/** MIME header environment from the request */
@@ -747,8 +744,6 @@
apr_table_t *err_headers_out;
/** Array of environment variables to be used for sub processes */
apr_table_t *subprocess_env;
- /** Notes from one module to another */
- apr_table_t *notes;
/* content_type, handler, content_encoding, content_language, and all
* content_languages MUST be lowercased strings. They may be pointers
Index: modules/dav/main/mod_dav.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/dav/main/mod_dav.c,v
retrieving revision 1.60
diff -u -r1.60 mod_dav.c
--- modules/dav/main/mod_dav.c 2001/08/23 19:00:07 1.60
+++ modules/dav/main/mod_dav.c 2001/09/16 23:42:16
@@ -526,7 +526,7 @@
if (response == NULL) {
/* our error messages are safe; tell Apache this */
- apr_table_setn(r->notes, "verbose-error-to", "*");
+ apr_pool_userdata_set("*", "verbose-error-to", NULL, r->pool);
return err->status;
}
Index: modules/generators/mod_cgi.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/generators/mod_cgi.c,v
retrieving revision 1.103
diff -u -r1.103 mod_cgi.c
--- modules/generators/mod_cgi.c 2001/08/27 20:25:42 1.103
+++ modules/generators/mod_cgi.c 2001/09/16 23:42:17
@@ -122,8 +122,10 @@
static int is_scriptaliased(request_rec *r)
{
- const char *t = apr_table_get(r->notes, "alias-forced-type");
- return t && (!strcasecmp(t, "cgi-script"));
+ const char *t;
+ return (apr_pool_userdata_get((void **)&t, "alias-forced-type",
+ r->pool) == APR_SUCCESS)
+ && t && (!strcasecmp(t, "cgi-script"));
}
/* Configuration stuff */
Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.361
diff -u -r1.361 http_protocol.c
--- modules/http/http_protocol.c 2001/09/02 03:21:47 1.361
+++ modules/http/http_protocol.c 2001/09/16 23:42:19
@@ -1626,7 +1626,8 @@
{
const char *notes, *result;
- if ((notes = apr_table_get(r->notes, key)) == NULL) {
+ if ((apr_pool_userdata_get((void**)¬es, key, r->pool) != APR_SUCCESS)
+ || !notes) {
result = apr_pstrcat(r->pool, prefix, suffix, NULL);
}
else {
@@ -1818,8 +1819,12 @@
* that is totally safe for any user to see (ie lacks paths,
* database passwords, etc.)
*/
- if (((error_notes = apr_table_get(r->notes, "error-notes")) != NULL)
- && (h1 = apr_table_get(r->notes, "verbose-error-to")) != NULL
+ if ((apr_pool_userdata_get((void **)&error_notes, "error_notes",
+ r->pool) == APR_SUCCESS)
+ && error_notes
+ && (apr_pool_userdata_get((void **)&h1, "verbose-error-to",
+ r->pool) == APR_SUCCESS)
+ && h1
&& (strcmp(h1, "*") == 0)) {
return(apr_pstrcat(p, error_notes, "<p />\n", NULL));
}
Index: modules/http/http_request.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_request.c,v
retrieving revision 1.113
diff -u -r1.113 http_request.c
--- modules/http/http_request.c 2001/08/31 03:49:42 1.113
+++ modules/http/http_request.c 2001/09/16 23:42:19
@@ -204,8 +204,12 @@
* more informative (than the plain canned) messages to us.
* Propagate them to ErrorDocuments via the ERROR_NOTES variable:
*/
- if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
- apr_table_setn(r->subprocess_env, "ERROR_NOTES", error_notes);
+ if (APR_STATUS_IS_SUCCESS(apr_pool_userdata_get((void **)&error_notes,
+ "error-notes",
+ r->pool))
+ && error_notes) {
+ apr_pool_userdata_set(error_notes, "error-notes", NULL,
+ r->pool);
}
r->method = apr_pstrdup(r->pool, "GET");
r->method_number = M_GET;
@@ -373,7 +377,6 @@
new->headers_out = apr_table_make(r->pool, 12);
new->err_headers_out = r->err_headers_out;
new->subprocess_env = rename_original_env(r->pool, r->subprocess_env);
- new->notes = apr_table_make(r->pool, 5);
new->allowed_methods = ap_make_method_list(new->pool, 2);
new->htaccess = r->htaccess;
@@ -424,7 +427,7 @@
r->finfo = rr->finfo;
r->per_dir_config = rr->per_dir_config;
/* copy output headers from subrequest, but leave negotiation headers */
- r->notes = apr_table_overlay(r->pool, rr->notes, r->notes);
+ apr_pool_userdata_overlay(r->pool, rr->pool);
r->headers_out = apr_table_overlay(r->pool, rr->headers_out,
r->headers_out);
r->err_headers_out = apr_table_overlay(r->pool, rr->err_headers_out,
Index: modules/http/mod_mime.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/mod_mime.c,v
retrieving revision 1.63
diff -u -r1.63 mod_mime.c
--- modules/http/mod_mime.c 2001/09/08 05:50:12 1.63
+++ modules/http/mod_mime.c 2001/09/16 23:42:20
@@ -814,8 +814,8 @@
* skip the notes to alert mod_negotiation we are clueless.
*/
if (found_metadata) {
- apr_table_setn(r->notes, "ap-mime-exceptions-list",
- (void *)exception_list);
+ apr_pool_userdata_set((void *)exception_list,
+ "ap-mime-exceptions-list", NULL, r->pool);
}
if (r->content_type) {
Index: modules/loggers/mod_log_config.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/loggers/mod_log_config.c,v
retrieving revision 1.68
diff -u -r1.68 mod_log_config.c
--- modules/loggers/mod_log_config.c 2001/08/27 20:50:01 1.68
+++ modules/loggers/mod_log_config.c 2001/09/16 23:42:21
@@ -196,6 +196,7 @@
#include "http_core.h" /* For REMOTE_NAME */
#include "http_log.h"
#include "http_protocol.h"
+#include "util_time.h"
#if APR_HAVE_UNISTD_H
#include <unistd.h>
@@ -417,7 +418,13 @@
static const char *log_note(request_rec *r, char *a)
{
- return apr_table_get(r->notes, a);
+ void* data;
+ if (apr_pool_userdata_get(&data, a, r->pool) != APR_SUCCESS) {
+ return NULL;
+ }
+ else {
+ return (const char*)data;
+ }
}
static const char *log_env_var(request_rec *r, char *a)
{
Index: modules/mappers/mod_alias.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_alias.c,v
retrieving revision 1.31
diff -u -r1.31 mod_alias.c
--- modules/mappers/mod_alias.c 2001/08/23 18:49:55 1.31
+++ modules/mappers/mod_alias.c 2001/09/16 23:42:21
@@ -372,7 +372,8 @@
if (found) {
if (p->handler) { /* Set handler, and leave a note for mod_cgi */
r->handler = p->handler;
- apr_table_setn(r->notes, "alias-forced-type", r->handler);
+ apr_pool_userdata_set(r->handler, "alias-forced-type",
+ NULL, r->pool);
}
/* XXX This is as SLOW as can be, next step, we optimize
* and merge to whatever part of the found path was already
Index: modules/mappers/mod_dir.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_dir.c,v
retrieving revision 1.34
diff -u -r1.34 mod_dir.c
--- modules/mappers/mod_dir.c 2001/08/23 21:05:42 1.34
+++ modules/mappers/mod_dir.c 2001/09/16 23:42:21
@@ -203,7 +203,7 @@
apr_pool_join(r->pool, rr->pool);
error_notfound = rr->status;
- r->notes = apr_table_overlay(r->pool, r->notes, rr->notes);
+ apr_pool_userdata_overlay(r->pool, rr->pool);
r->headers_out = apr_table_overlay(r->pool, r->headers_out,
rr->headers_out);
r->err_headers_out = apr_table_overlay(r->pool, r->err_headers_out,
Index: modules/mappers/mod_negotiation.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_negotiation.c,v
retrieving revision 1.81
diff -u -r1.81 mod_negotiation.c
--- modules/mappers/mod_negotiation.c 2001/08/30 13:37:16 1.81
+++ modules/mappers/mod_negotiation.c 2001/09/16 23:42:23
@@ -1091,11 +1091,10 @@
* it's an insignificant file (e.g. did not identify a
* language, charset, encoding, content type or handler,)
*/
- exception_list =
- (apr_array_header_t *)apr_table_get(sub_req->notes,
- "ap-mime-exceptions-list");
-
- if (!exception_list) {
+ if ((apr_pool_userdata_get((void **)&exception_list,
+ "ap-mime-exceptions-list",
+ sub_req->pool) != APR_SUCCESS)
+ || !exception_list) {
ap_destroy_sub_req(sub_req);
continue;
}
@@ -2476,11 +2475,12 @@
static void store_variant_list(request_rec *r, negotiation_state *neg)
{
if (r->main == NULL) {
- apr_table_setn(r->notes, "variant-list", make_variant_list(r, neg));
+ apr_pool_userdata_set(make_variant_list(r, neg), "variant-list",
+ NULL, r->pool);
}
else {
- apr_table_setn(r->main->notes, "variant-list",
- make_variant_list(r->main, neg));
+ apr_pool_userdata_set(make_variant_list(r->main, neg), "variant-list",
+ NULL, r->main->pool);
}
}
Index: modules/mappers/mod_rewrite.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_rewrite.c,v
retrieving revision 1.82
diff -u -r1.82 mod_rewrite.c
--- modules/mappers/mod_rewrite.c 2001/08/15 21:11:58 1.82
+++ modules/mappers/mod_rewrite.c 2001/09/16 23:42:26
@@ -1296,8 +1296,8 @@
const char *t;
/* now check if we have to force a MIME-type */
- t = apr_table_get(r->notes, REWRITE_FORCED_MIMETYPE_NOTEVAR);
- if (t == NULL) {
+ if ((apr_pool_userdata_get((void **)&t, REWRITE_FORCED_MIMETYPE_NOTEVAR,
+ r->pool) != APR_SUCCESS) || !t) {
return DECLINED;
}
else {
@@ -1871,7 +1871,7 @@
/* One condition is false, but another can be
* still true, so we have to continue...
*/
- apr_table_unset(r->notes, VARY_KEY_THIS);
+ apr_pool_userdata_set(NULL, VARY_KEY_THIS, NULL, r->pool);
continue;
}
else {
@@ -1897,16 +1897,25 @@
break;
}
}
- vary = apr_table_get(r->notes, VARY_KEY_THIS);
- if (vary != NULL) {
- apr_table_merge(r->notes, VARY_KEY, vary);
- apr_table_unset(r->notes, VARY_KEY_THIS);
+ if ((apr_pool_userdata_get((void **)&vary, VARY_KEY_THIS, r->pool) !=
+ APR_SUCCESS) || !vary) {
+ char *old_vary;
+ if ((apr_pool_userdata_get((void **)&old_vary, VARY_KEY, r->pool)
+ != APR_SUCCESS) || !old_vary) {
+ apr_pool_userdata_set(vary, VARY_KEY, NULL, r->pool);
+ }
+ else {
+ apr_pool_userdata_set(apr_pstrcat(r->pool, old_vary, ", ",
+ vary),
+ VARY_KEY, NULL, r->pool);
+ }
+ apr_pool_userdata_set(NULL, VARY_KEY_THIS, NULL, r->pool);
}
}
/* if any condition fails the complete rule fails */
if (failed) {
- apr_table_unset(r->notes, VARY_KEY);
- apr_table_unset(r->notes, VARY_KEY_THIS);
+ apr_pool_userdata_set(NULL, VARY_KEY, NULL, r->pool);
+ apr_pool_userdata_set(NULL, VARY_KEY_THIS, NULL, r->pool);
return 0;
}
@@ -1915,9 +1924,10 @@
* if any of the request header fields were involved, and add them
* to the Vary field of the response.
*/
- if ((vary = apr_table_get(r->notes, VARY_KEY)) != NULL) {
+ if ((apr_pool_userdata_get((void **)&vary, VARY_KEY, r->pool) ==
+ APR_SUCCESS) && vary) {
apr_table_merge(r->headers_out, "Vary", vary);
- apr_table_unset(r->notes, VARY_KEY);
+ apr_pool_userdata_set(NULL, VARY_KEY, NULL, r->pool);
}
/*
@@ -1936,8 +1946,9 @@
*/
rewritelog(r, 2, "remember %s to have MIME-type '%s'",
r->filename, p->forced_mimetype);
- apr_table_setn(r->notes, REWRITE_FORCED_MIMETYPE_NOTEVAR,
- p->forced_mimetype);
+ apr_pool_userdata_set(p->forced_mimetype,
+ REWRITE_FORCED_MIMETYPE_NOTEVAR,
+ NULL, r->pool);
}
else {
/* In per-directory context we operate in the Fixup API hook
@@ -2092,8 +2103,8 @@
* already processed) because a sub-request happens ;-)
*/
if (p->forced_mimetype != NULL) {
- apr_table_setn(r->notes, REWRITE_FORCED_MIMETYPE_NOTEVAR,
- p->forced_mimetype);
+ apr_pool_userdata_set(p->forced_mimetype,
+ REWRITE_FORCED_MIMETYPE_NOTEVAR, NULL, r->pool);
if (perdir == NULL) {
rewritelog(r, 2, "remember %s to have MIME-type '%s'",
r->filename, p->forced_mimetype);
@@ -3558,7 +3569,8 @@
/* all other env-variables from the parent Apache process */
else if (strlen(var) > 4 && strncasecmp(var, "ENV:", 4) == 0) {
/* first try the internal Apache notes structure */
- result = apr_table_get(r->notes, var+4);
+ result = NULL;
+ apr_pool_userdata_get((void **)&result, var+4, r->pool);
/* second try the internal Apache env structure */
if (result == NULL) {
result = apr_table_get(r->subprocess_env, var+4);
@@ -3638,7 +3650,16 @@
continue;
}
if (strcasecmp(hdrs[i].key, name) == 0) {
- apr_table_merge(r->notes, VARY_KEY_THIS, name);
+ char *old_vary;
+ if ((apr_pool_userdata_get((void **)&old_vary, VARY_KEY, r->pool)
+ != APR_SUCCESS) || !old_vary) {
+ apr_pool_userdata_set(name, VARY_KEY, NULL, r->pool);
+ }
+ else {
+ apr_pool_userdata_set(apr_pstrcat(r->pool, old_vary, ", ",
+ name),
+ VARY_KEY, NULL, r->pool);
+ }
return hdrs[i].val;
}
}
Index: modules/mappers/mod_rewrite.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_rewrite.h,v
retrieving revision 1.25
diff -u -r1.25 mod_rewrite.h
--- modules/mappers/mod_rewrite.h 2001/05/18 18:38:42 1.25
+++ modules/mappers/mod_rewrite.h 2001/09/16 23:42:26
@@ -124,7 +124,7 @@
#include "http_vhost.h"
/*
- * The key in the r->notes apr_table_t wherein we store our accumulated
+ * The key in the r->pool userdata wherein we store our accumulated
* Vary values, and the one used for per-condition checks in a chain.
*/
#define VARY_KEY "rewrite-Vary"
Index: modules/mappers/mod_speling.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_speling.c,v
retrieving revision 1.32
diff -u -r1.32 mod_speling.c
--- modules/mappers/mod_speling.c 2001/02/16 04:26:40 1.32
+++ modules/mappers/mod_speling.c 2001/09/16 23:42:27
@@ -445,7 +445,6 @@
*/
else {
apr_pool_t *p;
- apr_table_t *notes;
apr_pool_t *sub_pool;
apr_array_header_t *t;
apr_array_header_t *v;
@@ -453,11 +452,9 @@
if (r->main == NULL) {
p = r->pool;
- notes = r->notes;
}
else {
p = r->main->pool;
- notes = r->main->notes;
}
if (apr_pool_create(&sub_pool, p) != APR_SUCCESS)
@@ -533,7 +530,8 @@
/* Pass our apr_table_t to http_protocol.c (see mod_negotiation): */
- apr_table_setn(notes, "variant-list", apr_array_pstrcat(p, t, 0));
+ apr_pool_userdata_set(apr_array_pstrcat(p, t, 0), "variant-list",
+ NULL, p);
apr_table_mergen(r->subprocess_env, "VARIANTS",
apr_array_pstrcat(p, v, ','));
Index: modules/mappers/mod_userdir.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_userdir.c,v
retrieving revision 1.40
diff -u -r1.40 mod_userdir.c
--- modules/mappers/mod_userdir.c 2001/09/07 14:52:00 1.40
+++ modules/mappers/mod_userdir.c 2001/09/16 23:42:27
@@ -345,7 +345,7 @@
r->finfo = statbuf;
/* For use in the get_suexec_identity phase */
- apr_table_setn(r->notes, "mod_userdir_user", w);
+ apr_pool_userdata_set(w, "mod_userdir_user", NULL, r->pool);
return OK;
}
@@ -359,9 +359,10 @@
{
ap_unix_identity_t *ugid = NULL;
#if APR_HAS_USER
- const char *username = apr_table_get(r->notes, "mod_userdir_user");
+ const char *username;
- if (username == NULL) {
+ if ((apr_pool_userdata_get((void **)&username, "mod_userdir_user",
+ r->pool) != APR_SUCCESS) || !username) {
return NULL;
}
Index: modules/mappers/mod_vhost_alias.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_vhost_alias.c,v
retrieving revision 1.25
diff -u -r1.25 mod_vhost_alias.c
--- modules/mappers/mod_vhost_alias.c 2001/02/24 11:23:31 1.25
+++ modules/mappers/mod_vhost_alias.c 2001/09/16 23:42:27
@@ -466,7 +466,7 @@
if (cgi) {
/* see is_scriptaliased() in mod_cgi */
r->handler = "cgi-script";
- apr_table_setn(r->notes, "alias-forced-type", r->handler);
+ apr_pool_userdata_set(r->handler, "alias-forced-type", NULL, r->pool);
}
return OK;
Index: modules/metadata/mod_setenvif.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/metadata/mod_setenvif.c,v
retrieving revision 1.30
diff -u -r1.30 mod_setenvif.c
--- modules/metadata/mod_setenvif.c 2001/06/12 17:06:01 1.30
+++ modules/metadata/mod_setenvif.c 2001/09/16 23:42:28
@@ -404,6 +404,7 @@
*/
static int match_headers(request_rec *r)
{
+ void *data;
sei_cfg_rec *sconf;
sei_entry *entries;
apr_table_entry_t *elts;
@@ -411,8 +412,10 @@
int i, j;
char *last_name;
- if (apr_table_get(r->notes, SEI_MAGIC_HEIRLOOM) == NULL) {
- apr_table_set(r->notes, SEI_MAGIC_HEIRLOOM, "post-read done");
+ if ((apr_pool_userdata_get(&data, SEI_MAGIC_HEIRLOOM, r->pool) !=
+ APR_SUCCESS) || !data) {
+ apr_pool_userdata_set("post-read-done", SEI_MAGIC_HEIRLOOM,
+ NULL, r->pool);
sconf = (sei_cfg_rec *) ap_get_module_config(r->server->module_config,
&setenvif_module);
}
Index: modules/metadata/mod_usertrack.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/metadata/mod_usertrack.c,v
retrieving revision 1.33
diff -u -r1.33 mod_usertrack.c
--- modules/metadata/mod_usertrack.c 2001/08/29 12:29:36 1.33
+++ modules/metadata/mod_usertrack.c 2001/09/16 23:42:28
@@ -194,7 +194,8 @@
apr_table_setn(r->headers_out,
(dcfg->style == CT_COOKIE2 ? "Set-Cookie2" : "Set-Cookie"),
new_cookie);
- apr_table_setn(r->notes, "cookie", apr_pstrdup(r->pool, cookiebuf)); /* log
first time */
+ apr_pool_userdata_set(apr_pstrdup(r->pool, cookiebuf), "cookie", NULL,
+ r->pool); /* log first time */
return;
}
@@ -223,7 +224,7 @@
*cookieend = '\0'; /* Ignore anything after a ; */
/* Set the cookie in a note, for logging */
- apr_table_setn(r->notes, "cookie", cookiebuf);
+ apr_pool_userdata_set(cookiebuf, "cookie", NULL, r->pool);
return DECLINED; /* There's already a cookie, no new one */
}
Index: server/config.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/config.c,v
retrieving revision 1.134
diff -u -r1.134 config.c
--- server/config.c 2001/08/23 19:13:53 1.134
+++ server/config.c 2001/09/16 23:42:29
@@ -1525,9 +1525,9 @@
"%s pcfg_openfile: unable to check htaccess file, "
"ensure it is readable",
filename);
- apr_table_setn(r->notes, "error-notes",
- "Server unable to read htaccess file, denying "
- "access to be safe");
+ apr_pool_userdata_set("Server unable to read htaccess file, "
+ "denying access to be safe",
+ "error-notes", NULL, r->pool);
return HTTP_FORBIDDEN;
}
}
Index: server/log.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/log.c,v
retrieving revision 1.96
diff -u -r1.96 log.c
--- server/log.c 2001/07/30 17:55:38 1.96
+++ server/log.c 2001/09/16 23:42:30
@@ -490,6 +490,7 @@
const char *fmt, ...)
{
va_list args;
+ void *data;
va_start(args, fmt);
log_error_core(file, line, level, status, r->server, r, NULL, fmt, args);
@@ -504,10 +505,13 @@
va_end(args);
va_start(args,fmt);
if (((level & APLOG_LEVELMASK) <= APLOG_WARNING)
- && (apr_table_get(r->notes, "error-notes") == NULL)) {
- apr_table_setn(r->notes, "error-notes",
- ap_escape_html(r->pool, apr_pvsprintf(r->pool, fmt,
- args)));
+ &&
+ ((apr_pool_userdata_get(&data, "error-notes", r->pool) != APR_SUCCESS)
+ || !data)) {
+ apr_pool_userdata_set(ap_escape_html(r->pool,
+ apr_pvsprintf(r->pool, fmt,
+ args)),
+ "error-notes", NULL, r->pool);
}
va_end(args);
}
Index: server/protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/protocol.c,v
retrieving revision 1.44
diff -u -r1.44 protocol.c
--- server/protocol.c 2001/09/11 18:38:21 1.44
+++ server/protocol.c 2001/09/16 23:42:31
@@ -498,9 +498,10 @@
if (r->server->limit_req_fields &&
(++fields_read > r->server->limit_req_fields)) {
r->status = HTTP_BAD_REQUEST;
- apr_table_setn(r->notes, "error-notes",
- "The number of request header fields exceeds "
- "this server's limit.");
+ apr_pool_userdata_set("error-notes",
+ "The number of request header fields "
+ "exceeds this server's limit.",
+ NULL, r->pool);
return;
}
/* ap_getline returns (size of max buffer - 1) if it fills up the
@@ -509,13 +510,13 @@
*/
if (len > r->server->limit_req_fieldsize) {
r->status = HTTP_BAD_REQUEST;
- apr_table_setn(r->notes, "error-notes",
- apr_pstrcat(r->pool,
- "Size of a request header field "
- "exceeds server limit.<br />\n"
- "<pre>\n",
- ap_escape_html(r->pool, field),
- "</pre>\n", NULL));
+ apr_pool_userdata_set(apr_pstrcat(r->pool,
+ "Size of a request header field "
+ "exceeds server limit.<br />\n"
+ "<pre>\n",
+ ap_escape_html(r->pool, field),
+ "</pre>\n", NULL),
+ "error-notes", NULL, r->pool);
return;
}
copy = apr_palloc(r->pool, len + 1);
@@ -523,13 +524,13 @@
if (!(value = strchr(copy, ':'))) { /* Find the colon separator */
r->status = HTTP_BAD_REQUEST; /* or abort the bad request */
- apr_table_setn(r->notes, "error-notes",
- apr_pstrcat(r->pool,
- "Request header field is missing "
- "colon separator.<br />\n"
- "<pre>\n",
- ap_escape_html(r->pool, copy),
- "</pre>\n", NULL));
+ apr_pool_userdata_set(apr_pstrcat(r->pool,
+ "Request header field is "
+ "missing colon separator."
+ "<br />\n<pre>\n",
+ ap_escape_html(r->pool, copy),
+ "</pre>\n", NULL),
+ "error-notes", NULL, r->pool);
return;
}
@@ -570,7 +571,6 @@
r->subprocess_env = apr_table_make(r->pool, 50);
r->headers_out = apr_table_make(r->pool, 12);
r->err_headers_out = apr_table_make(r->pool, 5);
- r->notes = apr_table_make(r->pool, 5);
r->request_config = ap_create_request_config(r->pool);
ap_run_create_request(r);
@@ -720,7 +720,6 @@
rnew->subprocess_env = apr_table_copy(rnew->pool, r->subprocess_env);
rnew->headers_out = apr_table_make(rnew->pool, 5);
rnew->err_headers_out = apr_table_make(rnew->pool, 5);
- rnew->notes = apr_table_make(rnew->pool, 5);
rnew->expecting_100 = r->expecting_100;
rnew->read_length = r->read_length;
Index: srclib/apr/include/apr_pools.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_pools.h,v
retrieving revision 1.59
diff -u -r1.59 apr_pools.h
--- srclib/apr/include/apr_pools.h 2001/08/15 21:02:53 1.59
+++ srclib/apr/include/apr_pools.h 2001/09/16 23:42:31
@@ -298,6 +298,14 @@
apr_pool_t *cont);
/**
+ * Overlay a copy of one pool's userdata onto another
+ * @param base The target pool
+ * @param add The source pool
+ */
+APR_DECLARE(apr_status_t) apr_pool_userdata_overlay(apr_pool_t *base,
+ const apr_pool_t *add);
+
+/**
* Clear all memory in the pool and run all the cleanups. This also clears all
* subpools.
* @param p The pool to clear
Index: srclib/apr/memory/unix/apr_pools.c
===================================================================
RCS file: /home/cvspublic/apr/memory/unix/apr_pools.c,v
retrieving revision 1.109
diff -u -r1.109 apr_pools.c
--- srclib/apr/memory/unix/apr_pools.c 2001/09/02 18:11:33 1.109
+++ srclib/apr/memory/unix/apr_pools.c 2001/09/16 23:42:33
@@ -1201,7 +1201,9 @@
apr_hash_set(cont->prog_data, key, keylen, data);
}
- apr_pool_cleanup_register(cont, data, cleanup, cleanup);
+ if (cleanup) {
+ apr_pool_cleanup_register(cont, data, cleanup, cleanup);
+ }
return APR_SUCCESS;
}
@@ -1211,6 +1213,38 @@
*data = NULL;
else
*data = apr_hash_get(cont->prog_data, key, strlen(key));
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_pool_userdata_overlay(apr_pool_t *base,
+ const apr_pool_t *add)
+{
+ apr_hash_index_t *iter;
+ const void *key;
+ apr_ssize_t klen;
+ void *val;
+
+#ifdef POOL_DEBUG
+ if (!apr_pool_is_ancestor(base, add)) {
+ fprintf(stderr, "apr_pool_userdata_overlay: base is not ancestor of add\n");
+ return APR_EGENERAL;
+ }
+#endif /* POOL_DEBUG */
+
+ if (add->prog_data == NULL) {
+ return APR_SUCCESS;
+ }
+
+ if (base->prog_data == NULL) {
+ base->prog_data = apr_hash_make(base);
+ }
+
+ for (iter = apr_hash_first(base, add->prog_data); iter;
+ iter = apr_hash_next(iter)) {
+ apr_hash_this(iter, &key, &klen, &val);
+ apr_hash_set(base->prog_data, key, klen, val);
+ }
+
return APR_SUCCESS;
}