class

Analyzer::Specification::Haproxy

Inherits Analyzer::Specification::SpecificationEngine < Analyzer < FileHelper < Reference < Object

HAProxy: every path pattern an ACL matches on (path, path_beg, path_reg, path_dir, and their older url* forms) is a path the proxy routes, whether it is declared as a named acl or inline as { path_beg /x }. Rules that use it add context: use_backend names the backend, http-request deny (and reject, tarpit, silent-drop, legacy block) marks it denied. ACLs are scoped to their section. HAProxy rules carry no verb, so every endpoint is ANY.

Constants

ACL_RE = /^acl\s+(\S+)\s+(#{FETCH})(?:,\S+)?(?:\s+(.*))?$/
ANON_RE = /(!?)\s*\{\s*(#{FETCH})(?:,\S+)?\s+(.*?)\s+\}/

HAProxy needs whitespace before an anonymous ACL's closing }, so a regex quantifier ({1,2}) inside the pattern does not end it.

BACKEND_RE = /^use_backend\s+(\S+)/
COMMENT_RE = /(?:^|\s)#.*$/
DENY_RE = /^(?:http-request\s+(deny|reject|tarpit|silent-drop)|tcp-request\s+\S+\s+(reject)|block)\b/
FETCH = /(?:path|url)(?:_beg|_end|_reg|_dir|_sub)?/
MODES = {"" => "str", "_beg" => "beg", "_end" => "end", "_reg" => "reg", "_dir" => "dir", "_sub" => "sub"}

Match mode by fetch suffix (path_beg, url_beg); -m <mode> overrides it.

PATH_TYPES = {"str" => "exact", "beg" => "prefix", "reg" => "regex", "dir" => "dir"}

Modes whose pattern is a routable path, with the tag each one gets.

RULE_RE = /\s(if|unless)\s+(.+)$/
SECTION_RE = /^(?:global|defaults|frontend|backend|listen|resolvers|peers|userlist|program|cache|mailers|ring|http-errors)\b/

Class methods

tech_name
Source

Instance methods

analyze
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source