diff --git a/mongoose.c b/mongoose.c index 4ed19b3a..e47f6377 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4122,6 +4122,8 @@ int mg_normalize_uri_path(const struct mg_str *in, struct mg_str *out) { #define MG_WS_NO_HOST_HEADER_MAGIC ((char *) 0x1) #endif +static const char *mg_version_header = "Mongoose/" MG_VERSION; + enum mg_http_proto_data_type { DATA_NONE, DATA_FILE, DATA_PUT }; struct mg_http_proto_data_file { @@ -5640,7 +5642,8 @@ void mg_send_response_line(struct mg_connection *nc, int status_code, status_message = "Internal Server Error"; break; } - mg_printf(nc, "HTTP/1.1 %d %s\r\n", status_code, status_message); + mg_printf(nc, "HTTP/1.1 %d %s\r\nServer: %s\r\n", status_code, status_message, + mg_version_header); if (extra_headers != NULL) { mg_printf(nc, "%s\r\n", extra_headers); } @@ -6426,16 +6429,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

"
+      "\n"
+      "

Index of %.*s

\n
" "" - "", + "\n" + "\n" + "", (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, "%s", ""); + mg_printf_http_chunk(nc, + "\n" + "
Name" "Modified" "Size



\n" + "
%s
\n" + "", + mg_version_header); mg_send_http_chunk(nc, "", 0); /* TODO(rojer): Remove when cesanta/dev/issues/197 is fixed. */ nc->flags |= MG_F_SEND_AND_CLOSE;