[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 5/5] httpd: Support multiple ETag in If-None-Match
From:       Sergey Ponomarev <stokito () gmail ! com>
Date:       2020-07-20 14:08:30
Message-ID: 20200720140830.30989-1-stokito () gmail ! com
[Download RAW message or body]

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@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

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic