From b015e33ea5d3000b7568f6a92123cd07dc32008c Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Fri, 14 Feb 2020 08:24:30 +0000 Subject: [PATCH] Integrate https://github.com/cesanta/mongoose/pull/1096 - dir listing nits PUBLISHED_FROM=a343bd61f98cbcc0f8cab02a62b912e494c27601 --- mongoose.c | 27 ++++++++++++++------------- src/mg_http.c | 27 ++++++++++++++------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/mongoose.c b/mongoose.c index e01ba0a9..eab88d93 100644 --- a/mongoose.c +++ b/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)); mg_printf_http_chunk(nc, "%s%s" - "%s%s\n", + "%s%s", href.p, slash, path, slash, mod, is_dir ? -1 : fsize, size); 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( nc, - "Index of %.*s%s%s" + "Index of %.*s%s%s" "\n" - "

Index of %.*s

\n" - "" - "\n" - "\n" - "", + "font-family: monospace; }" + "

Index of %.*s

Name" - "Modified" - "Size

" + "" + "" + "" + "" + "", (int) hm->uri.len, hm->uri.p, sort_js_code, sort_js_code2, (int) hm->uri.len, hm->uri.p); mg_scan_directory(nc, dir, opts, mg_print_dir_entry); mg_printf_http_chunk(nc, - "\n" - "
Name" + "ModifiedSize


\n" - "
%s
\n" + "" + "
" + "" + "
%s
" "", mg_version_header); mg_send_http_chunk(nc, "", 0); diff --git a/src/mg_http.c b/src/mg_http.c index 6d159192..7f780247 100644 --- a/src/mg_http.c +++ b/src/mg_http.c @@ -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)); mg_printf_http_chunk(nc, "%s%s" - "%s%s\n", + "%s%s", href.p, slash, path, slash, mod, is_dir ? -1 : fsize, size); 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( nc, - "Index of %.*s%s%s" + "Index of %.*s%s%s" "\n" - "

Index of %.*s

\n" - "" - "\n" - "\n" - "", + "font-family: monospace; }" + "

Index of %.*s

Name" - "Modified" - "Size

" + "" + "" + "" + "" + "", (int) hm->uri.len, hm->uri.p, sort_js_code, sort_js_code2, (int) hm->uri.len, hm->uri.p); mg_scan_directory(nc, dir, opts, mg_print_dir_entry); mg_printf_http_chunk(nc, - "\n" - "
Name" + "ModifiedSize


\n" - "
%s
\n" + "" + "
" + "" + "
%s
" "", mg_version_header); mg_send_http_chunk(nc, "", 0);