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 2020/11/11 09:14:24 UTC

[GitHub] [apisix] spacewander opened a new pull request #2708: fix(http-logger): validate uri

spacewander opened a new pull request #2708:
URL: https://github.com/apache/apisix/pull/2708


   Close #2707.
   
   ### 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. -->
   
   ### Pre-submission checklist:
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible?
   


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

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



[GitHub] [apisix] juzhiyuan commented on a change in pull request #2708: fix(http-logger): validate uri

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



##########
File path: t/plugin/http-logger.t
##########
@@ -595,3 +595,43 @@ hello1 world
 --- error_log
 Batch Processor[http logger] failed to process entries: failed to connect to host[127.0.0.1] port[9991] connection refused
 --- wait: 1.5
+
+
+
+=== TEST 16: check uri
+--- config
+    location /t {
+        content_by_lua_block {
+            local plugin = require("apisix.plugins.http-logger")
+            local bad_uris = {
+               "127.0.0.1", 
+               "127.0.0.1:1024", 
+            }
+            for _, bad in ipairs(bad_uris) do

Review comment:
       `bad_uri` would be more semantic

##########
File path: t/plugin/http-logger.t
##########
@@ -595,3 +595,43 @@ hello1 world
 --- error_log
 Batch Processor[http logger] failed to process entries: failed to connect to host[127.0.0.1] port[9991] connection refused
 --- wait: 1.5
+
+
+
+=== TEST 16: check uri
+--- config
+    location /t {
+        content_by_lua_block {
+            local plugin = require("apisix.plugins.http-logger")
+            local bad_uris = {
+               "127.0.0.1", 
+               "127.0.0.1:1024", 
+            }
+            for _, bad in ipairs(bad_uris) do
+                local ok, err = plugin.check_schema({uri = bad})
+                if ok then
+                    ngx.say("mismatched ", bad)
+                end
+            end
+
+            local good_uris = {
+               "http://127.0.0.1:1024", 

Review comment:
       BTW, according to this RFC[1], would what pattern work for uris that have queries or params?
   
   [1] https://tools.ietf.org/html/rfc3986#section-3




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

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



[GitHub] [apisix] moonming merged pull request #2708: fix(http-logger): validate uri

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


   


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

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



[GitHub] [apisix] spacewander commented on a change in pull request #2708: fix(http-logger): validate uri

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



##########
File path: t/plugin/http-logger.t
##########
@@ -595,3 +595,43 @@ hello1 world
 --- error_log
 Batch Processor[http logger] failed to process entries: failed to connect to host[127.0.0.1] port[9991] connection refused
 --- wait: 1.5
+
+
+
+=== TEST 16: check uri
+--- config
+    location /t {
+        content_by_lua_block {
+            local plugin = require("apisix.plugins.http-logger")
+            local bad_uris = {
+               "127.0.0.1", 
+               "127.0.0.1:1024", 
+            }
+            for _, bad in ipairs(bad_uris) do

Review comment:
       @juzhiyuan 
   Updated.




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

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