From: Nishi Date: Sun, 20 Oct 2024 20:23:36 +0000 (+0000) Subject: add last-modified [release 2.05] X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=3a0b3f059092015de3fad21884e56257a8eeef75;p=tewi.git add last-modified [release 2.05] git-svn-id: file:///raid/svn-personal/tewi/trunk@389 8739d7e6-ffea-ec47-b151-bdff447c6205 --- diff --git a/Document/input/release/index.md b/Document/input/release/index.md index 47d5be6..7b4e027 100644 --- a/Document/input/release/index.md +++ b/Document/input/release/index.md @@ -1,11 +1,7 @@ \language ^en$ # New features in version $TCL:VERSION {Release notes} -## New directives -### MIMEFile -Supports the `mime.types` from the Apache HTTPd using `MIMEFile` directive. +Added last modifed date to the indexing. \language ^jp$ # Tewi HTTPd $TCL:VERSION の新機能 {リリース情報} -## 新しい命令 -### MIMEFile -`MIMEFile`命令を使用してApache HTTPdの`mime.types`が使えるようになりました。 +最終更新日時をインデックスに追加しました。 diff --git a/README b/README index 24fac60..42b0e2c 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -Tewi HTTPd version 2.04 +Tewi HTTPd version 2.05 Original by Nishi diff --git a/Server/server.c b/Server/server.c index 172059f..432c686 100644 --- a/Server/server.c +++ b/Server/server.c @@ -791,6 +791,7 @@ int tw_server_pass(void* ptr) { addstring(&str, " \n"); addstring(&str, " \n"); addstring(&str, " Filename\n"); + addstring(&str, " Last-modified\n"); addstring(&str, " MIME\n"); addstring(&str, " Size\n"); addstring(&str, " \n"); @@ -808,10 +809,14 @@ int tw_server_pass(void* ptr) { char* fpth = cm_strcat3(path, "/", items[i]); struct stat s; char size[512]; + char date[512]; char* showmime; char* mime; + struct tm* tm; size[0] = 0; stat(fpth, &s); + tm = localtime(&s.st_mtime); + strftime(date, 512, "%a, %d %b %Y %H:%M:%S %Z", tm); if(phase == 0 && !S_ISDIR(s.st_mode)) { free(fpth); continue; @@ -885,6 +890,7 @@ int tw_server_pass(void* ptr) { addstring(&str, "\n"); addstring(&str, " \"icon\"\n", icon); addstring(&str, " %h\n", items[i], itm); + addstring(&str, " %h \n", date); addstring(&str, " %h \n", showmime); addstring(&str, " %s \n", size); addstring(&str, "\n"); diff --git a/Server/tw_version.h b/Server/tw_version.h index c52de72..2d74233 100644 --- a/Server/tw_version.h +++ b/Server/tw_version.h @@ -7,8 +7,8 @@ extern "C" { #endif -#define TW_VERSION "2.04\0" -#define TW_VERSION_TEXT "Tewi HTTPd version 2.04" +#define TW_VERSION "2.05\0" +#define TW_VERSION_TEXT "Tewi HTTPd version 2.05" const char* tw_get_version(void); const char* tw_get_platform(void); diff --git a/example.conf b/example.conf index 3742ec4..402206a 100644 --- a/example.conf +++ b/example.conf @@ -25,7 +25,7 @@ DirectoryIndex index.html ReadmeFile README -DocumentRoot /var/www/html +DocumentRoot /var/www Define test Undefine test