Mercurial > hg > nginx
comparison src/http/modules/ngx_http_autoindex_module.c @ 2120:2f2052fdd882
fix utf-8 names in autoindex
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 25 Jul 2008 14:29:05 +0000 |
parents | 2a92804f4109 |
children | 8e4b9d2acde8 |
comparison
equal
deleted
inserted
replaced
2119:0799703985ef | 2120:2f2052fdd882 |
---|---|
133 static ngx_int_t | 133 static ngx_int_t |
134 ngx_http_autoindex_handler(ngx_http_request_t *r) | 134 ngx_http_autoindex_handler(ngx_http_request_t *r) |
135 { | 135 { |
136 u_char *last, *filename, scale; | 136 u_char *last, *filename, scale; |
137 off_t length; | 137 off_t length; |
138 size_t len, copy, allocated, root; | 138 size_t len, utf_len, allocated, root; |
139 ngx_tm_t tm; | 139 ngx_tm_t tm; |
140 ngx_err_t err; | 140 ngx_err_t err; |
141 ngx_buf_t *b; | 141 ngx_buf_t *b; |
142 ngx_int_t rc, size; | 142 ngx_int_t rc, size; |
143 ngx_str_t path; | 143 ngx_str_t path; |
410 *b->last++ = '"'; | 410 *b->last++ = '"'; |
411 *b->last++ = '>'; | 411 *b->last++ = '>'; |
412 | 412 |
413 len = entry[i].utf_len; | 413 len = entry[i].utf_len; |
414 | 414 |
415 if (entry[i].name.len - len) { | 415 if (entry[i].name.len != len) { |
416 if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) { | 416 if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) { |
417 copy = NGX_HTTP_AUTOINDEX_NAME_LEN - 3 + 1; | 417 utf_len = NGX_HTTP_AUTOINDEX_NAME_LEN - 3 + 1; |
418 | 418 |
419 } else { | 419 } else { |
420 copy = NGX_HTTP_AUTOINDEX_NAME_LEN + 1; | 420 utf_len = NGX_HTTP_AUTOINDEX_NAME_LEN + 1; |
421 } | 421 } |
422 | 422 |
423 b->last = ngx_utf_cpystrn(b->last, entry[i].name.data, copy); | 423 b->last = ngx_utf_cpystrn(b->last, entry[i].name.data, |
424 utf_len, entry[i].name.len + 1); | |
424 last = b->last; | 425 last = b->last; |
425 | 426 |
426 } else { | 427 } else { |
427 b->last = ngx_cpystrn(b->last, entry[i].name.data, | 428 b->last = ngx_cpystrn(b->last, entry[i].name.data, |
428 NGX_HTTP_AUTOINDEX_NAME_LEN + 1); | 429 NGX_HTTP_AUTOINDEX_NAME_LEN + 1); |