MCPcopy Index your code
hub / github.com/apache/httpd / remove_url

Function remove_url

modules/cache/mod_cache_disk.c:626–710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

624}
625
626static int remove_url(cache_handle_t *h, request_rec *r)
627{
628 apr_status_t rc;
629 disk_cache_object_t *dobj;
630
631 /* Get disk cache object from cache handle */
632 dobj = (disk_cache_object_t *) h->cache_obj->vobj;
633 if (!dobj) {
634 return DECLINED;
635 }
636
637 /* Delete headers file */
638 if (dobj->hdrs.file) {
639 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00711)
640 "Deleting %s from cache.", dobj->hdrs.file);
641
642 rc = apr_file_remove(dobj->hdrs.file, r->pool);
643 if ((rc != APR_SUCCESS) && !APR_STATUS_IS_ENOENT(rc)) {
644 /* Will only result in an output if httpd is started with -e debug.
645 * For reason see log_error_core for the case s == NULL.
646 */
647 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rc, r, APLOGNO(00712)
648 "Failed to delete headers file %s from cache.",
649 dobj->hdrs.file);
650 return DECLINED;
651 }
652 }
653
654 /* Delete data file */
655 if (dobj->data.file) {
656 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00713)
657 "Deleting %s from cache.", dobj->data.file);
658
659 rc = apr_file_remove(dobj->data.file, r->pool);
660 if ((rc != APR_SUCCESS) && !APR_STATUS_IS_ENOENT(rc)) {
661 /* Will only result in an output if httpd is started with -e debug.
662 * For reason see log_error_core for the case s == NULL.
663 */
664 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rc, r, APLOGNO(00714)
665 "Failed to delete data file %s from cache.",
666 dobj->data.file);
667 return DECLINED;
668 }
669 }
670
671 /* now delete directories as far as possible up to our cache root */
672 if (dobj->root) {
673 const char *str_to_copy;
674
675 str_to_copy = dobj->hdrs.file ? dobj->hdrs.file : dobj->data.file;
676 if (str_to_copy) {
677 char *dir, *slash, *q;
678
679 dir = apr_pstrdup(r->pool, str_to_copy);
680
681 /* remove filename */
682 slash = strrchr(dir, '/');
683 *slash = '\0';

Callers 1

commit_entityFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected