shreemaan-abhishek commented on code in PR #10733:
URL: https://github.com/apache/apisix/pull/10733#discussion_r1439061781
##########
t/plugin/response-rewrite3.t:
##########
@@ -53,6 +53,45 @@ add_block_preprocessor(sub {
}
}
}
+
+ server {
+ listen 11452;
+ location /brotli_hello {
+ content_by_lua_block {
+ ngx.req.read_body()
+ local s = "hello world hello world hello world"
+ ngx.header['Content-Length'] = #s + 1
+ ngx.say(s)
+ }
+ header_filter_by_lua_block {
+ local conf = {
+ comp_level = 6,
+ http_version = 1.1,
+ lgblock = 0,
+ lgwin = 19,
+ min_length = 1,
+ mode = 0,
+ types = "*",
+ }
+ local brotli = require("apisix.plugins.brotli")
Review Comment:
if I am not wrong, you are importing this because nginx doesn't come with
brotli by default.
##########
apisix/plugins/response-rewrite.lua:
##########
@@ -294,6 +347,12 @@ function _M.body_filter(conf, ctx)
core.log.error("filters may not work as expected, inflate gzip
err: ", err)
return
end
+ elseif ctx.response_encoding == "br" and is_loaded then
Review Comment:
please choose a better name for `is_loaded`.
##########
apisix/plugins/response-rewrite.lua:
##########
@@ -227,6 +228,58 @@ local function inflate_gzip(data)
end
+local function brotli_stream_decode(read_inputs, write_outputs)
+ -- read 64k data per times
Review Comment:
is there any reasoning behind using 64k?
--
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]