[PATCH 5/5] httpd: Support multiple ETag in If-None-Match

Sergey Ponomarev stokito at gmail.com
Mon Jul 20 14:08:30 UTC 2020


The If-None-Match header many have multiple ETags https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26
Even if httpd returns a single ETag clients may want to send few of them.
Since ETags are always quoted the easiest way to check is just to check a substring.

Signed-off-by: Sergey Ponomarev <stokito at gmail.com>
---
 networking/httpd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/networking/httpd.c b/networking/httpd.c
index c2f2d803b..67bebb935 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1744,9 +1744,9 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
 #if ENABLE_FEATURE_HTTPD_CACHE
 	real_etag = make_etag();
 	if (verbose)
-		bb_perror_msg("req_etag and real_etag: '%s' '%s'\n", req_etag, real_etag);
+		bb_perror_msg("If-None-Match and real ETag are: '%s' '%s'\n", req_etag, real_etag);
 	if (req_etag) {
-		if (!strcmp(req_etag, real_etag)) {
+		if (strstr(req_etag, real_etag) != NULL) {
 			// Already 304 so ETag not needed and can be freed
 			free(real_etag);
 			real_etag = NULL;
-- 
2.25.1



More information about the busybox mailing list