httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject svn commit: r152679 - in httpd/httpd/trunk/modules/cache: cache_storage.c cache_util.c mod_cache.c mod_cache.h mod_disk_cache.c mod_mem_cache.c
Date Tue, 08 Feb 2005 17:40:00 GMT
Author: jerenkrantz
Date: Tue Feb  8 09:39:56 2005
New Revision: 152679

URL: http://svn.apache.org/viewcvs?view=rev&rev=152679
Log:
Cleanup structures in mod_cache and friends to remove unused or unnecessary
fields.  Also resolves a number of latent bugs due to the wrong fields being
accessed.

Modified:
    httpd/httpd/trunk/modules/cache/cache_storage.c
    httpd/httpd/trunk/modules/cache/cache_util.c
    httpd/httpd/trunk/modules/cache/mod_cache.c
    httpd/httpd/trunk/modules/cache/mod_cache.h
    httpd/httpd/trunk/modules/cache/mod_disk_cache.c
    httpd/httpd/trunk/modules/cache/mod_mem_cache.c

Modified: httpd/httpd/trunk/modules/cache/cache_storage.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/cache/cache_storage.c?view=diff&r1=152678&r2=152679
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_storage.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_storage.c Tue Feb  8 09:39:56 2005
@@ -140,10 +140,7 @@
     apr_table_unset(r->err_headers_out, "Set-Cookie");
     apr_table_unset(h->resp_hdrs, "Set-Cookie");
 
-    apr_table_overlap(r->headers_out, h->resp_hdrs,
-                      APR_OVERLAP_TABLES_SET);
-    apr_table_overlap(r->err_headers_out, h->resp_err_hdrs,
-                      APR_OVERLAP_TABLES_SET);
+    apr_table_overlap(r->headers_out, h->resp_hdrs, APR_OVERLAP_TABLES_SET);
     if (!apr_is_empty_table(cookie_table)) {
         r->err_headers_out = apr_table_overlay(r->pool, r->err_headers_out,
                                                cookie_table);
@@ -209,10 +206,7 @@
              *
              * RFC2616 13.6 and 14.44 describe the Vary mechanism.
              */
-            if ((varyhdr = apr_table_get(h->resp_err_hdrs, "Vary")) == NULL) {
-                varyhdr = apr_table_get(h->resp_hdrs, "Vary");
-            }
-            vary = apr_pstrdup(r->pool, varyhdr);
+            vary = apr_pstrdup(r->pool, apr_table_get(h->resp_hdrs, "Vary"));
             while (vary && *vary) {
                 char *name = vary;
                 const char *h1, *h2;
@@ -252,23 +246,25 @@
             /* Is our cached response fresh enough? */
             fresh = ap_cache_check_freshness(h, r);
             if (!fresh) {
-                cache_info *info = &(h->cache_obj->info);
+                const char *etag, *lastmod;
 
                 /* Make response into a conditional */
                 /* FIXME: What if the request is already conditional? */
-                if (info && info->etag) {
-                    /* if we have a cached etag */
-                    cache->stale_headers = apr_table_copy(r->pool,
-                                                          r->headers_in);
-                    apr_table_set(r->headers_in, "If-None-Match", info->etag);
-                    cache->stale_handle = h;
+                etag = apr_table_get(h->resp_hdrs, "ETag");
+                if (!etag) {
+                    lastmod = apr_table_get(h->resp_hdrs, "Last-Modified");
                 }
-                else if (info && info->lastmods) {
-                    /* if we have a cached Last-Modified header */
+                if (etag || lastmod) {
+                    /* if we have a cached etag or Last-Modified */
                     cache->stale_headers = apr_table_copy(r->pool,
                                                           r->headers_in);
-                    apr_table_set(r->headers_in, "If-Modified-Since",
-                                  info->lastmods);
+                    if (etag) {
+                        apr_table_set(r->headers_in, "If-None-Match", etag);
+                    }
+                    else if (lastmod) {
+                        apr_table_set(r->headers_in, "If-Modified-Since",
+                                      lastmod);
+                    }
                     cache->stale_handle = h;
                 }
 
@@ -276,9 +272,6 @@
             }
 
             /* Okay, this response looks okay.  Merge in our stuff and go. */
-            apr_table_setn(r->headers_out, "Content-Type",
-                           ap_make_content_type(r, h->content_type));
-            r->filename = apr_pstrdup(r->pool, h->cache_obj->info.filename);
             accept_headers(h, r);
 
             cache->handle = h;
@@ -298,7 +291,8 @@
     return DECLINED;
 }
 
-apr_status_t cache_generate_key_default( request_rec *r, apr_pool_t*p, char**key ) 
+apr_status_t cache_generate_key_default(request_rec *r, apr_pool_t* p,
+                                        char**key)
 {
     if (r->hostname) {
         *key = apr_pstrcat(p, r->hostname, r->uri, "?", r->args, NULL);

Modified: httpd/httpd/trunk/modules/cache/cache_util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/cache/cache_util.c?view=diff&r1=152678&r2=152679
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_util.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_util.c Tue Feb  8 09:39:56 2005
@@ -127,7 +127,7 @@
     apr_int64_t age, maxage_req, maxage_cresp, maxage, smaxage, maxstale;
     apr_int64_t minfresh;
     int age_in_errhdr = 0;
-    const char *cc_cresp, *cc_ceresp, *cc_req;
+    const char *cc_cresp, *cc_req;
     const char *agestr = NULL;
     const char *expstr = NULL;
     char *val;
@@ -167,20 +167,12 @@
      * 
      */
     cc_cresp = apr_table_get(h->resp_hdrs, "Cache-Control");
-    cc_ceresp = apr_table_get(h->resp_err_hdrs, "Cache-Control");
     cc_req = apr_table_get(h->req_hdrs, "Cache-Control");
+    expstr = apr_table_get(h->resp_hdrs, "Expires");
 
     if ((agestr = apr_table_get(h->resp_hdrs, "Age"))) {
         age_c = apr_atoi64(agestr);
     }
-    else if ((agestr = apr_table_get(h->resp_err_hdrs, "Age"))) {
-        age_c = apr_atoi64(agestr);
-        age_in_errhdr = 1;
-    }
-
-    if (!(expstr = apr_table_get(h->resp_err_hdrs, "Expires"))) {
-        expstr = apr_table_get(h->resp_hdrs, "Expires");
-    }
 
     /* calculate age of object */
     age = ap_cache_current_age(info, age_c, r->request_time);
@@ -189,9 +181,6 @@
     if (cc_cresp && ap_cache_liststr(r->pool, cc_cresp, "s-maxage", &val))
{
         smaxage = apr_atoi64(val);
     }
-    else if (cc_ceresp && ap_cache_liststr(r->pool, cc_ceresp, "s-maxage", &val))
{
-        smaxage = apr_atoi64(val);
-    }
     else {
         smaxage = -1;
     }
@@ -208,9 +197,6 @@
     if (cc_cresp && ap_cache_liststr(r->pool, cc_cresp, "max-age", &val))
{
         maxage_cresp = apr_atoi64(val);
     }
-    else if (cc_ceresp && ap_cache_liststr(r->pool, cc_ceresp, "max-age", &val))
{
-        maxage_cresp = apr_atoi64(val);
-    }
     else
     {
         maxage_cresp = -1;
@@ -219,10 +205,10 @@
     /*
      * if both maxage request and response, the smaller one takes priority
      */
-    if (-1 == maxage_req) {
+    if (maxage_req == -1) {
         maxage = maxage_cresp;
     }
-    else if (-1 == maxage_cresp) {
+    else if (maxage_cresp == -1) {
         maxage = maxage_req;
     }
     else {
@@ -251,12 +237,6 @@
                                        "must-revalidate", NULL)) ||
                      (cc_cresp &&
                       ap_cache_liststr(NULL, cc_cresp,
-                                       "proxy-revalidate", NULL)) ||
-                     (cc_ceresp &&
-                      ap_cache_liststr(NULL, cc_ceresp,
-                                       "must-revalidate", NULL)) ||
-                     (cc_ceresp &&
-                      ap_cache_liststr(NULL, cc_ceresp,
                                        "proxy-revalidate", NULL)))) {
         maxstale = 0;
     }
@@ -268,27 +248,13 @@
          (info->expire != APR_DATE_BAD) &&
          (age < (apr_time_sec(info->expire - info->date) + maxstale - minfresh))))
{
         const char *warn_head;
-        apr_table_t *head_ptr;
 
         warn_head = apr_table_get(h->resp_hdrs, "Warning");
-        if (warn_head != NULL) {
-            head_ptr = h->resp_hdrs;
-        }
-        else {
-            warn_head = apr_table_get(h->resp_err_hdrs, "Warning");
-            head_ptr = h->resp_err_hdrs;
-        }
 
         /* it's fresh darlings... */
         /* set age header on response */
-        if (age_in_errhdr) {
-            apr_table_set(h->resp_err_hdrs, "Age",
-                          apr_psprintf(r->pool, "%lu", (unsigned long)age));
-        }
-        else {
-            apr_table_set(h->resp_hdrs, "Age",
-                          apr_psprintf(r->pool, "%lu", (unsigned long)age));
-        }
+        apr_table_set(h->resp_hdrs, "Age",
+                      apr_psprintf(r->pool, "%lu", (unsigned long)age));
 
         /* add warning if maxstale overrode freshness calculation */
         if (!(((smaxage != -1) && age < smaxage) ||
@@ -298,7 +264,8 @@
             /* make sure we don't stomp on a previous warning */
             if ((warn_head == NULL) ||
                 ((warn_head != NULL) && (ap_strstr_c(warn_head, "110") == NULL)))
{
-                apr_table_merge(head_ptr, "Warning", "110 Response is stale");
+                apr_table_merge(h->resp_hdrs, "Warning",
+                                "110 Response is stale");
             }
         }
         /* 
@@ -315,7 +282,8 @@
              */
             if ((warn_head == NULL) ||
                 ((warn_head != NULL) && (ap_strstr_c(warn_head, "113") == NULL)))
{
-                apr_table_merge(head_ptr, "Warning", "113 Heuristic expiration");
+                apr_table_merge(h->resp_hdrs, "Warning",
+                                "113 Heuristic expiration");
             }
         }
         return 1;    /* Cache object is fresh (enough) */

Modified: httpd/httpd/trunk/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/cache/mod_cache.c?view=diff&r1=152678&r2=152679
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.c Tue Feb  8 09:39:56 2005
@@ -161,13 +161,6 @@
         return DECLINED;
     }
 
-    /* We have located a suitable cache file now. */
-    info = &(cache->handle->cache_obj->info);
-
-    if (info && info->lastmod) {
-        ap_update_mtime(r, info->lastmod);
-    }
-
     rv = ap_meets_conditions(r);
     if (rv != OK) {
         /* Return cached status. */
@@ -356,7 +349,8 @@
         lastmods = apr_table_get(r->headers_out, "Last-Modified");
     }
     if (lastmods != NULL) {
-        if (APR_DATE_BAD == (lastmod = apr_date_parse_http(lastmods))) {
+        lastmod = apr_date_parse_http(lastmods);
+        if (lastmod == APR_DATE_BAD) {
             lastmods = NULL;
         }
     }
@@ -628,7 +622,6 @@
                      "cache: Last modified is in the future, "
                      "replacing with now");
     }
-    info->lastmod = lastmod;
 
     /* if no expiry date then
      *   if lastmod
@@ -654,11 +647,6 @@
         }
     }
     info->expire = exp;
-
-    info->content_type = apr_pstrdup(r->pool, r->content_type);
-    info->etag = apr_pstrdup(r->pool, etag);
-    info->lastmods = apr_pstrdup(r->pool, lastmods);
-    info->filename = apr_pstrdup(r->pool, r->filename);
 
     /*
      * Write away header information to cache.

Modified: httpd/httpd/trunk/modules/cache/mod_cache.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/cache/mod_cache.h?view=diff&r1=152678&r2=152679
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.h (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.h Tue Feb  8 09:39:56 2005
@@ -151,21 +151,10 @@
 typedef struct cache_info cache_info;
 struct cache_info {
     int status;
-    char *content_type;
-    char *etag;
-    char *lastmods;         /* last modified of cache entity */
-    char *filename;
     apr_time_t date;
-    apr_time_t lastmod;
-    char lastmod_str[APR_RFC822_DATE_LEN];
     apr_time_t expire;
     apr_time_t request_time;
     apr_time_t response_time;
-    apr_size_t len;
-    apr_time_t ims;    /*  If-Modified_Since header value    */
-    apr_time_t ius;    /*  If-UnModified_Since header value    */
-    const char *im;         /* If-Match header value */
-    const char *inm;         /* If-None-Match header value */
 };
 
 /* cache handle information */
@@ -181,7 +170,9 @@
     char *key;
     cache_object_t *next;
     cache_info info;
-    void *vobj;         /* Opaque portion (specific to the cache implementation) of the cache
object */
+    /* Opaque portion (specific to the implementation) of the cache object */
+    void *vobj;
+    /* FIXME: These are only required for mod_mem_cache. */
     apr_size_t count;   /* Number of body bytes written to the cache so far */
     int complete;
     apr_uint32_t refcount;  /* refcount and bit flag to cleanup object */
@@ -192,9 +183,6 @@
     cache_object_t *cache_obj;
     apr_table_t *req_hdrs;        /* cached request headers */
     apr_table_t *resp_hdrs;       /* cached response headers */
-    apr_table_t *resp_err_hdrs;   /* cached response err headers */
-    const char *content_type;     /* cached content type */
-    int status;                   /* cached status */
 };
 
 #define CACHE_PROVIDER_GROUP "cache"

Modified: httpd/httpd/trunk/modules/cache/mod_disk_cache.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/cache/mod_disk_cache.c?view=diff&r1=152678&r2=152679
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_disk_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_disk_cache.c Tue Feb  8 09:39:56 2005
@@ -249,9 +249,7 @@
  * Hook and mod_cache callback functions
  */
 #define AP_TEMPFILE "/aptmpXXXXXX"
-static int create_entity(cache_handle_t *h, request_rec *r,
-                         const char *key,
-                         apr_off_t len)
+static int create_entity(cache_handle_t *h, request_rec *r, const char *key)
 {
     disk_cache_conf *conf = ap_get_module_config(r->server->module_config,
                                                  &disk_cache_module);
@@ -262,20 +260,11 @@
         return DECLINED;
     }
 
-    /* If the Content-Length is still unknown, cache anyway */
-    if (len != -1 && (len < conf->minfs || len > conf->maxfs)) {
-        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
-                     "cache_disk: URL %s failed the size check", key);
-        return DECLINED;
-    }
-
     /* Allocate and initialize cache_object_t and disk_cache_object_t */
     h->cache_obj = obj = apr_pcalloc(r->pool, sizeof(*obj));
     obj->vobj = dobj = apr_pcalloc(r->pool, sizeof(*dobj));
 
     obj->key = apr_pstrdup(r->pool, key);
-    /* XXX Bad Temporary Cast - see cache_object_t notes */
-    obj->info.len = (apr_size_t) len;
 
     dobj->name = obj->key;
     dobj->datafile = data_file(r->pool, conf, dobj, key);
@@ -471,7 +460,6 @@
 
     h->req_hdrs = apr_table_make(r->pool, 20);
     h->resp_hdrs = apr_table_make(r->pool, 20);
-    h->resp_err_hdrs = apr_table_make(r->pool, 20);
 
     /* Call routine to read the header lines/status line */
     read_table(h, r, h->resp_hdrs, dobj->hfd);
@@ -479,10 +467,6 @@
 
     apr_file_close(dobj->hfd);
 
-    h->status = dobj->disk_info.status;
-    h->content_type = apr_table_get(h->resp_hdrs, "Content-Type");
-    h->cache_obj->info.etag = apr_table_get(h->resp_hdrs, "ETag");
-
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                  "disk_cache: Recalled headers for URL %s",  dobj->name);
     return APR_SUCCESS;
@@ -687,15 +671,7 @@
      * sanity checks.
      */
     if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
-        if (h->cache_obj->info.len <= 0) {
-          /* If the target value of the content length is unknown
-           * (h->cache_obj->info.len <= 0), check if connection has been
-           * aborted by client to avoid caching incomplete request bodies.
-           *
-           * This can happen with large responses from slow backends like
-           * Tomcat via mod_jk.
-           */
-          if (r->connection->aborted) {
+        if (r->connection->aborted) {
             ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
                          "disk_cache: Discarding body for URL %s "
                          "because connection has been aborted.",
@@ -703,28 +679,14 @@
             /* Remove the intermediate cache file and return non-APR_SUCCESS */
             file_cache_errorcleanup(dobj, r);
             return APR_EGENERAL;
-          }
-          /* XXX Fixme: file_size isn't constrained by size_t. */
-          h->cache_obj->info.len = dobj->file_size;
-        }
-        else if (h->cache_obj->info.len != dobj->file_size) {
-          /* "Content-Length" and actual content disagree in size. Log that. */
-          ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
-                       "disk_cache: URL %s failed the size check (%lu != %lu)",
-                       h->cache_obj->key,
-                       (unsigned long)h->cache_obj->info.len,
-                       (unsigned long)dobj->file_size);
-          /* Remove the intermediate cache file and return non-APR_SUCCESS */
-          file_cache_errorcleanup(dobj, r);
-          return APR_EGENERAL;
         }
         if (dobj->file_size < conf->minfs) {
-          ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
-                     "cache_disk: URL %s failed the size check (%lu<%lu)",
-                     h->cache_obj->key, (unsigned long)dobj->file_size, (unsigned
long)conf->minfs);
-          /* Remove the intermediate cache file and return non-APR_SUCCESS */
-          file_cache_errorcleanup(dobj, r);
-          return APR_EGENERAL;
+            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+                         "cache_disk: URL %s failed the size check (%lu<%lu)",
+                         h->cache_obj->key, dobj->file_size, conf->minfs);
+            /* Remove the intermediate cache file and return non-APR_SUCCESS */
+            file_cache_errorcleanup(dobj, r);
+            return APR_EGENERAL;
         }
 
         /* All checks were fine. Move tempfile to final destination */

Modified: httpd/httpd/trunk/modules/cache/mod_mem_cache.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/cache/mod_mem_cache.c?view=diff&r1=152678&r2=152679
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_mem_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_mem_cache.c Tue Feb  8 09:39:56 2005
@@ -66,14 +66,8 @@
 typedef struct mem_cache_object {
     cache_type_e type;
     apr_ssize_t num_header_out;
-    apr_ssize_t num_err_header_out;
-    apr_ssize_t num_subprocess_env;
-    apr_ssize_t num_notes;
     apr_ssize_t num_req_hdrs;
     cache_header_tbl_t *header_out;
-    cache_header_tbl_t *err_header_out;
-    cache_header_tbl_t *subprocess_env;
-    cache_header_tbl_t *notes;
     cache_header_tbl_t *req_hdrs; /* for Vary negotiation */
     apr_size_t m_len;
     void *m;
@@ -226,21 +220,9 @@
     if (obj->key) {
         free(obj->key);
     }
-    if (obj->info.content_type) {
-        free(obj->info.content_type);
-    }
-    if (obj->info.etag) {
-        free(obj->info.etag);
-    }
-    if (obj->info.lastmods) {
-        free(obj->info.lastmods);
-    }
-    if (obj->info.filename) {
-        free(obj->info.filename);
-    }
 
     free(obj);
-    
+
     /* Cleanup the mem_cache_object_t */
     if (mobj) {
         if (mobj->type == CACHE_TYPE_HEAP && mobj->m) {
@@ -258,21 +240,6 @@
                 free(mobj->header_out[0].hdr);
             free(mobj->header_out);
         }
-        if (mobj->err_header_out) {
-            if (mobj->err_header_out[0].hdr) 
-                free(mobj->err_header_out[0].hdr);
-            free(mobj->err_header_out);
-        }
-        if (mobj->subprocess_env) {
-            if (mobj->subprocess_env[0].hdr) 
-                free(mobj->subprocess_env[0].hdr);
-            free(mobj->subprocess_env);
-        }
-        if (mobj->notes) {
-            if (mobj->notes[0].hdr) 
-                free(mobj->notes[0].hdr);
-            free(mobj->notes);
-        }
         if (mobj->req_hdrs) {
             if (mobj->req_hdrs[0].hdr)
                 free(mobj->req_hdrs[0].hdr);
@@ -415,8 +382,6 @@
         return DECLINED;
     }
     memcpy(obj->key, key, key_len);
-    /* Safe cast: We tested < sconf->max_cache_object_size above */
-    obj->info.len = (apr_size_t)len;
 
     /* Allocate and init mem_cache_object_t */
     mobj = calloc(1, sizeof(*mobj));
@@ -669,32 +634,10 @@
  
     h->req_hdrs = apr_table_make(r->pool, mobj->num_req_hdrs);
     h->resp_hdrs = apr_table_make(r->pool, mobj->num_header_out);
-    h->resp_err_hdrs = apr_table_make(r->pool, mobj->num_err_header_out);
-    /* ### FIXME: These two items should not be saved. */
-    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,
-                           h->req_hdrs);
-    rc = unserialize_table( mobj->header_out,
-                            mobj->num_header_out, 
-                            h->resp_hdrs);
-    rc = unserialize_table( mobj->err_header_out,
-                            mobj->num_err_header_out, 
-                            h->resp_err_hdrs);
-    rc = unserialize_table( mobj->subprocess_env, 
-                            mobj->num_subprocess_env, 
-                            r->subprocess_env);
-    rc = unserialize_table( mobj->notes,
-                            mobj->num_notes,
-                            r->notes);
 
-    /* Content-Type: header may not be set if content is local since
-     * CACHE_IN runs before header filters....
-     */
-    h->content_type = h->cache_obj->info.content_type;
-    h->status = h->cache_obj->info.status;
+    rc = unserialize_table(mobj->req_hdrs, mobj->num_req_hdrs, h->req_hdrs);
+    rc = unserialize_table(mobj->header_out, mobj->num_header_out,
+                           h->resp_hdrs);
 
     return rc;
 }
@@ -727,7 +670,8 @@
     cache_object_t *obj = h->cache_obj;
     mem_cache_object_t *mobj = (mem_cache_object_t*) obj->vobj;
     int rc;
- 
+    apr_table_t *headers_out, *err_headers_out;
+
     /*
      * The cache needs to keep track of the following information: 
      * - Date, LastMod, Version, ReqTime, RespTime, ContentLength 
@@ -743,41 +687,21 @@
     }
 
     /* Precompute how much storage we need to hold the headers */
-    rc = serialize_table(&mobj->header_out, 
-                         &mobj->num_header_out, 
-                         ap_cache_cacheable_hdrs_out(r->pool, r->headers_out,
-                                                     r->server));
-    if (rc != APR_SUCCESS) {
-        return rc;
-    }
-    rc = serialize_table(&mobj->err_header_out, 
-                         &mobj->num_err_header_out, 
-                         ap_cache_cacheable_hdrs_out(r->pool,
-                                                     r->err_headers_out,
-                                                     r->server));
-    if (rc != APR_SUCCESS) {
-        return rc;
-    }
-    rc = serialize_table(&mobj->subprocess_env,
-                         &mobj->num_subprocess_env, 
-                         r->subprocess_env );
-    if (rc != APR_SUCCESS) {
-        return rc;
-    }
+    headers_out = ap_cache_cacheable_hdrs_out(r->pool, r->headers_out,
+                                              r->server);
+    headers_out = apr_table_overlay(r->pool, headers_out, r->err_headers_out);
 
-    rc = serialize_table(&mobj->notes, &mobj->num_notes, r->notes);
+    rc = serialize_table(&mobj->header_out, &mobj->num_header_out,
+                         headers_out);
     if (rc != APR_SUCCESS) {
         return rc;
     }
- 
+
     /* Init the info struct */
     obj->info.status = info->status;
     if (info->date) {
         obj->info.date = info->date;
     }
-    if (info->lastmod) {
-        obj->info.lastmod = info->lastmod;
-    }
     if (info->response_time) {
         obj->info.response_time = info->response_time;
     }
@@ -786,38 +710,6 @@
     }
     if (info->expire) {
         obj->info.expire = info->expire;
-    }
-    if (info->content_type) {
-        apr_size_t len = strlen(info->content_type) + 1;
-        obj->info.content_type = (char*) malloc(len);
-        if (!obj->info.content_type) {
-            return APR_ENOMEM;
-        }
-        memcpy(obj->info.content_type, info->content_type, len);
-    }
-    if (info->etag) {
-        apr_size_t len = strlen(info->etag) + 1;
-        obj->info.etag = (char*) malloc(len);
-        if (!obj->info.etag) {
-            return APR_ENOMEM;
-        }
-        memcpy(obj->info.etag, info->etag, len);
-    }
-    if (info->lastmods) {
-        apr_size_t len = strlen(info->lastmods) + 1;
-        obj->info.lastmods = (char*) malloc(len);
-        if (!obj->info.lastmods) {
-            return APR_ENOMEM;
-        }
-        memcpy(obj->info.lastmods, info->lastmods, len);
-    }
-    if ( info->filename) {
-        apr_size_t len = strlen(info->filename) + 1;
-        obj->info.filename = (char*) malloc(len);
-        if (!obj->info.filename ) {
-            return APR_ENOMEM;
-        }
-        memcpy(obj->info.filename, info->filename, len);
     }
 
     return APR_SUCCESS;



Mime
View raw message