Name
Quick Handler (2.0)
Synopsis
int module_quick_handler(request_rec *r, int lookup_uri)
This function is intended to
provide
content from a URI-based cache. If lookup_uri
is
set, then it should simply return OK
if the URI
exists, but not provide the content.
The only example of this in 2.0 is in an experimental module, mod_cache.c, as shown in Example 21-13.
Example
static int cache_url_handler(request_rec *r, int lookup) { apr_status_t rv; const char *cc_in, *pragma, *auth; apr_uri_t uri = r->parsed_uri; char *url = r->unparsed_uri; apr_size_t urllen; char *path = uri.path; const char *types; cache_info *info = NULL; cache_request_rec *cache; cache_server_conf *conf = (cache_server_conf *) ap_get_module_config(r->server->module_config, &cache_module); if (r->method_number != M_GET) return DECLINED; if (!(types = ap_cache_get_cachetype(r, conf, path))) { return DECLINED; } ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server, "cache: URL %s is being handled by %s", path, types); urllen = strlen(url); if (urllen > MAX_URL_LENGTH) { ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server, "cache: URL exceeds length threshold: %s", url); return DECLINED; } if (url[urllen-1] == '/') { return DECLINED; } cache = (cache_request_rec *) ap_get_module_config(r->request_config, &cache_module); if (!cache) { cache = ap_pcalloc(r->pool, sizeof(cache_request_rec)); ap_set_module_config(r->request_config, &cache_module, cache); } cache->types ...
Get Apache: The Definitive Guide, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.