Mercurial > hg > nginx-quic
comparison 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 |
comparison
equal
deleted
inserted
replaced
194:2357fa41738a | 195:8dee38ea9117 |
---|---|
42 int ngx_http_static_translate_handler(ngx_http_request_t *r) | 42 int ngx_http_static_translate_handler(ngx_http_request_t *r) |
43 { | 43 { |
44 int rc, level; | 44 int rc, level; |
45 char *location, *last; | 45 char *location, *last; |
46 ngx_err_t err; | 46 ngx_err_t err; |
47 ngx_http_cache_ctx_t ctx; | |
48 ngx_http_cache_conf_t *ccf; | |
47 ngx_http_core_loc_conf_t *clcf; | 49 ngx_http_core_loc_conf_t *clcf; |
48 | 50 |
49 if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) { | 51 if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) { |
50 return NGX_HTTP_NOT_ALLOWED; | 52 return NGX_HTTP_NOT_ALLOWED; |
51 } | 53 } |
71 "directory index of \"%s\" is forbidden", r->path.data); | 73 "directory index of \"%s\" is forbidden", r->path.data); |
72 | 74 |
73 return NGX_HTTP_FORBIDDEN; | 75 return NGX_HTTP_FORBIDDEN; |
74 } | 76 } |
75 | 77 |
76 /* "+ 2" is for trailing '/' in redirect and '\0' */ | 78 /* "+ 2" is for trailing '/' in possible redirect and '\0' */ |
77 ngx_test_null(r->file.name.data, | 79 ngx_test_null(r->file.name.data, |
78 ngx_palloc(r->pool, clcf->doc_root.len + r->uri.len + 2), | 80 ngx_palloc(r->pool, clcf->doc_root.len + r->uri.len + 2), |
79 NGX_HTTP_INTERNAL_SERVER_ERROR); | 81 NGX_HTTP_INTERNAL_SERVER_ERROR); |
80 | 82 |
81 location = ngx_cpymem(r->file.name.data, clcf->doc_root.data, | 83 location = ngx_cpymem(r->file.name.data, clcf->doc_root.data, |
82 clcf->doc_root.len), | 84 clcf->doc_root.len), |
83 | 85 |
84 last = ngx_cpystrn(location, r->uri.data, r->uri.len + 1); | 86 last = ngx_cpystrn(location, r->uri.data, r->uri.len + 1); |
85 | 87 |
86 ngx_log_debug(r->connection->log, "HTTP filename: '%s'" _ r->file.name.data); | 88 ngx_log_debug(r->connection->log, "HTTP filename: '%s'" _ r->file.name.data); |
89 | |
90 | |
91 /* STUB */ | |
92 ccf = NULL; | |
93 ctx.key.len = 0; | |
94 | |
95 #if 0 | |
96 ccf = ngx_http_get_module_loc_conf(r, ngx_http_cache_module); | |
97 | |
98 if (ccf->open_files) { | |
99 ctx->hash = ccf->open_files; | |
100 ctx->key = r->file.name; | |
101 | |
102 cache = ngx_http_cache_get_data(r, ctx); | |
103 | |
104 if (cache | |
105 && ((ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) | |
106 || ccf->hash->life_time >= ngx_time() - cache->updated)) | |
107 { | |
108 cache->refs++; | |
109 r->file.fd = cache->fd; | |
110 r->file.name = cache->key; | |
111 r->content_handler = ngx_http_static_handler; | |
112 | |
113 return NGX_OK; | |
114 } | |
115 | |
116 } else { | |
117 cache = NULL; | |
118 } | |
119 | |
120 #endif | |
87 | 121 |
88 #if (WIN9X) | 122 #if (WIN9X) |
89 | 123 |
90 if (ngx_win32_version < NGX_WIN_NT) { | 124 if (ngx_win32_version < NGX_WIN_NT) { |
91 | 125 |