Hecho #200
parent
2d96368282
commit
003e07cd34
|
@ -412,6 +412,7 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
|
||||||
+ nfi_sizeof_ssz("</td><td>")
|
+ nfi_sizeof_ssz("</td><td>")
|
||||||
+ nfi_sizeof_ssz(" 28-Sep-1970 12:00 ")
|
+ nfi_sizeof_ssz(" 28-Sep-1970 12:00 ")
|
||||||
+ nfi_sizeof_ssz("</td></tr>\n")
|
+ nfi_sizeof_ssz("</td></tr>\n")
|
||||||
|
+ 2 /* CR LF */
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +441,14 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
|
||||||
tp = ngx_timeofday();
|
tp = ngx_timeofday();
|
||||||
|
|
||||||
for (i = 0; i < entries.nelts; i++) {
|
for (i = 0; i < entries.nelts; i++) {
|
||||||
b->last = nfi_cpymem_ssz(b->last, "<a href=\"");
|
static const char _evenodd[] = { 'e', 'o' };
|
||||||
|
b->last = nfi_cpymem_ssz(b->last, "<tr class=\"");
|
||||||
|
*b->last++ = _evenodd[i & 0x01];
|
||||||
|
/*
|
||||||
|
* Alternative implementation:
|
||||||
|
* *b->last++ = (i & 0x01) ? 'e' : 'o';
|
||||||
|
*/
|
||||||
|
b->last = nfi_cpymem_ssz(b->last, "\"><a href=\"");
|
||||||
|
|
||||||
if (entry[i].escape) {
|
if (entry[i].escape) {
|
||||||
ngx_escape_uri(b->last, entry[i].name.data, entry[i].name.len,
|
ngx_escape_uri(b->last, entry[i].name.data, entry[i].name.len,
|
||||||
|
@ -449,8 +457,7 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
|
||||||
b->last += entry[i].name.len + entry[i].escape;
|
b->last += entry[i].name.len + entry[i].escape;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
b->last = ngx_cpymem(b->last, entry[i].name.data,
|
b->last = nfi_cpymem_str(b->last, entry[i].name);
|
||||||
entry[i].name.len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry[i].dir) {
|
if (entry[i].dir) {
|
||||||
|
@ -465,7 +472,6 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
|
||||||
if (entry[i].name.len - len) {
|
if (entry[i].name.len - len) {
|
||||||
if (len > NGX_HTTP_FANCYINDEX_NAME_LEN) {
|
if (len > NGX_HTTP_FANCYINDEX_NAME_LEN) {
|
||||||
copy = NGX_HTTP_FANCYINDEX_NAME_LEN - 3 + 1;
|
copy = NGX_HTTP_FANCYINDEX_NAME_LEN - 3 + 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
copy = NGX_HTTP_FANCYINDEX_NAME_LEN + 1;
|
copy = NGX_HTTP_FANCYINDEX_NAME_LEN + 1;
|
||||||
}
|
}
|
||||||
|
@ -480,7 +486,7 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len > NGX_HTTP_FANCYINDEX_NAME_LEN) {
|
if (len > NGX_HTTP_FANCYINDEX_NAME_LEN) {
|
||||||
b->last = ngx_cpymem(last, "..></a>", sizeof("..></a>") - 1);
|
b->last = nfi_cpymem_ssz(last, "..></a></td><td>");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (entry[i].dir && NGX_HTTP_FANCYINDEX_NAME_LEN - len > 0) {
|
if (entry[i].dir && NGX_HTTP_FANCYINDEX_NAME_LEN - len > 0) {
|
||||||
|
@ -488,33 +494,19 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
b->last = ngx_cpymem(b->last, "</a>", sizeof("</a>") - 1);
|
b->last = nfi_cpymem_ssz(b->last, "</a></td><td>");
|
||||||
ngx_memset(b->last, ' ', NGX_HTTP_FANCYINDEX_NAME_LEN - len);
|
|
||||||
b->last += NGX_HTTP_FANCYINDEX_NAME_LEN - len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*b->last++ = ' ';
|
|
||||||
|
|
||||||
ngx_gmtime(entry[i].mtime + tp->gmtoff * 60 * alcf->localtime, &tm);
|
|
||||||
|
|
||||||
b->last = ngx_sprintf(b->last, "%02d-%s-%d %02d:%02d ",
|
|
||||||
tm.ngx_tm_mday,
|
|
||||||
months[tm.ngx_tm_mon - 1],
|
|
||||||
tm.ngx_tm_year,
|
|
||||||
tm.ngx_tm_hour,
|
|
||||||
tm.ngx_tm_min);
|
|
||||||
|
|
||||||
if (alcf->exact_size) {
|
if (alcf->exact_size) {
|
||||||
if (entry[i].dir) {
|
if (entry[i].dir) {
|
||||||
b->last = nfi_cpymem_ssz(b->last, " -");
|
*b->last++ = '-';
|
||||||
} else {
|
} else {
|
||||||
b->last = ngx_sprintf(b->last, "%19O", entry[i].size);
|
b->last = ngx_sprintf(b->last, "%19O", entry[i].size);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (entry[i].dir) {
|
if (entry[i].dir) {
|
||||||
b->last = nfi_cpymem_ssz(b->last, " -");
|
*b->last++ = '-';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
length = entry[i].size;
|
length = entry[i].size;
|
||||||
|
|
||||||
|
@ -555,6 +547,16 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngx_gmtime(entry[i].mtime + tp->gmtoff * 60 * alcf->localtime, &tm);
|
||||||
|
|
||||||
|
b->last = ngx_sprintf(b->last, "</td><td>%02d-%s-%d %02d:%02d</td></tr>",
|
||||||
|
tm.ngx_tm_mday,
|
||||||
|
months[tm.ngx_tm_mon - 1],
|
||||||
|
tm.ngx_tm_year,
|
||||||
|
tm.ngx_tm_hour,
|
||||||
|
tm.ngx_tm_min);
|
||||||
|
|
||||||
|
|
||||||
*b->last++ = CR;
|
*b->last++ = CR;
|
||||||
*b->last++ = LF;
|
*b->last++ = LF;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue