Mercurial > hg > nginx-quic
diff src/http/modules/ngx_http_static_handler.c @ 195:8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 25 Nov 2003 20:44:56 +0000 |
parents | 02a715e85df1 |
children | 0b81c7a0b133 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_static_handler.c +++ b/src/http/modules/ngx_http_static_handler.c @@ -44,6 +44,8 @@ int ngx_http_static_translate_handler(ng int rc, level; char *location, *last; ngx_err_t err; + ngx_http_cache_ctx_t ctx; + ngx_http_cache_conf_t *ccf; ngx_http_core_loc_conf_t *clcf; if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) { @@ -73,7 +75,7 @@ int ngx_http_static_translate_handler(ng return NGX_HTTP_FORBIDDEN; } - /* "+ 2" is for trailing '/' in redirect and '\0' */ + /* "+ 2" is for trailing '/' in possible redirect and '\0' */ ngx_test_null(r->file.name.data, ngx_palloc(r->pool, clcf->doc_root.len + r->uri.len + 2), NGX_HTTP_INTERNAL_SERVER_ERROR); @@ -85,6 +87,38 @@ int ngx_http_static_translate_handler(ng ngx_log_debug(r->connection->log, "HTTP filename: '%s'" _ r->file.name.data); + + /* STUB */ + ccf = NULL; + ctx.key.len = 0; + +#if 0 + ccf = ngx_http_get_module_loc_conf(r, ngx_http_cache_module); + + if (ccf->open_files) { + ctx->hash = ccf->open_files; + ctx->key = r->file.name; + + cache = ngx_http_cache_get_data(r, ctx); + + if (cache + && ((ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) + || ccf->hash->life_time >= ngx_time() - cache->updated)) + { + cache->refs++; + r->file.fd = cache->fd; + r->file.name = cache->key; + r->content_handler = ngx_http_static_handler; + + return NGX_OK; + } + + } else { + cache = NULL; + } + +#endif + #if (WIN9X) if (ngx_win32_version < NGX_WIN_NT) {