--- ../p1-logstring/modules/cache/mod_disk_cache.c 2006-04-23 10:10:51.000000000 +0200 +++ ../p1-logstring/modules/cache/mod_disk_cache.c 2006-04-23 10:24:12.000000000 +0200 @@ -961,10 +961,41 @@ { apr_bucket *e; apr_status_t rv; + apr_off_t len; disk_cache_object_t *dobj = (disk_cache_object_t *) h->cache_obj->vobj; disk_cache_conf *conf = ap_get_module_config(r->server->module_config, &disk_cache_module); + if(r->no_cache) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "disk_cache: store_body called for URL %s even though" + "no_cache is set", h->cache_obj->key); + file_cache_errorcleanup(dobj, r); + return APR_EGENERAL; + } + + /* Note, can return -1 if len unknown so don't trust it too hard */ + apr_brigade_length(bb, 0, &len); + + if (len > conf->maxfs) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "disk_cache: URL %s failed the size check " + "(%" APR_OFF_T_FMT ">%" APR_SIZE_T_FMT ")", + h->cache_obj->key, len, conf->maxfs); + /* Remove the intermediate cache file and return non-APR_SUCCESS */ + file_cache_errorcleanup(dobj, r); + return APR_EGENERAL; + } + if (len >= 0 && len < conf->minfs) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "disk_cache: URL %s failed the size check " + "(%" APR_OFF_T_FMT "<%" APR_SIZE_T_FMT ")", + h->cache_obj->key, len, conf->minfs); + /* Remove the intermediate cache file and return non-APR_SUCCESS */ + file_cache_errorcleanup(dobj, r); + return APR_EGENERAL; + } + /* We write to a temp file and then atomically rename the file over * in file_cache_el_final(). */