[PATCH 2/2] Generate ETag similar to Nginx and BusyBox HTTPD
Sergey Ponomarev
stokito at gmail.com
Tue Jan 12 17:20:57 EST 2021
Thus user run Luci on them and all cached files will work as previous because ETag is the same.
---
file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/file.c b/file.c
index 759ffd6..e0a4fb3 100644
--- a/file.c
+++ b/file.c
@@ -300,8 +300,9 @@ static const char * uh_file_mime_lookup(const char *path)
static const char * uh_file_mktag(struct stat *s, char *buf, int len)
{
+ /* ETag is "hex(last_mod)-hex(file_size)" e.g. "5e132e20-417" */
snprintf(buf, len, "\"%" PRIx64 "-%" PRIx64 "\"",
- s->st_size, (uint64_t)s->st_mtime);
+ (uint64_t)s->st_mtime, s->st_size);
return buf;
}
--
2.27.0
More information about the openwrt-devel
mailing list