Explorar o código

docs/cookbooks: core - proper details about no-return in route block

Daniel-Constantin Mierla hai 7 meses
pai
achega
9b6281a6e7

+ 5 - 3
docs/cookbooks/5.2.x/core.md

@@ -3221,9 +3221,11 @@ In bool expressions:
 - Negative is FALSE
 - Positive is TRUE
 
-If no value is specified, or a route reaches its end without executing a
-return statement, it returns 1. If return is used in the top level route
-is equivalent with exit \[val\].
+If no value is specified, it returns 1. If return is used in the top level route
+is equivalent with exit `[val]`. If no `return` is at the end of the routing block,
+the return code is the value of the last executed action, therefore it is highly
+recommended to return an explicit value (e.g., `return(1)`) to avoid unexpected
+config execution.
 
 Example usage:
 

+ 5 - 3
docs/cookbooks/5.3.x/core.md

@@ -3346,9 +3346,11 @@ In bool expressions:
 - Negative is FALSE
 - Positive is TRUE
 
-If no value is specified, or a route reaches its end without executing a
-return statement, it returns 1. If return is used in the top level route
-is equivalent with exit \[val\].
+If no value is specified, it returns 1. If return is used in the top level route
+is equivalent with exit `[val]`. If no `return` is at the end of the routing block,
+the return code is the value of the last executed action, therefore it is highly
+recommended to return an explicit value (e.g., `return(1)`) to avoid unexpected
+config execution.
 
 Example usage:
 

+ 5 - 3
docs/cookbooks/5.4.x/core.md

@@ -3417,9 +3417,11 @@ In bool expressions:
 - Negative is FALSE
 - Positive is TRUE
 
-If no value is specified, or a route reaches its end without executing a
-return statement, it returns 1. If return is used in the top level route
-is equivalent with exit \[val\].
+If no value is specified, it returns 1. If return is used in the top level route
+is equivalent with exit `[val]`. If no `return` is at the end of the routing block,
+the return code is the value of the last executed action, therefore it is highly
+recommended to return an explicit value (e.g., `return(1)`) to avoid unexpected
+config execution.
 
 Example usage:
 

+ 9 - 3
docs/cookbooks/5.5.x/core.md

@@ -3620,9 +3620,11 @@ In bool expressions:
 - Negative is FALSE
 - Positive is TRUE
 
-If no value is specified, or a route reaches its end without executing a
-return statement, it returns 1. If return is used in the top level route
-is equivalent with exit \[val\].
+If no value is specified, it returns 1. If return is used in the top level route
+is equivalent with exit `[val]`. If no `return` is at the end of the routing block,
+the return code is the value of the last executed action, therefore it is highly
+recommended to return an explicit value (e.g., `return(1)`) to avoid unexpected
+config execution.
 
 Example usage:
 
@@ -4111,6 +4113,10 @@ number of recursive levels, avoiding ending up in infinite loops -- see
 The sub-route blocks allow to make the configuration file modular,
 simplifying the logic and helping to avoid duplication of actions.
 
+If no `return` is at the end of the routing block, the return code is the value
+of the last executed action, therefore it is highly recommended to return an
+explicit value (e.g., `return(1)`) to avoid unexpected config execution.
+
 ### branch_route
 
 Request's branch routing block. It contains a set of actions to be taken

+ 9 - 3
docs/cookbooks/5.6.x/core.md

@@ -3748,9 +3748,11 @@ In bool expressions:
 - Negative is FALSE
 - Positive is TRUE
 
-If no value is specified, or a route reaches its end without executing a
-return statement, it returns 1. If return is used in the top level route
-is equivalent with exit `[val]`.
+If no value is specified, it returns 1. If return is used in the top level route
+is equivalent with exit `[val]`. If no `return` is at the end of the routing block,
+the return code is the value of the last executed action, therefore it is highly
+recommended to return an explicit value (e.g., `return(1)`) to avoid unexpected
+config execution.
 
 Example usage:
 
@@ -4238,6 +4240,10 @@ number of recursive levels, avoiding ending up in infinite loops -- see
 The sub-route blocks allow to make the configuration file modular,
 simplifying the logic and helping to avoid duplication of actions.
 
+If no `return` is at the end of the routing block, the return code is the value
+of the last executed action, therefore it is highly recommended to return an
+explicit value (e.g., `return(1)`) to avoid unexpected config execution.
+
 ### branch_route
 
 Request's branch routing block. It contains a set of actions to be taken

+ 10 - 4
docs/cookbooks/5.7.x/core.md

@@ -4400,9 +4400,11 @@ In logical evaluation expressions:
 - Negative is FALSE
 - Positive is TRUE
 
-If no value is specified, or a route reaches its end without executing a
-return statement, it returns 1. If return is used in the top level route
-is equivalent with exit `[val]`.
+If no value is specified, it returns 1. If return is used in the top level route
+is equivalent with exit `[val]`. If no `return` is at the end of the routing block,
+the return code is the value of the last executed action, therefore it is highly
+recommended to return an explicit value (e.g., `return(1)`) to avoid unexpected
+config execution.
 
 Example usage:
 
@@ -4868,7 +4870,7 @@ Example of usage:
     }
 ```
 
-### route
+### route block
 
 This block is used to define 'sub-routes' - group of actions that can be
 executed from another routing block. Originally targeted as being
@@ -4920,6 +4922,10 @@ number of recursive levels, avoiding ending up in infinite loops -- see
 The sub-route blocks allow to make the configuration file modular,
 simplifying the logic and helping to avoid duplication of actions.
 
+If no `return` is at the end of the routing block, the return code is the value
+of the last executed action, therefore it is highly recommended to return an
+explicit value (e.g., `return(1)`) to avoid unexpected config execution.
+
 ### branch_route
 
 Request's branch routing block. It contains a set of actions to be taken

+ 9 - 3
docs/cookbooks/5.8.x/core.md

@@ -4511,9 +4511,11 @@ In logical evaluation expressions:
 - Negative is FALSE
 - Positive is TRUE
 
-If no value is specified, or a route reaches its end without executing a
-return statement, it returns 1. If return is used in the top level route
-is equivalent with exit `[val]`.
+If no value is specified, it returns 1. If return is used in the top level route
+is equivalent with exit `[val]`. If no `return` is at the end of the routing block,
+the return code is the value of the last executed action, therefore it is highly
+recommended to return an explicit value (e.g., `return(1)`) to avoid unexpected
+config execution.
 
 Example usage:
 
@@ -5031,6 +5033,10 @@ number of recursive levels, avoiding ending up in infinite loops -- see
 The sub-route blocks allow to make the configuration file modular,
 simplifying the logic and helping to avoid duplication of actions.
 
+If no `return` is at the end of the routing block, the return code is the value
+of the last executed action, therefore it is highly recommended to return an
+explicit value (e.g., `return(1)`) to avoid unexpected config execution.
+
 ### branch_route
 
 Request's branch routing block. It contains a set of actions to be taken

+ 15 - 9
docs/cookbooks/devel/core.md

@@ -4648,28 +4648,30 @@ In logical evaluation expressions:
 - Negative is FALSE
 - Positive is TRUE
 
-If no value is specified, or a route reaches its end without executing a
-return statement, it returns 1. If return is used in the top level route
-is equivalent with exit `[val]`.
+If no value is specified, it returns 1. If return is used in the top level route
+is equivalent with exit `[val]`. If no `return` is at the end of the routing block,
+the return code is the value of the last executed action, therefore it is highly
+recommended to return an explicit value (e.g., `return(1)`) to avoid unexpected
+config execution.
 
 Example usage:
 
 ``` c
 request_route {
     if (route(RET)) {
-    xlog("L_NOTICE","method $rm is INVITE\n");
+        xlog("L_NOTICE","method $rm is INVITE\n");
     } else {
-    xlog("L_NOTICE","method $rm is REGISTER\n");
+        xlog("L_NOTICE","method $rm is REGISTER\n");
     };
 }
 
 route[RET] {
     if (is_method("INVITE")) {
-    return(1);
+        return(1);
     } else if (is_method("REGISTER")) {
-    return(-1);
+        return(-1);
     } else {
-    return(0);
+        return(0);
     };
 }
 ```
@@ -5125,7 +5127,7 @@ Example of usage:
     }
 ```
 
-### route
+### route block
 
 This block is used to define 'sub-routes' - group of actions that can be
 executed from another routing block. Originally targeted as being
@@ -5177,6 +5179,10 @@ number of recursive levels, avoiding ending up in infinite loops -- see
 The sub-route blocks allow to make the configuration file modular,
 simplifying the logic and helping to avoid duplication of actions.
 
+If no `return` is at the end of the routing block, the return code is the value
+of the last executed action, therefore it is highly recommended to return an
+explicit value (e.g., `return(1)`) to avoid unexpected config execution.
+
 ### branch_route
 
 Request's branch routing block. It contains a set of actions to be taken