SolidWallOfCode commented on code in PR #9845:
URL: https://github.com/apache/trafficserver/pull/9845#discussion_r1233073728


##########
proxy/http/HttpSM.cc:
##########
@@ -5258,6 +5258,70 @@ HttpSM::get_outbound_sni() const
   return zret;
 }
 
+bool
+HttpSM::apply_ip_allow_filter()
+{
+  bool result{true};
+  // Method allowed on dest IP address check
+  IpAllow::ACL acl = IpAllow::match(get_server_ip(), IpAllow::DST_ADDR);
+
+  if (ip_allow_is_request_forbidden(acl)) {
+    ip_allow_deny_request(acl);
+    result = false;
+  } else if (HttpTransact::is_server_negative_cached(&t_state) == true &&
+             t_state.txn_conf->connect_attempts_max_retries_down_server <= 0) {
+    call_transact_and_set_next_state(HttpTransact::OriginDown);
+    result = false;
+  }
+
+  return result;
+}
+
+bool
+HttpSM::ip_allow_is_request_forbidden(const IpAllow::ACL &acl)
+{
+  bool result{false};
+  if (acl.isValid()) {
+    if (acl.isDenyAll()) {
+      result = true;
+    } else if (!acl.isAllowAll()) {
+      if (get_request_method() != -1) {
+        result = !acl.isMethodAllowed(get_request_method());
+      } else {
+        int method_str_len{};

Review Comment:
   Is this a function declaration or an initialization?
   * never call a default constructor on a built in.
   * use "universal initialization" syntax, e.g. `method_ptr_len{}`. That 
syntax was invented specifically to solve this ambiguity.



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

Reply via email to