View | Details | Raw Unified | Return to bug 41551
Collapse All | Expand All

(-)modules/cache/mod_mem_cache.c (-4 / +18 lines)
Lines 539-550 Link Here
539
    return OK;
539
    return OK;
540
}
540
}
541
541
542
static apr_table_t *deep_table_copy(apr_pool_t *p, const apr_table_t *table)
543
{
544
    const apr_array_header_t *array = apr_table_elts(table);
545
    apr_table_entry_t *elts = (apr_table_entry_t *) array->elts;
546
    apr_table_t *copy = apr_table_make(p, array->nelts);
547
    int i;
548
549
    for (i = 0; i < array->nelts; i++) {
550
        apr_table_add(copy, elts[i].key, elts[i].val);
551
    }
552
553
    return copy;
554
}
555
542
static apr_status_t recall_headers(cache_handle_t *h, request_rec *r)
556
static apr_status_t recall_headers(cache_handle_t *h, request_rec *r)
543
{
557
{
544
    mem_cache_object_t *mobj = (mem_cache_object_t*) h->cache_obj->vobj;
558
    mem_cache_object_t *mobj = (mem_cache_object_t*) h->cache_obj->vobj;
545
559
546
    h->req_hdrs = apr_table_copy(r->pool, mobj->req_hdrs);
560
    h->req_hdrs = deep_table_copy(r->pool, mobj->req_hdrs);
547
    h->resp_hdrs = apr_table_copy(r->pool, mobj->header_out);
561
    h->resp_hdrs = deep_table_copy(r->pool, mobj->header_out);
548
562
549
    return OK;
563
    return OK;
550
}
564
}
Lines 585-591 Link Here
585
     * - The original response headers (for returning with a cached response)
599
     * - The original response headers (for returning with a cached response)
586
     * - The body of the message
600
     * - The body of the message
587
     */
601
     */
588
    mobj->req_hdrs = apr_table_copy(mobj->pool, r->headers_in);
602
    mobj->req_hdrs = deep_table_copy(mobj->pool, r->headers_in);
589
603
590
    /* Precompute how much storage we need to hold the headers */
604
    /* Precompute how much storage we need to hold the headers */
591
    headers_out = ap_cache_cacheable_hdrs_out(r->pool, r->headers_out,
605
    headers_out = ap_cache_cacheable_hdrs_out(r->pool, r->headers_out,
Lines 599-605 Link Here
599
    }
613
    }
600
614
601
    headers_out = apr_table_overlay(r->pool, headers_out, r->err_headers_out);
615
    headers_out = apr_table_overlay(r->pool, headers_out, r->err_headers_out);
602
    mobj->header_out = apr_table_copy(mobj->pool, headers_out);
616
    mobj->header_out = deep_table_copy(mobj->pool, headers_out);
603
617
604
    /* Init the info struct */
618
    /* Init the info struct */
605
    obj->info.status = info->status;
619
    obj->info.status = info->status;

Return to bug 41551