View | Details | Raw Unified | Return to bug 39380
Collapse All | Expand All

(-)mod_disk_cache.c (-6 / +16 lines)
Lines 334-347 static int create_entity(cache_handle_t Link Here
334
    if (len > conf->maxfs) {
334
    if (len > conf->maxfs) {
335
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
335
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
336
                     "disk_cache: URL %s failed the size check "
336
                     "disk_cache: URL %s failed the size check "
337
                     "(%" APR_OFF_T_FMT " > %" APR_SIZE_T_FMT ")",
337
                     "(%" APR_OFF_T_FMT " > %" APR_OFF_T_FMT ")",
338
                     key, len, conf->maxfs);
338
                     key, len, conf->maxfs);
339
        return DECLINED;
339
        return DECLINED;
340
    }
340
    }
341
    if (len >= 0 && len < conf->minfs) {
341
    if (len >= 0 && len < conf->minfs) {
342
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
342
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
343
                     "disk_cache: URL %s failed the size check "
343
                     "disk_cache: URL %s failed the size check "
344
                     "(%" APR_OFF_T_FMT " < %" APR_SIZE_T_FMT ")",
344
                     "(%" APR_OFF_T_FMT " < %" APR_OFF_T_FMT ")",
345
                     key, len, conf->minfs);
345
                     key, len, conf->minfs);
346
        return DECLINED;
346
        return DECLINED;
347
    }
347
    }
Lines 1026-1032 static apr_status_t store_body(cache_han Link Here
1026
        if (dobj->file_size > conf->maxfs) {
1026
        if (dobj->file_size > conf->maxfs) {
1027
            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
1027
            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
1028
                         "disk_cache: URL %s failed the size check "
1028
                         "disk_cache: URL %s failed the size check "
1029
                         "(%" APR_OFF_T_FMT ">%" APR_SIZE_T_FMT ")",
1029
                         "(%" APR_OFF_T_FMT ">%" APR_OFF_T_FMT ")",
1030
                         h->cache_obj->key, dobj->file_size, conf->maxfs);
1030
                         h->cache_obj->key, dobj->file_size, conf->maxfs);
1031
            /* Remove the intermediate cache file and return non-APR_SUCCESS */
1031
            /* Remove the intermediate cache file and return non-APR_SUCCESS */
1032
            file_cache_errorcleanup(dobj, r);
1032
            file_cache_errorcleanup(dobj, r);
Lines 1050-1056 static apr_status_t store_body(cache_han Link Here
1050
        if (dobj->file_size < conf->minfs) {
1050
        if (dobj->file_size < conf->minfs) {
1051
            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
1051
            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
1052
                         "disk_cache: URL %s failed the size check "
1052
                         "disk_cache: URL %s failed the size check "
1053
                         "(%" APR_OFF_T_FMT "<%" APR_SIZE_T_FMT ")",
1053
                         "(%" APR_OFF_T_FMT "<%" APR_OFF_T_FMT ")",
1054
                         h->cache_obj->key, dobj->file_size, conf->minfs);
1054
                         h->cache_obj->key, dobj->file_size, conf->minfs);
1055
            /* Remove the intermediate cache file and return non-APR_SUCCESS */
1055
            /* Remove the intermediate cache file and return non-APR_SUCCESS */
1056
            file_cache_errorcleanup(dobj, r);
1056
            file_cache_errorcleanup(dobj, r);
Lines 1137-1151 static const char Link Here
1137
{
1137
{
1138
    disk_cache_conf *conf = ap_get_module_config(parms->server->module_config,
1138
    disk_cache_conf *conf = ap_get_module_config(parms->server->module_config,
1139
                                                 &disk_cache_module);
1139
                                                 &disk_cache_module);
1140
    conf->minfs = atoi(arg);
1140
1141
    if (apr_strtoff(&conf->minfs, arg, NULL, 0) != APR_SUCCESS ||
1142
            conf->minfs < 0) 
1143
    {
1144
        return "CacheMinFileSize argument must be a non-negative integer representing the min size of a file to cache in bytes.";
1145
    }
1141
    return NULL;
1146
    return NULL;
1142
}
1147
}
1148
1143
static const char
1149
static const char
1144
*set_cache_maxfs(cmd_parms *parms, void *in_struct_ptr, const char *arg)
1150
*set_cache_maxfs(cmd_parms *parms, void *in_struct_ptr, const char *arg)
1145
{
1151
{
1146
    disk_cache_conf *conf = ap_get_module_config(parms->server->module_config,
1152
    disk_cache_conf *conf = ap_get_module_config(parms->server->module_config,
1147
                                                 &disk_cache_module);
1153
                                                 &disk_cache_module);
1148
    conf->maxfs = atoi(arg);
1154
    if (apr_strtoff(&conf->maxfs, arg, NULL, 0) != APR_SUCCESS ||
1155
            conf->maxfs < 0) 
1156
    {
1157
        return "CacheMaxFileSize argument must be a non-negative integer representing the max size of a file to cache in bytes.";
1158
    }
1149
    return NULL;
1159
    return NULL;
1150
}
1160
}
1151
1161
(-)mod_disk_cache.h (-2 / +2 lines)
Lines 88-95 typedef struct { Link Here
88
    apr_size_t cache_root_len;
88
    apr_size_t cache_root_len;
89
    int dirlevels;               /* Number of levels of subdirectories */
89
    int dirlevels;               /* Number of levels of subdirectories */
90
    int dirlength;               /* Length of subdirectory names */
90
    int dirlength;               /* Length of subdirectory names */
91
    apr_size_t minfs;            /* minumum file size for cached files */
91
    apr_off_t minfs;             /* minimum file size for cached files */
92
    apr_size_t maxfs;            /* maximum file size for cached files */
92
    apr_off_t maxfs;             /* maximum file size for cached files */
93
} disk_cache_conf;
93
} disk_cache_conf;
94
94
95
#endif /*MOD_DISK_CACHE_H*/
95
#endif /*MOD_DISK_CACHE_H*/

Return to bug 39380