This is an automated email from the ASF dual-hosted git repository. cmcfarlen pushed a commit to branch 10.2.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 3f1ffdfe88f4450c1eb8ab4f2f29e26ca83baaeb Author: mlibbey <[email protected]> AuthorDate: Sat Feb 21 09:16:48 2026 -0800 Doc: mention elif, nested conditionals (#12869) Missed some documentation when adding elif and nested conditionals. (cherry picked from commit 82076d5b53f9d553ed2d141c77638f88bab07003) --- doc/admin-guide/configuration/hrw4u.en.rst | 34 ++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/doc/admin-guide/configuration/hrw4u.en.rst b/doc/admin-guide/configuration/hrw4u.en.rst index e2a054383e..c401dafc4e 100644 --- a/doc/admin-guide/configuration/hrw4u.en.rst +++ b/doc/admin-guide/configuration/hrw4u.en.rst @@ -134,11 +134,12 @@ For people using IDEs, the package also provides an LSP for this language, named Syntax Differences ================== -The basic structure is a `section` name defining the part of the transaction to run in -followed by conditionals and operators. It uses `if () {} else {}` conditional syntax -with `&& , || and ==`, with conditions and operators generally following function() or -object.style grammar. Operator lines are terminated with `;` (whitespace is still not -significant). For instance: +The basic structure consists of a `section` name defining the part of the transaction to run, +followed by conditionals and operators. It uses `if ... {...} elif ... {...} else {...}` conditional syntax +with `&& , || and ==`. Conditionals support parenthesized grouping for complex expressions (`if (...) {...}`) +and can be nested up to a maximum depth of 10 levels. Conditions and operators generally follow +function() or object.style grammar. Operator lines are terminated with `;` and whitespace is still +insignificant. For instance: .. code-block:: none @@ -148,13 +149,31 @@ significant). For instance: } REMAP { - if inbound.status == 403 || access("/etc/lock") { + if inbound.status == 403 { inbound.req.X-Fail = "1"; + } elif inbound.status == 404 { + inbound.req.X-NotFound = "1"; } else { no-op(); } } + READ_RESPONSE { + if inbound.status > 399 { + if inbound.status < 500 { + # Client error - check specific cases + if inbound.status == 404 { + counter("errors.not_found"); + } elif inbound.status == 403 { + counter("errors.forbidden"); + } + } else { + # Server error + counter("errors.server"); + } + } + } + There is no `cond` or `set-header` syntax — those are implied by context. Header Presence @@ -199,7 +218,8 @@ Syntax Free-form Structured `if (...) { ... }` Conditions `cond %{...}` Implicit in `if (...)` Operators Raw text (`set-header`) Structured assignments or statements Grouping `GROUP` / `GROUP:END` Use `()` inside `if` expressions -Else branches `else` with indented ops `else { ... }` with full block +Else branches `else` with indented ops `elif ... { ... }` and `else { ... }` + with full blocks Debugging Manual with logs Built-in debug tracing (`--debug`) Quotes Quoted strings optional Quoted strings required / encouraged Validation Runtime Static during parsing and symbol resolution
