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

(-)modules/cache/mod_cache.c (-2 / +26 lines)
Lines 56-64 Link Here
56
    apr_bucket_brigade *out;
56
    apr_bucket_brigade *out;
57
    ap_filter_t *next;
57
    ap_filter_t *next;
58
    ap_filter_rec_t *cache_out_handle;
58
    ap_filter_rec_t *cache_out_handle;
59
    int remove_due_to_method = 0;
59
60
61
    if ((r->method_number == M_POST) || (r->method_number == M_PUT) ||
62
        (r->method_number == M_DELETE)) {
63
        remove_due_to_method = 1;
64
    }
60
    /* Delay initialization until we know we are handling a GET */
65
    /* Delay initialization until we know we are handling a GET */
61
    if (r->method_number != M_GET) {
66
    else if (r->method_number != M_GET) {
62
        return DECLINED;
67
        return DECLINED;
63
    }
68
    }
64
69
Lines 92-99 Link Here
92
97
93
    /* First things first - does the request allow us to return
98
    /* First things first - does the request allow us to return
94
     * cached information at all? If not, just decline the request.
99
     * cached information at all? If not, just decline the request.
100
     * If remove_due_to_method is set we have a POST, DELETE or PUT
101
     * request on the resource which according to RFC2616 13.1 causes
102
     * a possible existing cached resource to be invalided and
103
     * ejected from the cache. It is perfectly possible that POST, DELETE or
104
     * PUT on this resource is protected while a GET on this resource that
105
     * caused the resource to be cached is not. So we should not DECLINE here.
106
     * If remove_due_to_method is set it is guaranteed anyway that we DECLINE
107
     * later, but we need to have cache_select run before to be able to
108
     * eject the cached resource from the cache.
95
     */
109
     */
96
    if (auth) {
110
    if (auth && !remove_due_to_method) {
97
        return DECLINED;
111
        return DECLINED;
98
    }
112
    }
99
113
Lines 108-113 Link Here
108
     *   return OK
122
     *   return OK
109
     */
123
     */
110
    rv = cache_select(r);
124
    rv = cache_select(r);
125
    /*
126
     * Eject a possible cached resource from cache if handle a POST, DELETE or PUT
127
     * on this resource.
128
     * Note: cache_remove_url can handle the case when no cached resource
129
     * was found by cache_select.
130
     */
131
    if (remove_due_to_method) {
132
        cache_remove_url(cache, r->pool);
133
        return DECLINED;
134
    }
111
    if (rv != OK) {
135
    if (rv != OK) {
112
        if (rv == DECLINED) {
136
        if (rv == DECLINED) {
113
            if (!lookup) {
137
            if (!lookup) {

Return to bug 43826