You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/08/13 02:01:18 UTC

[GitHub] [apisix] RocFang opened a new pull request #4817: feat(gzip): support single string type and * to match any type

RocFang opened a new pull request #4817:
URL: https://github.com/apache/apisix/pull/4817


   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   right now, type of types attr is array, and we dont't have a method to support the special `gzip_types *` config in Nginx Core. So maybe we can change type of types to support single string, and support * too.
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [x] Have you modified the corresponding document?
   * [x] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] RocFang commented on a change in pull request #4817: feat(gzip): support single string type and * to match any type

Posted by GitBox <gi...@apache.org>.
RocFang commented on a change in pull request #4817:
URL: https://github.com/apache/apisix/pull/4817#discussion_r688212725



##########
File path: apisix/plugins/gzip.lua
##########
@@ -21,17 +21,26 @@ local req_http_version = ngx.req.http_version
 local str_sub = string.sub
 local ipairs = ipairs
 local tonumber = tonumber
+local type = type
 
 
 local schema = {
     type = "object",
     properties = {
         types = {
-            type = "array",
-            minItems = 1,
-            items = {
-                type = "string",
-                minLength = 1,
+            anyOf = {
+                {
+                    type = "array",
+                    minItem = 1,
+                    items = {
+                        type = "string",
+                        minLength = 1,
+                    },
+                },
+                {
+                    type = "string",

Review comment:
       @spacewander Yes, I think it's simpler to use` {"*"}`, this pr only try to follow nginx's config strictly.
   If that not import, I will change it to `{"*"}`




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] RocFang commented on a change in pull request #4817: feat(gzip): support single string type and * to match any type

Posted by GitBox <gi...@apache.org>.
RocFang commented on a change in pull request #4817:
URL: https://github.com/apache/apisix/pull/4817#discussion_r688212725



##########
File path: apisix/plugins/gzip.lua
##########
@@ -21,17 +21,26 @@ local req_http_version = ngx.req.http_version
 local str_sub = string.sub
 local ipairs = ipairs
 local tonumber = tonumber
+local type = type
 
 
 local schema = {
     type = "object",
     properties = {
         types = {
-            type = "array",
-            minItems = 1,
-            items = {
-                type = "string",
-                minLength = 1,
+            anyOf = {
+                {
+                    type = "array",
+                    minItem = 1,
+                    items = {
+                        type = "string",
+                        minLength = 1,
+                    },
+                },
+                {
+                    type = "string",

Review comment:
       @spacewander Yes, I think it's simpler to use {"*"}, this pr only try to follow nginx's config strictly.
   If that not import, I will change it to {"*"}




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #4817: feat(gzip): support single string type and * to match any type

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4817:
URL: https://github.com/apache/apisix/pull/4817#discussion_r688211410



##########
File path: apisix/plugins/gzip.lua
##########
@@ -21,17 +21,26 @@ local req_http_version = ngx.req.http_version
 local str_sub = string.sub
 local ipairs = ipairs
 local tonumber = tonumber
+local type = type
 
 
 local schema = {
     type = "object",
     properties = {
         types = {
-            type = "array",
-            minItems = 1,
-            items = {
-                type = "string",
-                minLength = 1,
+            anyOf = {
+                {
+                    type = "array",
+                    minItem = 1,
+                    items = {
+                        type = "string",
+                        minLength = 1,
+                    },
+                },
+                {
+                    type = "string",

Review comment:
       I think `enum = {"*"}` is enough?

##########
File path: t/plugin/gzip.t
##########
@@ -436,6 +436,53 @@ POST /echo
 012345678
 --- more_headers
 Accept-Encoding: gzip
+Content-Type: text/html

Review comment:
       Better to use a special type to verify that any type can be matched.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] RocFang commented on a change in pull request #4817: feat(gzip): support single string type and * to match any type

Posted by GitBox <gi...@apache.org>.
RocFang commented on a change in pull request #4817:
URL: https://github.com/apache/apisix/pull/4817#discussion_r688217453



##########
File path: apisix/plugins/gzip.lua
##########
@@ -21,17 +21,26 @@ local req_http_version = ngx.req.http_version
 local str_sub = string.sub
 local ipairs = ipairs
 local tonumber = tonumber
+local type = type
 
 
 local schema = {
     type = "object",
     properties = {
         types = {
-            type = "array",
-            minItems = 1,
-            items = {
-                type = "string",
-                minLength = 1,
+            anyOf = {
+                {
+                    type = "array",
+                    minItem = 1,
+                    items = {
+                        type = "string",
+                        minLength = 1,
+                    },
+                },
+                {
+                    type = "string",

Review comment:
       misunderstood you firstly, now i got it.




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander merged pull request #4817: feat(gzip): support special * to match any type

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #4817:
URL: https://github.com/apache/apisix/pull/4817


   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org