Mercurial > hg > nginx-vendor-1-0
comparison src/http/modules/ngx_http_autoindex_module.c @ 492:98143f74eb3d NGINX_0_7_58
nginx 0.7.58
*) Feature: a "listen" directive of the mail proxy module supports IPv6.
*) Feature: the "image_filter_jpeg_quality" directive.
*) Feature: the "client_body_in_single_buffer" directive.
*) Feature: the $request_body variable.
*) Bugfix: in ngx_http_autoindex_module in file name links having a ":"
symbol in the name.
*) Bugfix: "make upgrade" procedure did not work; the bug had appeared
in 0.7.53.
Thanks to Denis F. Latypoff.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 18 May 2009 00:00:00 +0400 |
parents | 549994537f15 |
children | f39b9e29530d |
comparison
equal
deleted
inserted
replaced
491:bb2281a3edb6 | 492:98143f74eb3d |
---|---|
23 | 23 |
24 | 24 |
25 typedef struct { | 25 typedef struct { |
26 ngx_str_t name; | 26 ngx_str_t name; |
27 size_t utf_len; | 27 size_t utf_len; |
28 ngx_uint_t escape; | 28 size_t escape; |
29 ngx_uint_t dir; | 29 |
30 unsigned dir:1; | |
31 unsigned colon:1; | |
32 | |
30 time_t mtime; | 33 time_t mtime; |
31 off_t size; | 34 off_t size; |
32 } ngx_http_autoindex_entry_t; | 35 } ngx_http_autoindex_entry_t; |
33 | 36 |
34 | 37 |
336 entry->utf_len = ngx_utf8_length(entry->name.data, entry->name.len); | 339 entry->utf_len = ngx_utf8_length(entry->name.data, entry->name.len); |
337 } else { | 340 } else { |
338 entry->utf_len = len; | 341 entry->utf_len = len; |
339 } | 342 } |
340 | 343 |
344 entry->colon = (ngx_strchr(entry->name.data, ':') != NULL); | |
345 | |
341 entry->dir = ngx_de_is_dir(&dir); | 346 entry->dir = ngx_de_is_dir(&dir); |
342 entry->mtime = ngx_de_mtime(&dir); | 347 entry->mtime = ngx_de_mtime(&dir); |
343 entry->size = ngx_de_size(&dir); | 348 entry->size = ngx_de_size(&dir); |
344 } | 349 } |
345 | 350 |
361 for (i = 0; i < entries.nelts; i++) { | 366 for (i = 0; i < entries.nelts; i++) { |
362 len += sizeof("<a href=\"") - 1 | 367 len += sizeof("<a href=\"") - 1 |
363 + entry[i].name.len + entry[i].escape | 368 + entry[i].name.len + entry[i].escape |
364 + 1 /* 1 is for "/" */ | 369 + 1 /* 1 is for "/" */ |
365 + sizeof("\">") - 1 | 370 + sizeof("\">") - 1 |
366 + entry[i].name.len - entry[i].utf_len | 371 + entry[i].name.len - entry[i].utf_len + entry[i].colon * 2 |
367 + NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof(">") - 2 | 372 + NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof(">") - 2 |
368 + sizeof("</a>") - 1 | 373 + sizeof("</a>") - 1 |
369 + sizeof(" 28-Sep-1970 12:00 ") - 1 | 374 + sizeof(" 28-Sep-1970 12:00 ") - 1 |
370 + 20 /* the file size */ | 375 + 20 /* the file size */ |
371 + 2; | 376 + 2; |
393 | 398 |
394 tp = ngx_timeofday(); | 399 tp = ngx_timeofday(); |
395 | 400 |
396 for (i = 0; i < entries.nelts; i++) { | 401 for (i = 0; i < entries.nelts; i++) { |
397 b->last = ngx_cpymem(b->last, "<a href=\"", sizeof("<a href=\"") - 1); | 402 b->last = ngx_cpymem(b->last, "<a href=\"", sizeof("<a href=\"") - 1); |
403 | |
404 if (entry[i].colon) { | |
405 *b->last++ = '.'; | |
406 *b->last++ = '/'; | |
407 } | |
398 | 408 |
399 if (entry[i].escape) { | 409 if (entry[i].escape) { |
400 ngx_escape_uri(b->last, entry[i].name.data, entry[i].name.len, | 410 ngx_escape_uri(b->last, entry[i].name.data, entry[i].name.len, |
401 NGX_ESCAPE_HTML); | 411 NGX_ESCAPE_HTML); |
402 | 412 |