| 81 | */ |
| 82 | |
| 83 | static int cache_quick_handler(request_rec *r, int lookup) |
| 84 | { |
| 85 | apr_status_t rv; |
| 86 | const char *auth; |
| 87 | cache_provider_list *providers; |
| 88 | cache_request_rec *cache; |
| 89 | apr_bucket_brigade *out; |
| 90 | apr_bucket *e; |
| 91 | ap_filter_t *next; |
| 92 | ap_filter_rec_t *cache_out_handle; |
| 93 | cache_server_conf *conf; |
| 94 | |
| 95 | conf = (cache_server_conf *) ap_get_module_config(r->server->module_config, |
| 96 | &cache_module); |
| 97 | |
| 98 | /* only run if the quick handler is enabled */ |
| 99 | if (!conf->quick) { |
| 100 | return DECLINED; |
| 101 | } |
| 102 | |
| 103 | /* |
| 104 | * Which cache module (if any) should handle this request? |
| 105 | */ |
| 106 | if (!(providers = cache_get_providers(r, conf))) { |
| 107 | return DECLINED; |
| 108 | } |
| 109 | |
| 110 | /* make space for the per request config */ |
| 111 | cache = apr_pcalloc(r->pool, sizeof(cache_request_rec)); |
| 112 | cache->size = -1; |
| 113 | cache->out = apr_brigade_create(r->pool, r->connection->bucket_alloc); |
| 114 | |
| 115 | /* save away the possible providers */ |
| 116 | cache->providers = providers; |
| 117 | |
| 118 | /* |
| 119 | * Are we allowed to serve cached info at all? |
| 120 | */ |
| 121 | if (!ap_cache_check_no_store(cache, r)) { |
| 122 | return DECLINED; |
| 123 | } |
| 124 | |
| 125 | /* find certain cache controlling headers */ |
| 126 | auth = apr_table_get(r->headers_in, "Authorization"); |
| 127 | |
| 128 | /* First things first - does the request allow us to return |
| 129 | * cached information at all? If not, just decline the request. |
| 130 | */ |
| 131 | if (auth) { |
| 132 | return DECLINED; |
| 133 | } |
| 134 | |
| 135 | /* Are we PUT/POST/DELETE? If so, prepare to invalidate the cached entities. |
| 136 | */ |
| 137 | switch (r->method_number) { |
| 138 | case M_PUT: |
| 139 | case M_POST: |
| 140 | case M_DELETE: |
nothing calls this directly
no test coverage detected