diff --git a/src/cache_handler.c b/src/cache_handler.c index f6b51a8..c45713e 100644 --- a/src/cache_handler.c +++ b/src/cache_handler.c @@ -439,7 +439,8 @@ void cache_init_uri(cache_t *cache, http_uri *uri) { cache_update_entry(entry, uri->filename, uri->webroot); uri->meta = &entry->meta; } else { - warning("No empty cache entry slot found"); + error("No empty cache entry slot found"); + // FIXME populate uri->meta with temporary data } } else { uri->meta = &entry->meta; diff --git a/src/cache_handler.h b/src/cache_handler.h index 8d5e0a8..2711bea 100644 --- a/src/cache_handler.h +++ b/src/cache_handler.h @@ -11,7 +11,7 @@ #include "lib/uri.h" -#define CACHE_ENTRIES 1024 +#define CACHE_ENTRIES 8192 #define CACHE_DIRTY 1 diff --git a/src/worker/local_handler.c b/src/worker/local_handler.c index 76702dc..152c671 100644 --- a/src/worker/local_handler.c +++ b/src/worker/local_handler.c @@ -165,9 +165,14 @@ static int local_handler(client_ctx_t *ctx) { return 0; } - res->status = http_get_status(200); cache_init_uri(ctx->conf->cache, uri); + if (uri->meta == NULL) { + res->status = http_get_status(500); + sprintf(err_msg, "Could not load metadata of file because all cache entry slots are occupied."); + return 0; + } + res->status = http_get_status(200); http_add_header_field(&res->hdr, "Accept-Ranges", mime_is_text(uri->meta->type) ? "bytes, lines" : "bytes"); if (!streq(req->method, "GET") && !streq(req->method, "HEAD")) {