nxt_http_variables.c (2110:048281cd3d73) nxt_http_variables.c (2124:6e74a08303ad)
1
2/*
3 * Copyright (C) NGINX, Inc.
4 */
5
6#include <nxt_router.h>
7#include <nxt_http.h>
8
9
1
2/*
3 * Copyright (C) NGINX, Inc.
4 */
5
6#include <nxt_router.h>
7#include <nxt_http.h>
8
9
10static nxt_int_t nxt_http_var_method(nxt_task_t *task, nxt_var_query_t *query,
11 nxt_str_t *str, void *ctx);
12static nxt_int_t nxt_http_var_request_uri(nxt_task_t *task,
13 nxt_var_query_t *query, nxt_str_t *str, void *ctx);
14static nxt_int_t nxt_http_var_uri(nxt_task_t *task, nxt_var_query_t *query,
15 nxt_str_t *str, void *ctx);
16static nxt_int_t nxt_http_var_host(nxt_task_t *task, nxt_var_query_t *query,
17 nxt_str_t *str, void *ctx);
10static nxt_int_t nxt_http_var_method(nxt_task_t *task, nxt_str_t *str,
11 void *ctx);
12static nxt_int_t nxt_http_var_request_uri(nxt_task_t *task, nxt_str_t *str,
13 void *ctx);
14static nxt_int_t nxt_http_var_uri(nxt_task_t *task, nxt_str_t *str, void *ctx);
15static nxt_int_t nxt_http_var_host(nxt_task_t *task, nxt_str_t *str, void *ctx);
18
19
20static nxt_var_decl_t nxt_http_vars[] = {
21 { nxt_string("method"),
22 &nxt_http_var_method,
23 0 },
24
25 { nxt_string("request_uri"),

--- 13 unchanged lines hidden (view full) ---

39nxt_int_t
40nxt_http_register_variables(void)
41{
42 return nxt_var_register(nxt_http_vars, nxt_nitems(nxt_http_vars));
43}
44
45
46static nxt_int_t
16
17
18static nxt_var_decl_t nxt_http_vars[] = {
19 { nxt_string("method"),
20 &nxt_http_var_method,
21 0 },
22
23 { nxt_string("request_uri"),

--- 13 unchanged lines hidden (view full) ---

37nxt_int_t
38nxt_http_register_variables(void)
39{
40 return nxt_var_register(nxt_http_vars, nxt_nitems(nxt_http_vars));
41}
42
43
44static nxt_int_t
47nxt_http_var_method(nxt_task_t *task, nxt_var_query_t *query, nxt_str_t *str,
48 void *ctx)
45nxt_http_var_method(nxt_task_t *task, nxt_str_t *str, void *ctx)
49{
50 nxt_http_request_t *r;
51
52 r = ctx;
53
54 *str = *r->method;
55
56 return NXT_OK;
57}
58
59
60static nxt_int_t
46{
47 nxt_http_request_t *r;
48
49 r = ctx;
50
51 *str = *r->method;
52
53 return NXT_OK;
54}
55
56
57static nxt_int_t
61nxt_http_var_request_uri(nxt_task_t *task, nxt_var_query_t *query,
62 nxt_str_t *str, void *ctx)
58nxt_http_var_request_uri(nxt_task_t *task, nxt_str_t *str, void *ctx)
63{
64 nxt_http_request_t *r;
65
66 r = ctx;
67
68 *str = r->target;
69
70 return NXT_OK;
71}
72
73
74static nxt_int_t
59{
60 nxt_http_request_t *r;
61
62 r = ctx;
63
64 *str = r->target;
65
66 return NXT_OK;
67}
68
69
70static nxt_int_t
75nxt_http_var_uri(nxt_task_t *task, nxt_var_query_t *query, nxt_str_t *str,
76 void *ctx)
71nxt_http_var_uri(nxt_task_t *task, nxt_str_t *str, void *ctx)
77{
78 nxt_http_request_t *r;
79
80 r = ctx;
81
82 *str = *r->path;
83
84 return NXT_OK;
85}
86
87
88static nxt_int_t
72{
73 nxt_http_request_t *r;
74
75 r = ctx;
76
77 *str = *r->path;
78
79 return NXT_OK;
80}
81
82
83static nxt_int_t
89nxt_http_var_host(nxt_task_t *task, nxt_var_query_t *query, nxt_str_t *str,
90 void *ctx)
84nxt_http_var_host(nxt_task_t *task, nxt_str_t *str, void *ctx)
91{
92 nxt_http_request_t *r;
93
94 r = ctx;
95
96 *str = r->host;
97
98 return NXT_OK;
99}
85{
86 nxt_http_request_t *r;
87
88 r = ctx;
89
90 *str = r->host;
91
92 return NXT_OK;
93}