You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@apache.org on 2002/06/22 21:22:41 UTC
cvs commit: httpd-2.0/modules/experimental mod_cache.h cache_storage.c mod_mem_cache.c
stoddard 2002/06/22 12:22:40
Modified: . CHANGES
modules/experimental mod_cache.h cache_storage.c
mod_mem_cache.c
Log:
Move the req_hdrs pointer from the cache_object_t to the cache_handle_t. Each
thread serving a request needs to update the req_hdrs pointer so it needs to
reside in r->pool (where the cache_handle_t resides).
Revision Changes Path
1.845 +3 -0 httpd-2.0/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.844
retrieving revision 1.845
diff -u -r1.844 -r1.845
--- CHANGES 22 Jun 2002 03:36:56 -0000 1.844
+++ CHANGES 22 Jun 2002 19:22:39 -0000 1.845
@@ -1,5 +1,8 @@
Changes with Apache 2.0.40
+ *) Fix segfault in mod_mem_cache most frequently observed when
+ serving the same file to multiple clients on an MP machine.
+ [Bill Stoddard]
*) mod_rewrite can now set cookies (RewriteRule (.*) - [CO=name:$1:.domain])
[Brian Degenhardt <bm...@mp3.com>, Ian Holsman]
1.28 +2 -1 httpd-2.0/modules/experimental/mod_cache.h
Index: mod_cache.h
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_cache.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- mod_cache.h 5 Jun 2002 03:45:13 -0000 1.27
+++ mod_cache.h 22 Jun 2002 19:22:40 -0000 1.28
@@ -202,7 +202,7 @@
apr_time_t ius; /* If-UnModified_Since header value */
const char *im; /* If-Match header value */
const char *inm; /* If-None-Match header value */
- apr_table_t *req_hdrs; /* These are the original request headers */
+
};
/* cache handle information */
@@ -230,6 +230,7 @@
apr_status_t (*write_body)(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b);
apr_status_t (*read_headers) (cache_handle_t *h, request_rec *r);
apr_status_t (*read_body) (cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb);
+ apr_table_t *req_hdrs; /* These are the original request headers */
};
/* per request cache information */
1.23 +7 -7 httpd-2.0/modules/experimental/cache_storage.c
Index: cache_storage.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/cache_storage.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- cache_storage.c 5 Jun 2002 03:45:13 -0000 1.22
+++ cache_storage.c 22 Jun 2002 19:22:40 -0000 1.23
@@ -170,7 +170,8 @@
const char *next = types;
const char *type;
apr_status_t rv;
- cache_info *info;
+ cache_handle_t *h;
+ // cache_info *info;
char *key;
cache_request_rec *cache = (cache_request_rec *)
ap_get_module_config(r->request_config, &cache_module);
@@ -180,15 +181,14 @@
return rv;
}
/* go through the cache types till we get a match */
- cache->handle = apr_palloc(r->pool, sizeof(cache_handle_t));
+ h = cache->handle = apr_palloc(r->pool, sizeof(cache_handle_t));
while (next) {
type = ap_cache_tokstr(r->pool, next, &next);
- switch ((rv = cache_run_open_entity(cache->handle, r, type, key))) {
+ switch ((rv = cache_run_open_entity(h, r, type, key))) {
case OK: {
char *vary = NULL;
- info = &(cache->handle->cache_obj->info);
- if (cache_read_entity_headers(cache->handle, r) != APR_SUCCESS) {
+ if (cache_read_entity_headers(h, r) != APR_SUCCESS) {
/* TODO: Handle this error */
return DECLINED;
}
@@ -205,7 +205,7 @@
* language negotiated document in a different language by mistake.
*
* This code makes the assumption that the storage manager will
- * cache the info->req_hdrs if the response contains a Vary
+ * cache the req_hdrs if the response contains a Vary
* header.
*
* RFC2616 13.6 and 14.44 describe the Vary mechanism.
@@ -228,7 +228,7 @@
* request identical? If not, we give up and do a straight get
*/
h1 = ap_table_get(r->headers_in, name);
- h2 = ap_table_get(info->req_hdrs, name);
+ h2 = ap_table_get(h->req_hdrs, name);
if (h1 == h2) {
/* both headers NULL, so a match - do nothing */
}
1.73 +3 -5 httpd-2.0/modules/experimental/mod_mem_cache.c
Index: mod_mem_cache.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_mem_cache.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- mod_mem_cache.c 15 Jun 2002 16:49:19 -0000 1.72
+++ mod_mem_cache.c 22 Jun 2002 19:22:40 -0000 1.73
@@ -621,7 +621,7 @@
h->write_headers = &write_headers;
h->remove_entity = &remove_entity;
h->cache_obj = obj;
-
+ h->req_hdrs = NULL; /* Pick these up in read_headers() */
return OK;
}
@@ -771,17 +771,15 @@
{
int rc;
mem_cache_object_t *mobj = (mem_cache_object_t*) h->cache_obj->vobj;
- cache_info *info = &(h->cache_obj->info);
- info->req_hdrs = apr_table_make(r->pool, mobj->num_req_hdrs);
-
+ h->req_hdrs = apr_table_make(r->pool, mobj->num_req_hdrs);
r->headers_out = apr_table_make(r->pool, mobj->num_header_out);
r->subprocess_env = apr_table_make(r->pool, mobj->num_subprocess_env);
r->notes = apr_table_make(r->pool, mobj->num_notes);
rc = unserialize_table(mobj->req_hdrs,
mobj->num_req_hdrs,
- info->req_hdrs);
+ h->req_hdrs);
rc = unserialize_table( mobj->header_out,
mobj->num_header_out,
r->headers_out);