Mercurial > hg > nginx-vendor-0-8
comparison src/http/modules/ngx_http_autoindex_handler.c @ 22:8b6db3bda591 NGINX_0_1_11
nginx 0.1.11
*) Feature: the worker_priority directive.
*) Change: both tcp_nopush and tcp_nodelay directives affect the
transferred response.
*) Bugfix: nginx did not call initgroups().
Thanks to Andrew Sitnikov and Andrei Nigmatulin.
*) Change: now the ngx_http_autoindex_module shows the file size in the
bytes.
*) Bugfix: the ngx_http_autoindex_module returned the 500 error if the
broken symlink was in a directory.
*) Bugfix: the files bigger than 4G could not be transferred using
sendfile.
*) Bugfix: if the backend was resolved to several backends and there
was an error while the response waiting then process may got caught
in an endless loop.
*) Bugfix: the worker process may exit with the "unknown cycle" message
when the /dev/poll method was used.
*) Bugfix: "close() channel failed" errors.
*) Bugfix: the autodetection of the "nobody" and "nogroup" groups.
*) Bugfix: the send_lowat directive did not work on Linux.
*) Bugfix: the segmentation fault occurred if there was no events
section in configuration.
*) Bugfix: nginx could not be built on OpenBSD.
*) Bugfix: the double slashes in "://" in the URI were converted to
":/".
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 02 Dec 2004 00:00:00 +0300 |
parents | 74b1868dd3cd |
children | 2879cd3a40cb |
comparison
equal
deleted
inserted
replaced
21:4eeb9cfef970 | 22:8b6db3bda591 |
---|---|
103 ; | 103 ; |
104 | 104 |
105 | 105 |
106 static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r) | 106 static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r) |
107 { | 107 { |
108 u_char *last, scale; | 108 u_char *last; |
109 size_t len; | 109 size_t len; |
110 off_t length; | |
111 ngx_tm_t tm; | 110 ngx_tm_t tm; |
112 ngx_int_t rc, size; | 111 ngx_int_t rc; |
113 ngx_uint_t i, level; | 112 ngx_uint_t i, level; |
114 ngx_err_t err; | 113 ngx_err_t err; |
115 ngx_buf_t *b; | 114 ngx_buf_t *b; |
116 ngx_chain_t out; | 115 ngx_chain_t out; |
117 ngx_str_t dname, fname; | 116 ngx_str_t dname, fname; |
305 + entry[i].name.len + entry[i].escape | 304 + entry[i].name.len + entry[i].escape |
306 + sizeof("\">") - 1 | 305 + sizeof("\">") - 1 |
307 + NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof(">") - 2 | 306 + NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof(">") - 2 |
308 + sizeof("</a>") - 1 | 307 + sizeof("</a>") - 1 |
309 + sizeof(" 28-Sep-1970 12:00 ") - 1 | 308 + sizeof(" 28-Sep-1970 12:00 ") - 1 |
310 + sizeof("1023G") - 1 | 309 + 19 |
311 + 2; | 310 + 2; |
312 } | 311 } |
313 | 312 |
314 if (!(b = ngx_create_temp_buf(r->pool, len))) { | 313 if (!(b = ngx_create_temp_buf(r->pool, len))) { |
315 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 314 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
381 tm.ngx_tm_year, | 380 tm.ngx_tm_year, |
382 tm.ngx_tm_hour, | 381 tm.ngx_tm_hour, |
383 tm.ngx_tm_min); | 382 tm.ngx_tm_min); |
384 | 383 |
385 if (entry[i].dir) { | 384 if (entry[i].dir) { |
386 b->last = ngx_cpymem(b->last, " -", sizeof(" -") - 1); | 385 b->last = ngx_cpymem(b->last, " -", |
386 sizeof(" -") - 1); | |
387 | 387 |
388 } else { | 388 } else { |
389 length = entry[i].size; | 389 b->last = ngx_sprintf(b->last, "%19O", entry[i].size); |
390 | |
391 if (length > 1024 * 1024 * 1024 - 1) { | |
392 size = (ngx_int_t) (length / (1024 * 1024 * 1024)); | |
393 if ((length % (1024 * 1024 * 1024)) | |
394 > (1024 * 1024 * 1024 / 2 - 1)) | |
395 { | |
396 size++; | |
397 } | |
398 scale = 'G'; | |
399 | |
400 } else if (length > 1024 * 1024 - 1) { | |
401 size = (ngx_int_t) (length / (1024 * 1024)); | |
402 if ((length % (1024 * 1024)) > (1024 * 1024 / 2 - 1)) { | |
403 size++; | |
404 } | |
405 scale = 'M'; | |
406 | |
407 } else if (length > 9999) { | |
408 size = (ngx_int_t) (length / 1024); | |
409 if (length % 1024 > 511) { | |
410 size++; | |
411 } | |
412 scale = 'K'; | |
413 | |
414 } else { | |
415 size = (ngx_int_t) length; | |
416 scale = ' '; | |
417 } | |
418 | |
419 b->last = ngx_sprintf(b->last, "%4i", size); | |
420 | |
421 if (scale != ' ') { | |
422 *b->last++ = scale; | |
423 } | |
424 } | 390 } |
425 | 391 |
426 *b->last++ = CR; | 392 *b->last++ = CR; |
427 *b->last++ = LF; | 393 *b->last++ = LF; |
428 } | 394 } |