#include "util_charset.h"
/*
- * mod_disk_cache: Disk Based HTTP 1.1 Cache.
+ * mod_cache_disk: Disk Based HTTP 1.1 Cache.
*
* Flow to Find the .data file:
* Incoming client requests URI /foo/bar/baz
rv = safe_file_rename(conf, file->tempfile, file->file, file->pool);
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r,
- "disk_cache: rename tempfile to file failed:"
+ "cache_disk: rename tempfile to file failed:"
" %s -> %s", file->tempfile, file->file);
apr_file_remove(file->tempfile, file->pool);
}
/* we don't support caching of range requests (yet) */
if (r->status == HTTP_PARTIAL_CONTENT) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: URL %s partial content response not cached",
+ "cache_disk: URL %s partial content response not cached",
key);
return DECLINED;
}
/* Note, len is -1 if unknown so don't trust it too hard */
if (len > dconf->maxfs) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: URL %s failed the size check "
+ "cache_disk: URL %s failed the size check "
"(%" APR_OFF_T_FMT " > %" APR_OFF_T_FMT ")",
key, len, dconf->maxfs);
return DECLINED;
}
if (len >= 0 && len < dconf->minfs) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: URL %s failed the size check "
+ "cache_disk: URL %s failed the size check "
"(%" APR_OFF_T_FMT " < %" APR_OFF_T_FMT ")",
key, len, dconf->minfs);
return DECLINED;
if (!error_logged) {
error_logged = 1;
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
- "disk_cache: Cannot cache files to disk without a CacheRoot specified.");
+ "cache_disk: Cannot cache files to disk without a CacheRoot specified.");
}
return DECLINED;
}
rc = read_array(r, varray, dobj->vary.fd);
if (rc != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
- "disk_cache: Cannot parse vary header file: %s",
+ "cache_disk: Cannot parse vary header file: %s",
dobj->vary.file);
apr_file_close(dobj->vary.fd);
return DECLINED;
}
else if (format != DISK_FORMAT_VERSION) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
- "disk_cache: File '%s' has a version mismatch. File had version: %d.",
+ "cache_disk: File '%s' has a version mismatch. File had version: %d.",
dobj->vary.file, format);
apr_file_close(dobj->vary.fd);
return DECLINED;
rc = file_cache_recall_mydata(dobj->hdrs.fd, info, dobj, r);
if (rc != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
- "disk_cache: Cannot read header file %s", dobj->hdrs.file);
+ "cache_disk: Cannot read header file %s", dobj->hdrs.file);
apr_file_close(dobj->hdrs.fd);
return DECLINED;
}
/* Is this a cached HEAD request? */
if (dobj->disk_info.header_only && !r->header_only) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r,
- "disk_cache: HEAD request cached, non-HEAD requested, ignoring: %s",
+ "cache_disk: HEAD request cached, non-HEAD requested, ignoring: %s",
dobj->hdrs.file);
return DECLINED;
}
rc = apr_file_open(&dobj->data.fd, dobj->data.file, flags, 0, r->pool);
if (rc != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
- "disk_cache: Cannot open data file %s", dobj->data.file);
+ "cache_disk: Cannot open data file %s", dobj->data.file);
apr_file_close(dobj->hdrs.fd);
return DECLINED;
}
/* Initialize the cache_handle callback functions */
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: Recalled cached URL info header %s", dobj->name);
+ "cache_disk: Recalled cached URL info header %s", dobj->name);
return OK;
}
/* Oh dear, no luck matching header to the body */
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: Cached URL info header '%s' didn't match body, ignoring this entry",
+ "cache_disk: Cached URL info header '%s' didn't match body, ignoring this entry",
dobj->name);
return DECLINED;
/* Delete headers file */
if (dobj->hdrs.file) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: Deleting %s from cache.", dobj->hdrs.file);
+ "cache_disk: Deleting %s from cache.", dobj->hdrs.file);
rc = apr_file_remove(dobj->hdrs.file, r->pool);
if ((rc != APR_SUCCESS) && !APR_STATUS_IS_ENOENT(rc)) {
* For reason see log_error_core for the case s == NULL.
*/
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rc, r,
- "disk_cache: Failed to delete headers file %s from cache.",
+ "cache_disk: Failed to delete headers file %s from cache.",
dobj->hdrs.file);
return DECLINED;
}
/* Delete data file */
if (dobj->data.file) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: Deleting %s from cache.", dobj->data.file);
+ "cache_disk: Deleting %s from cache.", dobj->data.file);
rc = apr_file_remove(dobj->data.file, r->pool);
if ((rc != APR_SUCCESS) && !APR_STATUS_IS_ENOENT(rc)) {
* For reason see log_error_core for the case s == NULL.
*/
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rc, r,
- "disk_cache: Failed to delete data file %s from cache.",
+ "cache_disk: Failed to delete data file %s from cache.",
dobj->data.file);
return DECLINED;
}
*/
for (q = dir + dobj->root_len; *q ; ) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: Deleting directory %s from cache",
+ "cache_disk: Deleting directory %s from cache",
dir);
rc = apr_dir_remove(dir, r->pool);
/* This case should not happen... */
if (!dobj->hdrs.fd) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
- "disk_cache: recalling headers; but no header fd for %s", dobj->name);
+ "cache_disk: recalling headers; but no header fd for %s", dobj->name);
return APR_NOTFOUND;
}
apr_file_close(dobj->hdrs.fd);
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: Recalled headers for URL %s", dobj->name);
+ "cache_disk: Recalled headers for URL %s", dobj->name);
return APR_SUCCESS;
}
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r,
- "disk_cache: could not create temp file %s",
+ "cache_disk: could not create temp file %s",
dobj->vary.tempfile);
return rv;
}
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r,
- "disk_cache: could not create temp file %s",
+ "cache_disk: could not create temp file %s",
dobj->hdrs.tempfile);
return rv;
}
rv = apr_file_writev(dobj->hdrs.tempfd, (const struct iovec *) &iov, 2, &amt);
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r,
- "disk_cache: could not write info to header file %s",
+ "cache_disk: could not write info to header file %s",
dobj->hdrs.tempfile);
apr_file_close(dobj->hdrs.tempfd);
return rv;
rv = store_table(dobj->hdrs.tempfd, dobj->headers_out);
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r,
- "disk_cache: could not write out-headers to header file %s",
+ "cache_disk: could not write out-headers to header file %s",
dobj->hdrs.tempfile);
apr_file_close(dobj->hdrs.tempfd);
return rv;
rv = store_table(dobj->hdrs.tempfd, dobj->headers_in);
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r,
- "disk_cache: could not write in-headers to header file %s",
+ "cache_disk: could not write in-headers to header file %s",
dobj->hdrs.tempfile);
apr_file_close(dobj->hdrs.tempfd);
return rv;
APR_BRIGADE_INSERT_TAIL(dobj->bb, e);
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
- "disk_cache: Error when reading bucket for URL %s",
+ "cache_disk: Error when reading bucket for URL %s",
h->cache_obj->key);
/* Remove the intermediate cache file and return non-APR_SUCCESS */
apr_pool_destroy(dobj->data.pool);
rv = apr_file_write_full(dobj->data.tempfd, str, length, &written);
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
- "disk_cache: Error when writing cache file for URL %s",
+ "cache_disk: Error when writing cache file for URL %s",
h->cache_obj->key);
/* Remove the intermediate cache file and return non-APR_SUCCESS */
apr_pool_destroy(dobj->data.pool);
dobj->file_size += written;
if (dobj->file_size > dconf->maxfs) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: URL %s failed the size check "
+ "cache_disk: URL %s failed the size check "
"(%" APR_OFF_T_FMT ">%" APR_OFF_T_FMT ")",
h->cache_obj->key, dobj->file_size, dconf->maxfs);
/* Remove the intermediate cache file and return non-APR_SUCCESS */
if (r->connection->aborted || r->no_cache) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
- "disk_cache: Discarding body for URL %s "
+ "cache_disk: Discarding body for URL %s "
"because connection has been aborted.",
h->cache_obj->key);
/* Remove the intermediate cache file and return non-APR_SUCCESS */
}
if (dobj->file_size < dconf->minfs) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: URL %s failed the size check "
+ "cache_disk: URL %s failed the size check "
"(%" APR_OFF_T_FMT "<%" APR_OFF_T_FMT ")",
h->cache_obj->key, dobj->file_size, dconf->minfs);
/* Remove the intermediate cache file and return non-APR_SUCCESS */
apr_int64_t cl = apr_atoi64(cl_header);
if ((errno == 0) && (dobj->file_size != cl)) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: URL %s didn't receive complete response, not caching",
+ "cache_disk: URL %s didn't receive complete response, not caching",
h->cache_obj->key);
/* Remove the intermediate cache file and return non-APR_SUCCESS */
apr_pool_destroy(dobj->data.pool);
if (APR_SUCCESS != rv) {
remove_url(h, r);
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: commit_entity: URL '%s' not cached due to earlier disk error.",
+ "cache_disk: commit_entity: URL '%s' not cached due to earlier disk error.",
dobj->name);
}
else {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
- "disk_cache: commit_entity: Headers and body for URL %s cached.",
+ "cache_disk: commit_entity: Headers and body for URL %s cached.",
dobj->name);
}