masaori335 commented on code in PR #11433:
URL: https://github.com/apache/trafficserver/pull/11433#discussion_r1650532245


##########
tests/gold_tests/remap/all_acl_combinations.py:
##########
@@ -0,0 +1,171 @@
+'''
+Verify remap.config acl behavior.
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+ALLOW_GET_AND_POST = f'''
+ip_allow:
+  - apply: in
+    ip_addrs: [0/0, ::/0]
+    action: allow
+    methods: [GET, POST]
+'''
+
+ALLOW_GET = f'''
+ip_allow:
+  - apply: in
+    ip_addrs: [0/0, ::/0]
+    action: allow
+    methods: [GET]
+'''
+
+DENY_GET = f'''
+ip_allow:
+  - apply: in
+    ip_addrs: [0/0, ::/0]
+    action: deny
+    methods: [GET]
+'''
+
+DENY_GET_AND_POST = f'''
+ip_allow:
+  - apply: in
+    ip_addrs: [0/0, ::/0]
+    action: deny
+    methods: [GET, POST]
+'''
+
+# From src/proxy/http/remap/RemapConfig.cc:123
+# // ACLs are processed in this order:
+# // 1. A remap.config ACL line for an individual remap rule.
+# // 2. All named ACLs in remap.config.
+# // 3. Rules as specified in ip_allow.yaml.
+#
+# If proxy.config.url_remap.acl_matching_policy is 0 (default), ATS employs 
"the first explicit match wins" policy. This means
+# if it's implict match, ATS continue to process ACL filters. OTOH, if it's 1, 
ATS only process the first ACL filter.
+#
+# A simple example is:
+#
+# 
+--------+------------------+------------------+------------------+------------------+---------------+
+# | Method |   remap.config   |    named ACL 1   |    named ACL 2   |  
ip_allow.yaml   |    result     |
+# 
+--------+------------------+------------------+------------------+------------------+---------------+
+# | GET    | deny  (explicit) | -                | -                | -        
        | denied  (403) |
+# | HEAD   | allow (implicit) | deny  (explicit) | -                | -        
        | denied  (403) |
+# | POST   | allow (implicit) | allow (implicit) | allow (explicit) | -        
        | allowed (200) |
+# | PUT    | allow (implicit) | allow (implicit) | deny  (implicit) | deny  
(explicit) | deny    (403) |
+# | DELETE | allow (implicit) | allow (implicit) | deny  (implicit) | allow 
(implicit) | allowed (200) |
+# 
|--------+------------------+------------------+------------------+------------------+---------------+

Review Comment:
   I just removed these commends because the Doc describes well.



-- 
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: github-unsubscr...@trafficserver.apache.org

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

Reply via email to