ithewei há 6 anos atrás
pai
commit
3409cf37c4
2 ficheiros alterados com 9 adições e 6 exclusões
  1. 1 1
      http/server/http_page.cpp
  2. 8 5
      http/server/http_page.h

+ 1 - 1
http/server/http_page.cpp

@@ -48,12 +48,12 @@ void make_index_of_page(const char* dir, std::string& page, const char* url) {
                 len < AUTOINDEX_FILENAME_MAXLEN ? item.name : std::string(item.name, item.name+AUTOINDEX_FILENAME_MAXLEN-4).append("...").c_str(),
                 item.type == 'd' ? "/" : "");
         page += c_str;
-        page += std::string(AUTOINDEX_FILENAME_MAXLEN - len, ' ');
         if (strcmp(item.name, "..") != 0) {
             // mtime
             struct tm* tm = localtime(&item.mtime);
             snprintf(c_str, sizeof(c_str), "%04d-%02d-%02d %02d:%02d:%02d        ",
                     tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
+            page += std::string(AUTOINDEX_FILENAME_MAXLEN - len, ' ');
             page += c_str;
             // size
             if (item.type == 'd') {

+ 8 - 5
http/server/http_page.h

@@ -23,15 +23,18 @@ void make_http_status_page(http_status status_code, std::string& page);
 <!DOCTYPE html>
 <html>
 <head>
-  <title>Index of</title>
+  <title>Index of /downloads/</title>
 </head>
 <body>
-  <h1>Index of</h1>
+  <h1>Index of /downloads/</h1>
   <hr>
   <pre>
-  <a href="../">../</a>
-  <a href="images/">images/</a>                                  2019-08-22 19:06:05                 -
-  <a href="README.txt">README.txt</a>                                2019-08-22 19:06:05                 8.88K
+<a href="../">../</a>
+<a href="docs/">docs/</a>                                             2019-08-23 15:27:48        -
+<a href="examples/">examples/</a>                                         2019-08-23 15:27:52        -
+<a href="README.txt">README.txt</a>                                        2019-08-23 19:15:42        0
+<a href="release/">release/</a>                                          2019-08-23 15:28:52        -
+
   </pre>
   <hr>
 </body>