You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "Sn0rt (via GitHub)" <gi...@apache.org> on 2023/04/07 12:22:23 UTC

[GitHub] [apisix] Sn0rt opened a new pull request, #9267: fix: body-transformer should have a smaller priority than proxy-cache

Sn0rt opened a new pull request, #9267:
URL: https://github.com/apache/apisix/pull/9267

   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes #9226 
   
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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] soulbird commented on a diff in pull request #9267: fix: body-transformer should have a smaller priority than proxy-cache

Posted by "soulbird (via GitHub)" <gi...@apache.org>.
soulbird commented on code in PR #9267:
URL: https://github.com/apache/apisix/pull/9267#discussion_r1168214274


##########
t/plugin/body-transformer.t:
##########
@@ -652,3 +652,115 @@ foobar:
             assert(res.status == 200)
         }
     }
+
+
+
+=== TEST 10: cooperation of proxy-cache plugin
+--- http_config
+lua_shared_dict memory_cache 50m;
+--- config
+location /demo {
+    content_by_lua_block {
+        ngx.say([[
+    <SOAP-ENV:Envelope
+        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+    <SOAP-ENV:Header/>
+        <SOAP-ENV:Body>
+            <ns2:CapitalCityResponse
+                xmlns:ns2="http://spring.io/guides/gs-producing-web-service">
+                <ns2:CapitalCityResult>hello</ns2:CapitalCityResult>
+            </ns2:CapitalCityResponse>
+        </SOAP-ENV:Body>
+    </SOAP-ENV:Envelope>
+        ]])
+    }
+}
+
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin")
+
+            local req_template = ngx.encode_base64[[
+                <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.oorsprong.org/websamples.countryinfo">
+                <soapenv:Header/>
+                <soapenv:Body>
+                    <web:CapitalCity>
+                    <web:sCountryISOCode>{{_escape_xml(country)}}</web:sCountryISOCode>
+                    </web:CapitalCity>
+                </soapenv:Body>
+                </soapenv:Envelope>
+            ]]
+
+            local rsp_template = ngx.encode_base64[[
+                {"result": {*_escape_json(Envelope.Body.CapitalCityResponse.CapitalCityResult)*}}
+                ]]
+
+            local code, body = t.test('/apisix/admin/routes/1',
+                ngx.HTTP_PUT,
+                string.format([[{
+                    "uri": "/capital",
+                    "plugins": {
+                        "proxy-rewrite": {
+                            "set": {

Review Comment:
   We can set these parameters when making a request, using the proxy-rewrite plugin seems to have nothing to do with the test target



-- 
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] leslie-tsang commented on a diff in pull request #9267: fix: body-transformer should have a smaller priority than proxy-cache

Posted by "leslie-tsang (via GitHub)" <gi...@apache.org>.
leslie-tsang commented on code in PR #9267:
URL: https://github.com/apache/apisix/pull/9267#discussion_r1168112942


##########
t/plugin/body-transformer.t:
##########
@@ -23,9 +23,19 @@ no_root_location();
 add_block_preprocessor(sub {
     my ($block) = @_;
 
-    if (!$block->request) {
-        $block->set_value("request", "GET /t");
+    my $http_config = $block->http_config // <<_EOC_;
+
+    lua_shared_dict memory_cache 50m;
+
+    server {
+        listen 1986;
+        server_tokens off;
+

Review Comment:
   It seems we don't use this server ?



-- 
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] Sn0rt commented on a diff in pull request #9267: fix: body-transformer should have a smaller priority than proxy-cache

Posted by "Sn0rt (via GitHub)" <gi...@apache.org>.
Sn0rt commented on code in PR #9267:
URL: https://github.com/apache/apisix/pull/9267#discussion_r1163652633


##########
t/plugin/body-transformer.t:
##########
@@ -23,9 +23,28 @@ no_root_location();
 add_block_preprocessor(sub {
     my ($block) = @_;
 
-    if (!$block->request) {
-        $block->set_value("request", "GET /t");
+    my $http_config = $block->http_config // <<_EOC_;
+
+    # for proxy cache

Review Comment:
   ok, I will remove it later



##########
t/plugin/body-transformer.t:
##########
@@ -652,3 +662,113 @@ foobar:
             assert(res.status == 200)
         }
     }
+
+
+
+=== TEST 10: cooperation of proxy-cache plugin
+--- config
+location /websamples.countryinfo/CountryInfoService.wso {

Review Comment:
   yep. this url. is genrate from a real user case.



##########
t/plugin/body-transformer.t:
##########
@@ -23,9 +23,19 @@ no_root_location();
 add_block_preprocessor(sub {
     my ($block) = @_;
 
-    if (!$block->request) {
-        $block->set_value("request", "GET /t");
+    my $http_config = $block->http_config // <<_EOC_;
+
+    lua_shared_dict memory_cache 50m;
+
+    server {
+        listen 1986;
+        server_tokens off;
+

Review Comment:
   removed, thx.



##########
t/plugin/body-transformer.t:
##########
@@ -652,3 +652,115 @@ foobar:
             assert(res.status == 200)
         }
     }
+
+
+
+=== TEST 10: cooperation of proxy-cache plugin
+--- http_config
+lua_shared_dict memory_cache 50m;
+--- config
+location /demo {
+    content_by_lua_block {
+        ngx.say([[
+    <SOAP-ENV:Envelope
+        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+    <SOAP-ENV:Header/>
+        <SOAP-ENV:Body>
+            <ns2:CapitalCityResponse
+                xmlns:ns2="http://spring.io/guides/gs-producing-web-service">
+                <ns2:CapitalCityResult>hello</ns2:CapitalCityResult>
+            </ns2:CapitalCityResponse>
+        </SOAP-ENV:Body>
+    </SOAP-ENV:Envelope>
+        ]])
+    }
+}
+
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin")
+
+            local req_template = ngx.encode_base64[[
+                <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.oorsprong.org/websamples.countryinfo">
+                <soapenv:Header/>
+                <soapenv:Body>
+                    <web:CapitalCity>
+                    <web:sCountryISOCode>{{_escape_xml(country)}}</web:sCountryISOCode>
+                    </web:CapitalCity>
+                </soapenv:Body>
+                </soapenv:Envelope>
+            ]]
+
+            local rsp_template = ngx.encode_base64[[
+                {"result": {*_escape_json(Envelope.Body.CapitalCityResponse.CapitalCityResult)*}}
+                ]]
+
+            local code, body = t.test('/apisix/admin/routes/1',
+                ngx.HTTP_PUT,
+                string.format([[{
+                    "uri": "/capital",
+                    "plugins": {
+                        "proxy-rewrite": {
+                            "set": {

Review Comment:
   actually. this config is copy from a real user case. more info you find from https://github.com/apache/apisix/issues/9226



-- 
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] monkeyDluffy6017 commented on pull request #9267: fix: body-transformer should have a smaller priority than proxy-cache

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on PR #9267:
URL: https://github.com/apache/apisix/pull/9267#issuecomment-1508092204

   Hi @Sn0rt, only a reviewer can mark a coversation as resolved


-- 
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] kingluo commented on a diff in pull request #9267: fix: body-transformer should have a smaller priority than proxy-cache

Posted by "kingluo (via GitHub)" <gi...@apache.org>.
kingluo commented on code in PR #9267:
URL: https://github.com/apache/apisix/pull/9267#discussion_r1162253486


##########
t/plugin/body-transformer.t:
##########
@@ -23,9 +23,28 @@ no_root_location();
 add_block_preprocessor(sub {
     my ($block) = @_;
 
-    if (!$block->request) {
-        $block->set_value("request", "GET /t");
+    my $http_config = $block->http_config // <<_EOC_;
+
+    # for proxy cache

Review Comment:
   We use a memory-only cache handler, so do we need disk zone settings?



##########
t/plugin/body-transformer.t:
##########
@@ -652,3 +671,112 @@ foobar:
             assert(res.status == 200)
         }
     }
+
+
+=== TEST 10: cooperation of cache-proxy plugin

Review Comment:
   typo fix: `cache-proxy` -> `proxy-cache`



-- 
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] monkeyDluffy6017 commented on a diff in pull request #9267: fix: body-transformer should have a smaller priority than proxy-cache

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on code in PR #9267:
URL: https://github.com/apache/apisix/pull/9267#discussion_r1166263138


##########
t/plugin/body-transformer.t:
##########
@@ -652,3 +662,113 @@ foobar:
             assert(res.status == 200)
         }
     }
+
+
+
+=== TEST 10: cooperation of proxy-cache plugin
+--- config
+location /websamples.countryinfo/CountryInfoService.wso {

Review Comment:
   Why is this URI so long and does it have any special meaning?



-- 
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] Sn0rt commented on pull request #9267: fix: body-transformer should have a smaller priority than proxy-cache

Posted by "Sn0rt (via GitHub)" <gi...@apache.org>.
Sn0rt commented on PR #9267:
URL: https://github.com/apache/apisix/pull/9267#issuecomment-1508177151

   > Hi @Sn0rt, only a reviewer can mark a coversation as resolved
   
   copy.


-- 
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] monkeyDluffy6017 merged pull request #9267: fix: body-transformer should have a smaller priority than proxy-cache

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 merged PR #9267:
URL: https://github.com/apache/apisix/pull/9267


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