comparison src/http/modules/ngx_http_autoindex_module.c @ 72:b31656313b59 NGINX_0_1_36

nginx 0.1.36 *) Change: if the request header has duplicate the "Host", "Connection", "Content-Length", or "Authorization" lines, then nginx now returns the 400 error. *) Change: the "post_accept_timeout" directive was canceled. *) Feature: the "default", "af=", "bl=", "deferred", and "bind" parameters of the "listen" directive. *) Feature: the FreeBSD accept filters support. *) Feature: the Linux TCP_DEFER_ACCEPT support. *) Bugfix: the ngx_http_autoindex_module did not support the file names in UTF-8. *) Bugfix: the new log file can be rotated by the -USR1 signal only if the reconfiguration by the -HUP signal was made twice.
author Igor Sysoev <http://sysoev.ru>
date Wed, 15 Jun 2005 00:00:00 +0400
parents 056fd0e5a5a6
children 77969b24f355
comparison
equal deleted inserted replaced
71:66f1f40f29d6 72:b31656313b59
215 == NGX_ERROR) 215 == NGX_ERROR)
216 { 216 {
217 return ngx_http_autoindex_error(r, &dir, dname.data); 217 return ngx_http_autoindex_error(r, &dir, dname.data);
218 } 218 }
219 219
220 r->headers_out.status = NGX_HTTP_OK;
221 r->headers_out.content_type.len = sizeof("text/html") - 1;
222 r->headers_out.content_type.data = (u_char *) "text/html";
223
224 rc = ngx_http_send_header(r);
225
226 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
227 return rc;
228 }
229
220 fname.len = 0; 230 fname.len = 0;
221 #if (NGX_SUPPRESS_WARN) 231 #if (NGX_SUPPRESS_WARN)
222 fname.data = NULL; 232 fname.data = NULL;
223 #endif 233 #endif
224 234
332 + NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof("&gt;") - 2 342 + NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof("&gt;") - 2
333 + sizeof("</a>") - 1 343 + sizeof("</a>") - 1
334 + sizeof(" 28-Sep-1970 12:00 ") - 1 344 + sizeof(" 28-Sep-1970 12:00 ") - 1
335 + 19 345 + 19
336 + 2; 346 + 2;
347
348 if (r->utf8) {
349 len += entry[i].name.len - ngx_utf_length(&entry[i].name);
350 }
337 } 351 }
338 352
339 b = ngx_create_temp_buf(r->pool, len); 353 b = ngx_create_temp_buf(r->pool, len);
340 if (b == NULL) { 354 if (b == NULL) {
341 return NGX_HTTP_INTERNAL_SERVER_ERROR; 355 return NGX_HTTP_INTERNAL_SERVER_ERROR;
378 *b->last++ = '>'; 392 *b->last++ = '>';
379 393
380 b->last = ngx_cpystrn(b->last, entry[i].name.data, 394 b->last = ngx_cpystrn(b->last, entry[i].name.data,
381 NGX_HTTP_AUTOINDEX_NAME_LEN + 1); 395 NGX_HTTP_AUTOINDEX_NAME_LEN + 1);
382 396
383 len = entry[i].name.len; 397 if (r->utf8) {
398 len = ngx_utf_length(&entry[i].name);
399 } else {
400 len = entry[i].name.len;
401 }
384 402
385 if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) { 403 if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) {
386 b->last = ngx_cpymem(b->last - 3, "..&gt;</a>", 404 b->last = ngx_cpymem(b->last - 3, "..&gt;</a>",
387 sizeof("..&gt;</a>") - 1); 405 sizeof("..&gt;</a>") - 1);
388 406
424 442
425 b->last = ngx_cpymem(b->last, "</pre><hr>", sizeof("</pre><hr>") - 1); 443 b->last = ngx_cpymem(b->last, "</pre><hr>", sizeof("</pre><hr>") - 1);
426 444
427 b->last = ngx_cpymem(b->last, tail, sizeof(tail) - 1); 445 b->last = ngx_cpymem(b->last, tail, sizeof(tail) - 1);
428 446
429 r->headers_out.status = NGX_HTTP_OK;
430 r->headers_out.content_length_n = b->last - b->pos;
431 r->headers_out.content_type.len = sizeof("text/html") - 1;
432 r->headers_out.content_type.data = (u_char *) "text/html";
433
434 rc = ngx_http_send_header(r);
435
436 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
437 return rc;
438 }
439
440 if (r->main == NULL) { 447 if (r->main == NULL) {
441 b->last_buf = 1; 448 b->last_buf = 1;
442 } 449 }
443 450
444 b->last_in_chain = 1; 451 b->last_in_chain = 1;