Baoyuantop commented on code in PR #12853:
URL: https://github.com/apache/apisix/pull/12853#discussion_r2666825752


##########
apisix/plugins/brotli.lua:
##########
@@ -152,6 +152,30 @@ local function check_accept_encoding(ctx)
 end
 
 
+local function weak_etag_header()
+    local etag = ngx.header.etag 
+    if not etag then
+        return
+    end
+
+    local regex = [[^(W/)?"(.*)"$]]
+    local matched, err = ngx.re.match(etag, regex, "jo")
+    if not matched then
+        -- not standard etag, no quote
+        ngx.header.etag = nil
+        return
+    end
+
+    if not matched[1] then
+        -- strong etag, downgrade it
+        ngx.header.etag = [[W/"]] .. matched[2] .. [["]]

Review Comment:
   Hi @yuweizzz, similar issues exist in other parts of the code; please 
correct them all.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to