| 781 | } |
| 782 | |
| 783 | static apr_status_t store_headers(cache_handle_t *h, request_rec *r, |
| 784 | cache_info *info) |
| 785 | { |
| 786 | cache_socache_dir_conf *dconf = |
| 787 | ap_get_module_config(r->per_dir_config, &cache_socache_module); |
| 788 | cache_socache_conf *conf = ap_get_module_config(r->server->module_config, |
| 789 | &cache_socache_module); |
| 790 | apr_size_t slider; |
| 791 | apr_status_t rv; |
| 792 | cache_object_t *obj = h->cache_obj; |
| 793 | cache_socache_object_t *sobj = (cache_socache_object_t*) obj->vobj; |
| 794 | cache_socache_info_t *socache_info; |
| 795 | |
| 796 | memcpy(&h->cache_obj->info, info, sizeof(cache_info)); |
| 797 | |
| 798 | if (r->headers_out) { |
| 799 | sobj->headers_out = ap_cache_cacheable_headers_out(r); |
| 800 | } |
| 801 | |
| 802 | if (r->headers_in) { |
| 803 | sobj->headers_in = ap_cache_cacheable_headers_in(r); |
| 804 | } |
| 805 | |
| 806 | sobj->expire |
| 807 | = obj->info.expire > r->request_time + dconf->maxtime ? r->request_time |
| 808 | + dconf->maxtime |
| 809 | : obj->info.expire + dconf->mintime; |
| 810 | |
| 811 | apr_pool_create(&sobj->pool, r->pool); |
| 812 | apr_pool_tag(sobj->pool, "mod_cache_socache (store_headers)"); |
| 813 | |
| 814 | sobj->buffer = apr_palloc(sobj->pool, dconf->max); |
| 815 | sobj->buffer_len = dconf->max; |
| 816 | socache_info = (cache_socache_info_t *) sobj->buffer; |
| 817 | |
| 818 | if (sobj->headers_out) { |
| 819 | const char *vary; |
| 820 | |
| 821 | vary = apr_table_get(sobj->headers_out, "Vary"); |
| 822 | |
| 823 | if (vary) { |
| 824 | apr_array_header_t* varray; |
| 825 | apr_uint32_t format = CACHE_SOCACHE_VARY_FORMAT_VERSION; |
| 826 | |
| 827 | memcpy(sobj->buffer, &format, sizeof(format)); |
| 828 | slider = sizeof(format); |
| 829 | |
| 830 | memcpy(sobj->buffer + slider, &obj->info.expire, |
| 831 | sizeof(obj->info.expire)); |
| 832 | slider += sizeof(obj->info.expire); |
| 833 | |
| 834 | varray = apr_array_make(r->pool, 6, sizeof(char*)); |
| 835 | tokens_to_array(r->pool, vary, varray); |
| 836 | |
| 837 | if (APR_SUCCESS != (rv = store_array(varray, sobj->buffer, |
| 838 | sobj->buffer_len, &slider))) { |
| 839 | ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02370) |
| 840 | "buffer too small for Vary array, caching aborted: %s", |
nothing calls this directly
no test coverage detected