mattyw commented on code in PR #11421:
URL: https://github.com/apache/trafficserver/pull/11421#discussion_r1628909417
##########
tests/gold_tests/remap/remap_acl.test.py:
##########
@@ -296,3 +329,267 @@ def _configure_client(self, tr: 'TestRun') -> None:
acl_configuration='@action=allow @in_ip=3.4.5.6 @method=GET @method=POST',
named_acls=[],
expected_responses=[200, 403, 403, 403, 403])
+
+'''
+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.
+
+
+A simple example is:
++--------+--------------+------------------+------------------+---------------+
+| Method | remap.config | named ACL | ip_allow.yaml | result |
++--------+--------------+------------------+------------------+---------------+
+| GET | - | allow (implicit) | allow (explicit) | allowed (200) |
+| HEAD | - | deny (explicit) | - | denied (403) |
+| POST | - | deny (explicit) | - | denied (403) |
+| PUT | - | allow (implicit) | deny (implicit) | allowed (200) |
+| DELETE | - | allow (implicit) | deny (implicit) | allowed (200) |
+| PUSH | - | allow (implicit) | deny (implicit) | allowed (200) |
+|--------+--------------+------------------+------------------+---------------+
+
+'''
+
+'''
+replay_proxy_response writes the given replay file (which expects a single GET
& POST client-request)
+with the given proxy_response value. This is only used to support the below
table test.
+'''
+
+def replay_proxy_response(
+ filename, replay_file, get_proxy_response, post_proxy_response
+):
+ current_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
+ path = os.path.join(current_dir, filename)
+ data = None
+ with open(path) as f:
+ data = load(f, Loader=Loader)
+ for session in data["sessions"]:
+ for transaction in session["transactions"]:
+ method = transaction["client-request"]["method"]
+ if method == "GET":
+ transaction["proxy-response"]["status"] =
get_proxy_response
+ elif method == "POST":
+ transaction["proxy-response"]["status"] =
post_proxy_response
+ else:
+ raise Exception(
+ "Expected to find GET or POST request, found %s",
method
+ )
+ with open(replay_file, "w") as f:
+ f.write(dump(data))
Review Comment:
This is also less than ideal: We create a number of temp files to support
the 27 replay files we need.
--
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]