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

(-)mod_cache.c.orig (-25 / +3 lines)
Lines 94-128 Link Here
94
     */
94
     */
95
95
96
    /* find certain cache controlling headers */
96
    /* find certain cache controlling headers */
97
    pragma = apr_table_get(r->headers_in, "Pragma");
98
    auth = apr_table_get(r->headers_in, "Authorization");
97
    auth = apr_table_get(r->headers_in, "Authorization");
99
98
100
    /* first things first - does the request allow us to return
99
    /* First things first - does the request allow us to return
101
     * cached information at all? If not, just decline the request.
100
     * cached information at all? If not, just decline the request.
102
     *
103
     * Note that there is a big difference between not being allowed
104
     * to cache a request (no-store) and not being allowed to return
105
     * a cached request without revalidation (max-age=0).
106
     *
107
     * Caching is forbidden under the following circumstances:
108
     *
109
     * - RFC2616 14.9.2 Cache-Control: no-store
110
     * - Pragma: no-cache
111
     * - Any requests requiring authorization.
112
     */
101
     */
113
    if (conf->ignorecachecontrol == 1 && auth == NULL) {
102
    if (auth) {
114
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
103
        return DECLINED;
115
                     "incoming request is asking for a uncached version of "
116
                     "%s, but we know better and are ignoring it", url);
117
    }
118
    else {
119
        if (ap_cache_liststr(NULL, pragma, "no-cache", NULL) ||
120
            auth != NULL) {
121
            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
122
                         "cache: no-cache or authorization forbids caching "
123
                         "of %s", url);
124
            return DECLINED;
125
        }
126
    }
104
    }
127
105
128
    /*
106
    /*
(-)cache_util.c.orig (-1 / +23 lines)
Lines 130-138 Link Here
130
    const char *cc_cresp, *cc_ceresp, *cc_req;
130
    const char *cc_cresp, *cc_ceresp, *cc_req;
131
    const char *agestr = NULL;
131
    const char *agestr = NULL;
132
    const char *expstr = NULL;
132
    const char *expstr = NULL;
133
    const char *pragma;
133
    char *val;
134
    char *val;
134
    apr_time_t age_c = 0;
135
    apr_time_t age_c = 0;
135
    cache_info *info = &(h->cache_obj->info);
136
    cache_info *info = &(h->cache_obj->info);
137
    cache_server_conf *conf =
138
      (cache_server_conf *)ap_get_module_config(r->server->module_config,
139
                                                &cache_module);
140
136
141
137
    /*
142
    /*
138
     * We now want to check if our cached data is still fresh. This depends
143
     * We now want to check if our cached data is still fresh. This depends
Lines 166-174 Link Here
166
     * entity, and it's value is in the past, it has expired.
171
     * entity, and it's value is in the past, it has expired.
167
     * 
172
     * 
168
     */
173
     */
174
175
    /* This value comes from the client's initial request. */
176
    cc_req = apr_table_get(r->headers_in, "Cache-Control");
177
    pragma = apr_table_get(r->headers_in, "Pragma");
178
179
    if (ap_cache_liststr(NULL, pragma, "no-cache", NULL)
180
        || ap_cache_liststr(NULL, cc_req, "no-cache", NULL)) {
181
182
        if (!conf->ignorecachecontrol) {
183
	    /* Treat as stale, causing revalidation */
184
	    return 0;
185
	}
186
187
        ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
188
                     "Incoming request is asking for a uncached version of "
189
                     "%s, but we know better and are ignoring it",
190
                     r->unparsed_uri);
191
    }
169
    cc_cresp = apr_table_get(h->resp_hdrs, "Cache-Control");
192
    cc_cresp = apr_table_get(h->resp_hdrs, "Cache-Control");
170
    cc_ceresp = apr_table_get(h->resp_err_hdrs, "Cache-Control");
193
    cc_ceresp = apr_table_get(h->resp_err_hdrs, "Cache-Control");
171
    cc_req = apr_table_get(h->req_hdrs, "Cache-Control");
172
194
173
    if ((agestr = apr_table_get(h->resp_hdrs, "Age"))) {
195
    if ((agestr = apr_table_get(h->resp_hdrs, "Age"))) {
174
        age_c = apr_atoi64(agestr);
196
        age_c = apr_atoi64(agestr);

Return to bug 34888