diff options
-rw-r--r-- | docs/changes.xml | 7 | ||||
-rw-r--r-- | src/nxt_http_variables.c | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/docs/changes.xml b/docs/changes.xml index f8745641..66965311 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -62,6 +62,13 @@ increased the applications' startup timeout. </para> </change> +<change type="feature"> +<para> +added a new variable, $dollar, that translates to a literal "$" during +variable substitution. +</para> +</change> + </changes> diff --git a/src/nxt_http_variables.c b/src/nxt_http_variables.c index 837ef7b0..5a632b24 100644 --- a/src/nxt_http_variables.c +++ b/src/nxt_http_variables.c @@ -7,6 +7,8 @@ #include <nxt_http.h> +static nxt_int_t nxt_http_var_dollar(nxt_task_t *task, nxt_str_t *str, + void *ctx, uint16_t field); static nxt_int_t nxt_http_var_method(nxt_task_t *task, nxt_str_t *str, void *ctx, uint16_t field); static nxt_int_t nxt_http_var_request_uri(nxt_task_t *task, nxt_str_t *str, @@ -41,6 +43,9 @@ static nxt_int_t nxt_http_var_cookie(nxt_task_t *task, nxt_str_t *str, static nxt_var_decl_t nxt_http_vars[] = { { + .name = nxt_string("dollar"), + .handler = nxt_http_var_dollar, + }, { .name = nxt_string("method"), .handler = nxt_http_var_method, }, { @@ -97,6 +102,15 @@ nxt_http_register_variables(void) static nxt_int_t +nxt_http_var_dollar(nxt_task_t *task, nxt_str_t *str, void *ctx, uint16_t field) +{ + nxt_str_set(str, "$"); + + return NXT_OK; +} + + +static nxt_int_t nxt_http_var_method(nxt_task_t *task, nxt_str_t *str, void *ctx, uint16_t field) { nxt_http_request_t *r; |