comparison src/http/modules/ngx_http_static_handler.c @ 253:b6793bc5034b

nginx-0.0.2-2004-02-09-10:46:43 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 09 Feb 2004 07:46:43 +0000
parents 74994aeef848
children 70e1c7d2b83d
comparison
equal deleted inserted replaced
252:84b1c672ec5a 253:b6793bc5034b
85 if (rc != NGX_OK) { 85 if (rc != NGX_OK) {
86 return rc; 86 return rc;
87 } 87 }
88 88
89 /* 89 /*
90 * there is a valid cached open file, i.e by index handler, 90 * there is a valid cached open file, i.e by the index handler,
91 * and it must be already registered in r->cleanup 91 * and it should be already registered in r->cleanup
92 */ 92 */
93 93
94 if (r->cache && !r->cache->expired) { 94 if (r->cache && !r->cache->expired) {
95 return ngx_http_send_cached(r); 95 return ngx_http_send_cached(r);
96 } 96 }
98 log = r->connection->log; 98 log = r->connection->log;
99 99
100 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 100 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
101 101
102 /* 102 /*
103 * make a file name 103 * make a file name, reserve 2 bytes for a trailing '/'
104 * 2 bytes is for a trailing '/' in a possible redirect and for '\0' 104 * in a possible redirect and for the last '\0'
105 */ 105 */
106 106
107 ngx_test_null(name.data, 107 name.data = ngx_palloc(r->pool, clcf->doc_root.len + r->uri.len + 2);
108 ngx_palloc(r->pool, clcf->doc_root.len + r->uri.len + 2), 108 if (name.data == NULL) {
109 NGX_HTTP_INTERNAL_SERVER_ERROR); 109 return NGX_HTTP_INTERNAL_SERVER_ERROR;
110 }
110 111
111 location.data = ngx_cpymem(name.data, clcf->doc_root.data, 112 location.data = ngx_cpymem(name.data, clcf->doc_root.data,
112 clcf->doc_root.len); 113 clcf->doc_root.len);
113 last = ngx_cpystrn(location.data, r->uri.data, r->uri.len + 1); 114 last = ngx_cpystrn(location.data, r->uri.data, r->uri.len + 1);
114 name.len = last - name.data; 115 name.len = last - name.data;