httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: httpd-2.0/modules/experimental cache_storage.c mod_cache.c mod_mem_cache.c
Date Tue, 11 Sep 2001 17:41:06 GMT
stoddard    01/09/11 10:41:06

  Modified:    modules/experimental cache_storage.c mod_cache.c
                        mod_mem_cache.c
  Log:
  Maintain info structure in mod_mem_cache. This fixes bug where the content
  type was lost when content was put in the cache.
  
  Revision  Changes    Path
  1.8       +7 -1      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- cache_storage.c	2001/09/10 18:09:56	1.7
  +++ cache_storage.c	2001/09/11 17:41:05	1.8
  @@ -156,6 +156,7 @@
       const char *next = types;
       const char *type;
       apr_status_t rv;
  +    cache_info *info;
       cache_request_rec *cache = (cache_request_rec *) ap_get_module_config(r->request_config,

                                                                             &cache_module);
   
  @@ -166,13 +167,14 @@
           type = ap_cache_tokstr(r->pool, next, &next);
           switch ((rv = cache_run_open_entity(cache->handle, type, url))) {
           case OK: {
  +            info = &(cache->handle->cache_obj->info);
               /* XXX:
                * Handle being returned a collection of entities.
                */
   
               /* Has the cache entry expired? */
   #if 0
  -            if (r->request_time > cache->handle... need to get info out of the
cache... info.expire)
  +            if (r->request_time > info->expire)
                   cache->fresh = 0;
               else
   #endif
  @@ -213,10 +215,14 @@
   apr_status_t cache_read_entity_headers(cache_handle_t *h, request_rec *r, 
                                          apr_table_t **headers)
   {
  +    cache_info *info = &(h->cache_obj->info);
  +
       /* Build the header table from info in the info struct */
       *headers = apr_table_make(r->pool, 15);
   
       h->read_headers(h, r, *headers);
  +
  +    r->content_type = apr_pstrdup(r->pool, info->content_type);
   
       return APR_SUCCESS;
   }
  
  
  
  1.17      +2 -0      httpd-2.0/modules/experimental/mod_cache.c
  
  Index: mod_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_cache.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- mod_cache.c	2001/09/11 11:25:28	1.16
  +++ mod_cache.c	2001/09/11 17:41:05	1.17
  @@ -634,6 +634,8 @@
       }
       info->expire = exp;
   
  +    info->content_type = apr_pstrdup(r->pool, r->content_type);
  +
       /*
        * Write away header information to cache.
        */
  
  
  
  1.9       +9 -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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- mod_mem_cache.c	2001/09/11 11:19:23	1.8
  +++ mod_mem_cache.c	2001/09/11 17:41:05	1.9
  @@ -405,6 +405,7 @@
   
   static int write_headers(cache_handle_t *h, request_rec *r, cache_info *info, apr_table_t
*headers)
   {
  +    cache_object_t *obj = h->cache_obj;
       mem_cache_object_t *mobj = (mem_cache_object_t*) h->cache_obj->vobj;
       apr_table_entry_t *elts = (apr_table_entry_t *) headers->a.elts;
       apr_ssize_t i;
  @@ -445,7 +446,7 @@
           idx+=len;
       }
   
  -#if 0
  +    /* Init the info struct */
       if (info->date) {
           obj->info.date = info->date;
       }
  @@ -456,11 +457,14 @@
           obj->info.expire = info->expire;
       }
       if (info->content_type) {
  -        obj->info.content_type = (char*) malloc(strlen(info->content_type));
  -        if (obj->info.content_type)
  -            strcpy((char*) obj->info.content_type, info->content_type);
  +        obj->info.content_type = (char*) malloc(strlen(info->content_type) + 1);
  +        if (!obj->info.content_type) {
  +            /* cleanup the object? */
  +            return DECLINED;
  +        }
  +        strcpy((char*) obj->info.content_type, info->content_type);
       }
  -#endif
  +
       return OK;
   }
   
  
  
  

Mime
View raw message