mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-06 13:37:34 +08:00
Integrate https://github.com/cesanta/mongoose/pull/1096 - dir listing nits
PUBLISHED_FROM=a343bd61f98cbcc0f8cab02a62b912e494c27601
This commit is contained in:
parent
96e762d4a1
commit
b015e33ea5
27
mongoose.c
27
mongoose.c
@ -7731,7 +7731,7 @@ static void mg_print_dir_entry(struct mg_connection *nc, const char *file_name,
|
|||||||
href = mg_url_encode(mg_mk_str(file_name));
|
href = mg_url_encode(mg_mk_str(file_name));
|
||||||
mg_printf_http_chunk(nc,
|
mg_printf_http_chunk(nc,
|
||||||
"<tr><td><a href=\"%s%s\">%s%s</a></td>"
|
"<tr><td><a href=\"%s%s\">%s%s</a></td>"
|
||||||
"<td>%s</td><td name=%" INT64_FMT ">%s</td></tr>\n",
|
"<td>%s</td><td name=\"%" INT64_FMT "\">%s</td></tr>",
|
||||||
href.p, slash, path, slash, mod, is_dir ? -1 : fsize,
|
href.p, slash, path, slash, mod, is_dir ? -1 : fsize,
|
||||||
size);
|
size);
|
||||||
free((void *) href.p);
|
free((void *) href.p);
|
||||||
@ -7797,23 +7797,24 @@ static void mg_send_directory_listing(struct mg_connection *nc, const char *dir,
|
|||||||
|
|
||||||
mg_printf_http_chunk(
|
mg_printf_http_chunk(
|
||||||
nc,
|
nc,
|
||||||
"<html><head><title>Index of %.*s</title>%s%s"
|
"<!DOCTYPE html><html><head><title>Index of %.*s</title>%s%s"
|
||||||
"<style>th,td {text-align: left; padding-right: 1em; "
|
"<style>th,td {text-align: left; padding-right: 1em; "
|
||||||
"font-family: monospace; }</style></head>\n"
|
"font-family: monospace; }</style></head>"
|
||||||
"<body><h1>Index of %.*s</h1>\n<table cellpadding=0><thead>"
|
"<body><h1>Index of %.*s</h1><table cellpadding=\"0\"><thead>"
|
||||||
"<tr><th><a href=# rel=0>Name</a></th><th>"
|
"<tr><th><a href=\"#\" rel=\"0\">Name</a></th><th>"
|
||||||
"<a href=# rel=1>Modified</a</th>"
|
"<a href=\"#\" rel=\"1\">Modified</a></th>"
|
||||||
"<th><a href=# rel=2>Size</a></th></tr>"
|
"<th><a href=\"#\" rel=\"2\">Size</a></th></tr>"
|
||||||
"<tr><td colspan=3><hr></td></tr>\n"
|
"<tr><td colspan=\"3\"><hr></td></tr>"
|
||||||
"</thead>\n"
|
"</thead>"
|
||||||
"<tbody id=tb>",
|
"<tbody id=\"tb\">",
|
||||||
(int) hm->uri.len, hm->uri.p, sort_js_code, sort_js_code2,
|
(int) hm->uri.len, hm->uri.p, sort_js_code, sort_js_code2,
|
||||||
(int) hm->uri.len, hm->uri.p);
|
(int) hm->uri.len, hm->uri.p);
|
||||||
mg_scan_directory(nc, dir, opts, mg_print_dir_entry);
|
mg_scan_directory(nc, dir, opts, mg_print_dir_entry);
|
||||||
mg_printf_http_chunk(nc,
|
mg_printf_http_chunk(nc,
|
||||||
"</tbody><tr><td colspan=3><hr></td></tr>\n"
|
"</tbody>"
|
||||||
"</table>\n"
|
"<tfoot><tr><td colspan=\"3\"><hr></td></tr></tfoot>"
|
||||||
"<address>%s</address>\n"
|
"</table>"
|
||||||
|
"<address>%s</address>"
|
||||||
"</body></html>",
|
"</body></html>",
|
||||||
mg_version_header);
|
mg_version_header);
|
||||||
mg_send_http_chunk(nc, "", 0);
|
mg_send_http_chunk(nc, "", 0);
|
||||||
|
@ -2102,7 +2102,7 @@ static void mg_print_dir_entry(struct mg_connection *nc, const char *file_name,
|
|||||||
href = mg_url_encode(mg_mk_str(file_name));
|
href = mg_url_encode(mg_mk_str(file_name));
|
||||||
mg_printf_http_chunk(nc,
|
mg_printf_http_chunk(nc,
|
||||||
"<tr><td><a href=\"%s%s\">%s%s</a></td>"
|
"<tr><td><a href=\"%s%s\">%s%s</a></td>"
|
||||||
"<td>%s</td><td name=%" INT64_FMT ">%s</td></tr>\n",
|
"<td>%s</td><td name=\"%" INT64_FMT "\">%s</td></tr>",
|
||||||
href.p, slash, path, slash, mod, is_dir ? -1 : fsize,
|
href.p, slash, path, slash, mod, is_dir ? -1 : fsize,
|
||||||
size);
|
size);
|
||||||
free((void *) href.p);
|
free((void *) href.p);
|
||||||
@ -2168,23 +2168,24 @@ static void mg_send_directory_listing(struct mg_connection *nc, const char *dir,
|
|||||||
|
|
||||||
mg_printf_http_chunk(
|
mg_printf_http_chunk(
|
||||||
nc,
|
nc,
|
||||||
"<html><head><title>Index of %.*s</title>%s%s"
|
"<!DOCTYPE html><html><head><title>Index of %.*s</title>%s%s"
|
||||||
"<style>th,td {text-align: left; padding-right: 1em; "
|
"<style>th,td {text-align: left; padding-right: 1em; "
|
||||||
"font-family: monospace; }</style></head>\n"
|
"font-family: monospace; }</style></head>"
|
||||||
"<body><h1>Index of %.*s</h1>\n<table cellpadding=0><thead>"
|
"<body><h1>Index of %.*s</h1><table cellpadding=\"0\"><thead>"
|
||||||
"<tr><th><a href=# rel=0>Name</a></th><th>"
|
"<tr><th><a href=\"#\" rel=\"0\">Name</a></th><th>"
|
||||||
"<a href=# rel=1>Modified</a</th>"
|
"<a href=\"#\" rel=\"1\">Modified</a></th>"
|
||||||
"<th><a href=# rel=2>Size</a></th></tr>"
|
"<th><a href=\"#\" rel=\"2\">Size</a></th></tr>"
|
||||||
"<tr><td colspan=3><hr></td></tr>\n"
|
"<tr><td colspan=\"3\"><hr></td></tr>"
|
||||||
"</thead>\n"
|
"</thead>"
|
||||||
"<tbody id=tb>",
|
"<tbody id=\"tb\">",
|
||||||
(int) hm->uri.len, hm->uri.p, sort_js_code, sort_js_code2,
|
(int) hm->uri.len, hm->uri.p, sort_js_code, sort_js_code2,
|
||||||
(int) hm->uri.len, hm->uri.p);
|
(int) hm->uri.len, hm->uri.p);
|
||||||
mg_scan_directory(nc, dir, opts, mg_print_dir_entry);
|
mg_scan_directory(nc, dir, opts, mg_print_dir_entry);
|
||||||
mg_printf_http_chunk(nc,
|
mg_printf_http_chunk(nc,
|
||||||
"</tbody><tr><td colspan=3><hr></td></tr>\n"
|
"</tbody>"
|
||||||
"</table>\n"
|
"<tfoot><tr><td colspan=\"3\"><hr></td></tr></tfoot>"
|
||||||
"<address>%s</address>\n"
|
"</table>"
|
||||||
|
"<address>%s</address>"
|
||||||
"</body></html>",
|
"</body></html>",
|
||||||
mg_version_header);
|
mg_version_header);
|
||||||
mg_send_http_chunk(nc, "", 0);
|
mg_send_http_chunk(nc, "", 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user