ref: a5061f44063493b08e54d4afc2f869dc8ff1dccf
parent: e509e5d2396318b661ad9bdb25391af4ffd32ad3
author: grobe0ba <grobe0ba@tcp80.org>
date: Mon Aug 1 16:10:12 EDT 2022
when file/dir mtime == 0, send current time/date in Last-Modified header this applies to everything, but is mostly intended for the scripts executed via the execfs integration, which always have mtime = 0.
--- a/tcp80.c
+++ b/tcp80.c
@@ -342,7 +342,12 @@
print("Date: %s, %.2d %s %s %s %s\r\n", f[0], tm->mday, f[1], f[5], f[3],
f[4]);
}
- if(d && (tm = localtime(d->mtime))){
+ if(d && d->mtime != 0 && (tm = localtime(d->mtime))){
+ nstrcpy(buf, asctime(tm), sizeof(buf));
+ if(tokenize(buf, f, 6) == 6)
+ print("Last-Modified: %s, %.2d %s %s %s %s\r\n", f[0], tm->mday, f[1], f[5],
+ f[3], f[4]);
+ }else if(d && d->mtime == 0 && (tm = localtime(time(0)))){
nstrcpy(buf, asctime(tm), sizeof(buf));
if(tokenize(buf, f, 6) == 6)
print("Last-Modified: %s, %.2d %s %s %s %s\r\n", f[0], tm->mday, f[1], f[5],