Mercurial > hg > nginx-quic
annotate src/http/modules/ngx_http_ssi_filter_module.c @ 645:4946078f0a79 release-0.3.44
nginx-0.3.44-RELEASE import
*) Feature: the "wait" parameter in the "include" SSI command.
*) Feature: the Ukrainian and Byelorussian characters were added to
koi-win conversion table.
*) Bugfix: in the SSI.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 04 May 2006 15:32:46 +0000 |
parents | 947c6fd27699 |
children | 39b7d7b33c91 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
5 |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 |
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #include <ngx_config.h> |
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_core.h> |
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #include <ngx_http.h> |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
10 |
553 | 11 #define NGX_HTTP_SSI_ERROR 1 |
12 | |
13 #define NGX_HTTP_SSI_DATE_LEN 2048 | |
14 | |
15 #define NGX_HTTP_SSI_ADD_PREFIX 1 | |
629 | 16 #define NGX_HTTP_SSI_ADD_ZERO 2 |
635 | 17 #define NGX_HTTP_SSI_EXPR_TEST 4 |
509 | 18 |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
19 |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
20 typedef struct { |
597 | 21 ngx_flag_t enable; |
22 ngx_flag_t silent_errors; | |
23 ngx_flag_t ignore_recycled_buffers; | |
24 | |
25 ngx_array_t *types; /* array of ngx_str_t */ | |
26 | |
27 size_t min_file_chunk; | |
28 size_t value_len; | |
29 } ngx_http_ssi_loc_conf_t; | |
553 | 30 |
31 | |
32 typedef struct { | |
597 | 33 ngx_str_t name; |
611 | 34 ngx_uint_t key; |
597 | 35 ngx_str_t value; |
36 } ngx_http_ssi_var_t; | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
37 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
38 |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
39 typedef enum { |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
40 ssi_start_state = 0, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
41 ssi_tag_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
42 ssi_comment0_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
43 ssi_comment1_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
44 ssi_sharp_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
45 ssi_precommand_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
46 ssi_command_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
47 ssi_preparam_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
48 ssi_param_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
49 ssi_preequal_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
50 ssi_prevalue_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
51 ssi_double_quoted_value_state, |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
52 ssi_quoted_value_state, |
497 | 53 ssi_quoted_symbol_state, |
54 ssi_postparam_state, | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
55 ssi_comment_end0_state, |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
56 ssi_comment_end1_state, |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
57 ssi_error_state, |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
58 ssi_error_end0_state, |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
59 ssi_error_end1_state |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
60 } ngx_http_ssi_state_e; |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
61 |
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
62 |
509 | 63 static ngx_int_t ngx_http_ssi_output(ngx_http_request_t *r, |
64 ngx_http_ssi_ctx_t *ctx); | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
65 static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, |
497 | 66 ngx_http_ssi_ctx_t *ctx); |
553 | 67 static ngx_str_t *ngx_http_ssi_get_variable(ngx_http_request_t *r, |
611 | 68 ngx_str_t *name, ngx_uint_t key); |
553 | 69 static ngx_int_t ngx_http_ssi_evaluate_string(ngx_http_request_t *r, |
70 ngx_http_ssi_ctx_t *ctx, ngx_str_t *text, ngx_uint_t flags); | |
71 | |
72 static ngx_int_t ngx_http_ssi_include(ngx_http_request_t *r, | |
73 ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
74 static ngx_int_t ngx_http_ssi_echo(ngx_http_request_t *r, |
497 | 75 ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); |
509 | 76 static ngx_int_t ngx_http_ssi_config(ngx_http_request_t *r, |
77 ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); | |
553 | 78 static ngx_int_t ngx_http_ssi_set(ngx_http_request_t *r, |
509 | 79 ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); |
80 static ngx_int_t ngx_http_ssi_if(ngx_http_request_t *r, | |
81 ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); | |
82 static ngx_int_t ngx_http_ssi_else(ngx_http_request_t *r, | |
83 ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); | |
84 static ngx_int_t ngx_http_ssi_endif(ngx_http_request_t *r, | |
85 ngx_http_ssi_ctx_t *ctx, ngx_str_t **params); | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
86 |
573 | 87 static ngx_int_t ngx_http_ssi_date_gmt_local_variable(ngx_http_request_t *r, |
88 ngx_http_variable_value_t *v, uintptr_t gmt); | |
509 | 89 |
527 | 90 static char *ngx_http_ssi_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
91 | |
597 | 92 static ngx_int_t ngx_http_ssi_preconfiguration(ngx_conf_t *cf); |
93 static void *ngx_http_ssi_create_main_conf(ngx_conf_t *cf); | |
94 static char *ngx_http_ssi_init_main_conf(ngx_conf_t *cf, void *conf); | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
95 static void *ngx_http_ssi_create_conf(ngx_conf_t *cf); |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
96 static char *ngx_http_ssi_merge_conf(ngx_conf_t *cf, |
497 | 97 void *parent, void *child); |
98 static ngx_int_t ngx_http_ssi_filter_init(ngx_cycle_t *cycle); | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
99 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
100 |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
101 static ngx_command_t ngx_http_ssi_filter_commands[] = { |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
102 |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
103 { ngx_string("ssi"), |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
104 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
105 ngx_conf_set_flag_slot, |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
106 NGX_HTTP_LOC_CONF_OFFSET, |
597 | 107 offsetof(ngx_http_ssi_loc_conf_t, enable), |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
108 NULL }, |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
109 |
497 | 110 { ngx_string("ssi_silent_errors"), |
111 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
112 ngx_conf_set_flag_slot, | |
113 NGX_HTTP_LOC_CONF_OFFSET, | |
597 | 114 offsetof(ngx_http_ssi_loc_conf_t, silent_errors), |
497 | 115 NULL }, |
116 | |
509 | 117 { ngx_string("ssi_ignore_recycled_buffers"), |
118 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
119 ngx_conf_set_flag_slot, | |
120 NGX_HTTP_LOC_CONF_OFFSET, | |
597 | 121 offsetof(ngx_http_ssi_loc_conf_t, ignore_recycled_buffers), |
509 | 122 NULL }, |
123 | |
497 | 124 { ngx_string("ssi_min_file_chunk"), |
125 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
126 ngx_conf_set_size_slot, | |
127 NGX_HTTP_LOC_CONF_OFFSET, | |
597 | 128 offsetof(ngx_http_ssi_loc_conf_t, min_file_chunk), |
497 | 129 NULL }, |
130 | |
589 | 131 { ngx_string("ssi_value_length"), |
132 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
133 ngx_conf_set_size_slot, | |
134 NGX_HTTP_LOC_CONF_OFFSET, | |
597 | 135 offsetof(ngx_http_ssi_loc_conf_t, value_len), |
589 | 136 NULL }, |
137 | |
527 | 138 { ngx_string("ssi_types"), |
139 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
140 ngx_http_ssi_types, | |
141 NGX_HTTP_LOC_CONF_OFFSET, | |
142 0, | |
143 NULL }, | |
144 | |
497 | 145 ngx_null_command |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
146 }; |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
147 |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
148 |
577 | 149 |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
150 static ngx_http_module_t ngx_http_ssi_filter_module_ctx = { |
597 | 151 ngx_http_ssi_preconfiguration, /* preconfiguration */ |
509 | 152 NULL, /* postconfiguration */ |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
153 |
597 | 154 ngx_http_ssi_create_main_conf, /* create main configuration */ |
155 ngx_http_ssi_init_main_conf, /* init main configuration */ | |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
156 |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
157 NULL, /* create server configuration */ |
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
158 NULL, /* merge server configuration */ |
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
159 |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
160 ngx_http_ssi_create_conf, /* create location configuration */ |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
161 ngx_http_ssi_merge_conf /* merge location configuration */ |
577 | 162 }; |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
163 |
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
164 |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
165 ngx_module_t ngx_http_ssi_filter_module = { |
509 | 166 NGX_MODULE_V1, |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
167 &ngx_http_ssi_filter_module_ctx, /* module context */ |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
168 ngx_http_ssi_filter_commands, /* module directives */ |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
169 NGX_HTTP_MODULE, /* module type */ |
541 | 170 NULL, /* init master */ |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
171 ngx_http_ssi_filter_init, /* init module */ |
541 | 172 NULL, /* init process */ |
173 NULL, /* init thread */ | |
174 NULL, /* exit thread */ | |
175 NULL, /* exit process */ | |
176 NULL, /* exit master */ | |
177 NGX_MODULE_V1_PADDING | |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
178 }; |
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
179 |
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
180 |
569 | 181 static ngx_http_output_header_filter_pt ngx_http_next_header_filter; |
182 static ngx_http_output_body_filter_pt ngx_http_next_body_filter; | |
497 | 183 |
184 | |
185 static u_char ngx_http_ssi_string[] = "<!--"; | |
186 | |
187 static ngx_str_t ngx_http_ssi_none = ngx_string("(none)"); | |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
15
diff
changeset
|
188 |
553 | 189 #define NGX_HTTP_SSI_INCLUDE_VIRTUAL 0 |
190 #define NGX_HTTP_SSI_INCLUDE_FILE 1 | |
645 | 191 #define NGX_HTTP_SSI_INCLUDE_WAIT 2 |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
192 |
509 | 193 #define NGX_HTTP_SSI_ECHO_VAR 0 |
194 #define NGX_HTTP_SSI_ECHO_DEFAULT 1 | |
195 | |
547 | 196 #define NGX_HTTP_SSI_CONFIG_ERRMSG 0 |
197 #define NGX_HTTP_SSI_CONFIG_TIMEFMT 1 | |
509 | 198 |
553 | 199 #define NGX_HTTP_SSI_SET_VAR 0 |
200 #define NGX_HTTP_SSI_SET_VALUE 1 | |
509 | 201 |
202 #define NGX_HTTP_SSI_IF_EXPR 0 | |
203 | |
497 | 204 |
553 | 205 static ngx_http_ssi_param_t ngx_http_ssi_include_params[] = { |
597 | 206 { ngx_string("virtual"), NGX_HTTP_SSI_INCLUDE_VIRTUAL, 0, 0 }, |
207 { ngx_string("file"), NGX_HTTP_SSI_INCLUDE_FILE, 0, 0 }, | |
645 | 208 { ngx_string("wait"), NGX_HTTP_SSI_INCLUDE_WAIT, 0, 0 }, |
597 | 209 { ngx_null_string, 0, 0, 0 } |
553 | 210 }; |
211 | |
212 | |
497 | 213 static ngx_http_ssi_param_t ngx_http_ssi_echo_params[] = { |
597 | 214 { ngx_string("var"), NGX_HTTP_SSI_ECHO_VAR, 1, 0 }, |
215 { ngx_string("default"), NGX_HTTP_SSI_ECHO_DEFAULT, 0, 0 }, | |
216 { ngx_null_string, 0, 0, 0 } | |
497 | 217 }; |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
218 |
509 | 219 |
220 static ngx_http_ssi_param_t ngx_http_ssi_config_params[] = { | |
597 | 221 { ngx_string("errmsg"), NGX_HTTP_SSI_CONFIG_ERRMSG, 0, 0 }, |
222 { ngx_string("timefmt"), NGX_HTTP_SSI_CONFIG_TIMEFMT, 0, 0 }, | |
223 { ngx_null_string, 0, 0, 0 } | |
509 | 224 }; |
225 | |
226 | |
553 | 227 static ngx_http_ssi_param_t ngx_http_ssi_set_params[] = { |
597 | 228 { ngx_string("var"), NGX_HTTP_SSI_SET_VAR, 1, 0 }, |
229 { ngx_string("value"), NGX_HTTP_SSI_SET_VALUE, 1, 0 }, | |
230 { ngx_null_string, 0, 0, 0 } | |
553 | 231 }; |
232 | |
233 | |
509 | 234 static ngx_http_ssi_param_t ngx_http_ssi_if_params[] = { |
597 | 235 { ngx_string("expr"), NGX_HTTP_SSI_IF_EXPR, 1, 0 }, |
236 { ngx_null_string, 0, 0, 0 } | |
509 | 237 }; |
238 | |
239 | |
240 static ngx_http_ssi_param_t ngx_http_ssi_no_params[] = { | |
597 | 241 { ngx_null_string, 0, 0, 0 } |
509 | 242 }; |
243 | |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
244 |
497 | 245 static ngx_http_ssi_command_t ngx_http_ssi_commands[] = { |
553 | 246 { ngx_string("include"), ngx_http_ssi_include, |
247 ngx_http_ssi_include_params, 0, 1 }, | |
509 | 248 { ngx_string("echo"), ngx_http_ssi_echo, ngx_http_ssi_echo_params, 0, 0 }, |
249 { ngx_string("config"), ngx_http_ssi_config, | |
250 ngx_http_ssi_config_params, 0, 0 }, | |
553 | 251 { ngx_string("set"), ngx_http_ssi_set, ngx_http_ssi_set_params, 0, 0 }, |
509 | 252 |
253 { ngx_string("if"), ngx_http_ssi_if, ngx_http_ssi_if_params, 0, 0 }, | |
629 | 254 { ngx_string("elif"), ngx_http_ssi_if, ngx_http_ssi_if_params, |
255 NGX_HTTP_SSI_COND_IF, 0 }, | |
256 { ngx_string("else"), ngx_http_ssi_else, ngx_http_ssi_no_params, | |
257 NGX_HTTP_SSI_COND_IF, 0 }, | |
258 { ngx_string("endif"), ngx_http_ssi_endif, ngx_http_ssi_no_params, | |
259 NGX_HTTP_SSI_COND_ELSE, 0 }, | |
509 | 260 |
261 { ngx_null_string, NULL, NULL, 0, 0 } | |
497 | 262 }; |
263 | |
264 | |
509 | 265 static ngx_http_variable_t ngx_http_ssi_vars[] = { |
266 | |
637 | 267 { ngx_string("date_local"), NULL, ngx_http_ssi_date_gmt_local_variable, 0, |
533 | 268 NGX_HTTP_VAR_NOCACHABLE, 0 }, |
509 | 269 |
637 | 270 { ngx_string("date_gmt"), NULL, ngx_http_ssi_date_gmt_local_variable, 1, |
533 | 271 NGX_HTTP_VAR_NOCACHABLE, 0 }, |
509 | 272 |
637 | 273 { ngx_null_string, NULL, NULL, 0, 0, 0 } |
509 | 274 }; |
275 | |
276 | |
277 | |
497 | 278 static ngx_int_t |
279 ngx_http_ssi_header_filter(ngx_http_request_t *r) | |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
280 { |
597 | 281 ngx_uint_t i; |
282 ngx_str_t *type; | |
283 ngx_http_ssi_ctx_t *ctx; | |
284 ngx_http_ssi_loc_conf_t *slcf; | |
285 | |
286 slcf = ngx_http_get_module_loc_conf(r, ngx_http_ssi_filter_module); | |
287 | |
288 if (!slcf->enable | |
577 | 289 || r->headers_out.content_type.len == 0 |
290 || r->headers_out.content_length_n == 0) | |
247
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
291 { |
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
292 return ngx_http_next_header_filter(r); |
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
293 } |
008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
243
diff
changeset
|
294 |
497 | 295 |
597 | 296 type = slcf->types->elts; |
297 for (i = 0; i < slcf->types->nelts; i++) { | |
527 | 298 if (r->headers_out.content_type.len >= type[i].len |
299 && ngx_strncasecmp(r->headers_out.content_type.data, | |
300 type[i].data, type[i].len) == 0) | |
301 { | |
302 goto found; | |
303 } | |
304 } | |
305 | |
306 return ngx_http_next_header_filter(r); | |
307 | |
308 | |
309 found: | |
310 | |
499 | 311 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_ssi_ctx_t)); |
312 if (ctx == NULL) { | |
497 | 313 return NGX_ERROR; |
314 } | |
315 | |
316 ngx_http_set_ctx(r, ctx, ngx_http_ssi_filter_module); | |
317 | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
318 |
597 | 319 ctx->value_len = slcf->value_len; |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
320 ctx->last_out = &ctx->out; |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
321 |
509 | 322 ctx->output = 1; |
323 | |
497 | 324 ctx->params.elts = ctx->params_array; |
325 ctx->params.size = sizeof(ngx_table_elt_t); | |
326 ctx->params.nalloc = NGX_HTTP_SSI_PARAMS_N; | |
327 ctx->params.pool = r->pool; | |
328 | |
509 | 329 ctx->timefmt.len = sizeof("%A, %d-%b-%Y %H:%M:%S %Z") - 1; |
330 ctx->timefmt.data = (u_char *) "%A, %d-%b-%Y %H:%M:%S %Z"; | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
331 |
547 | 332 ctx->errmsg.len = |
333 sizeof("[an error occurred while processing the directive]") - 1; | |
334 ctx->errmsg.data = (u_char *) | |
335 "[an error occurred while processing the directive]"; | |
336 | |
497 | 337 r->filter_need_in_memory = 1; |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
338 |
597 | 339 if (r == r->main) { |
577 | 340 ngx_http_clear_content_length(r); |
341 ngx_http_clear_last_modified(r); | |
509 | 342 } |
343 | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
344 return ngx_http_next_header_filter(r); |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
345 } |
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
346 |
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
347 |
497 | 348 static ngx_int_t |
349 ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in) | |
15
cbb38b60495c
nginx-0.0.1-2002-09-18-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
14
diff
changeset
|
350 { |
597 | 351 ngx_int_t rc; |
352 ngx_buf_t *b; | |
353 ngx_uint_t i, index; | |
354 ngx_chain_t *cl; | |
355 ngx_table_elt_t *param; | |
356 ngx_connection_t *c; | |
357 ngx_http_ssi_ctx_t *ctx; | |
358 ngx_http_ssi_param_t *prm; | |
359 ngx_http_ssi_command_t *cmd; | |
360 ngx_http_ssi_loc_conf_t *slcf; | |
361 ngx_http_ssi_main_conf_t *smcf; | |
599 | 362 ngx_str_t *params[NGX_HTTP_SSI_MAX_PARAMS + 1]; |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
15
diff
changeset
|
363 |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
364 ctx = ngx_http_get_module_ctx(r, ngx_http_ssi_filter_module); |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
365 |
645 | 366 if (ctx == NULL |
367 || (in == NULL | |
368 && ctx->buf == NULL | |
369 && ctx->in == NULL | |
370 && ctx->busy == NULL)) | |
371 { | |
243
bf2faf694c19
nginx-0.0.1-2004-01-28-23:38:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
242
diff
changeset
|
372 return ngx_http_next_body_filter(r, in); |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
373 } |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
374 |
497 | 375 /* add the incoming chain to the chain ctx->in */ |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
376 |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
377 if (in) { |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
378 if (ngx_chain_add_copy(r->pool, &ctx->in, in) == NGX_ERROR) { |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
379 return NGX_ERROR; |
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
380 } |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
381 } |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
382 |
645 | 383 if (ctx->wait) { |
384 if (r->connection->data != r) { | |
385 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
386 "http ssi filter \"%V\" wait", &r->uri); | |
387 return NGX_AGAIN; | |
388 } | |
389 | |
390 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
391 "http ssi filter \"%V\" continue", &r->uri); | |
392 | |
393 ctx->wait = 0; | |
394 } | |
395 | |
597 | 396 slcf = ngx_http_get_module_loc_conf(r, ngx_http_ssi_filter_module); |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
397 |
509 | 398 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
399 "http ssi filter \"%V\"", &r->uri); | |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
400 |
499 | 401 while (ctx->in || ctx->buf) { |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
402 |
499 | 403 if (ctx->buf == NULL ){ |
404 ctx->buf = ctx->in->buf; | |
405 ctx->in = ctx->in->next; | |
406 ctx->pos = ctx->buf->pos; | |
407 } | |
497 | 408 |
409 if (ctx->state == ssi_start_state) { | |
410 ctx->copy_start = ctx->pos; | |
411 ctx->copy_end = ctx->pos; | |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
412 } |
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
413 |
499 | 414 b = NULL; |
415 | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
416 while (ctx->pos < ctx->buf->last) { |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
417 |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
418 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
419 "saved: %d state: %d", ctx->saved, ctx->state); |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
420 |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
421 rc = ngx_http_ssi_parse(r, ctx); |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
422 |
497 | 423 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
424 "parse: %d, looked: %d %p-%p", | |
425 rc, ctx->looked, ctx->copy_start, ctx->copy_end); | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
426 |
497 | 427 if (rc == NGX_ERROR) { |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
428 return rc; |
497 | 429 } |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
430 |
497 | 431 if (ctx->copy_start != ctx->copy_end) { |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
432 |
509 | 433 if (ctx->output) { |
434 | |
435 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
436 "saved: %d", ctx->saved); | |
437 | |
438 if (ctx->saved) { | |
439 | |
440 if (ctx->free) { | |
441 cl = ctx->free; | |
442 ctx->free = ctx->free->next; | |
443 b = cl->buf; | |
444 ngx_memzero(b, sizeof(ngx_buf_t)); | |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
445 |
509 | 446 } else { |
447 b = ngx_calloc_buf(r->pool); | |
448 if (b == NULL) { | |
449 return NGX_ERROR; | |
450 } | |
451 | |
452 cl = ngx_alloc_chain_link(r->pool); | |
453 if (cl == NULL) { | |
454 return NGX_ERROR; | |
455 } | |
456 | |
457 cl->buf = b; | |
458 } | |
459 | |
460 b->memory = 1; | |
461 b->pos = ngx_http_ssi_string; | |
462 b->last = ngx_http_ssi_string + ctx->saved; | |
463 | |
464 *ctx->last_out = cl; | |
465 ctx->last_out = &cl->next; | |
466 | |
467 ctx->saved = 0; | |
468 } | |
499 | 469 |
470 if (ctx->free) { | |
471 cl = ctx->free; | |
472 ctx->free = ctx->free->next; | |
473 b = cl->buf; | |
474 | |
475 } else { | |
509 | 476 b = ngx_alloc_buf(r->pool); |
499 | 477 if (b == NULL) { |
478 return NGX_ERROR; | |
479 } | |
480 | |
481 cl = ngx_alloc_chain_link(r->pool); | |
482 if (cl == NULL) { | |
483 return NGX_ERROR; | |
484 } | |
485 | |
486 cl->buf = b; | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
487 } |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
488 |
509 | 489 ngx_memcpy(b, ctx->buf, sizeof(ngx_buf_t)); |
490 | |
513 | 491 b->pos = ctx->copy_start; |
492 b->last = ctx->copy_end; | |
493 b->shadow = NULL; | |
509 | 494 b->last_buf = 0; |
495 b->recycled = 0; | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
496 |
509 | 497 if (b->in_file) { |
597 | 498 if (slcf->min_file_chunk < (size_t) (b->last - b->pos)) |
509 | 499 { |
500 b->file_last = b->file_pos + (b->last - b->start); | |
501 b->file_pos += b->pos - b->start; | |
502 | |
503 } else { | |
504 b->in_file = 0; | |
505 } | |
506 } | |
507 | |
508 cl->next = NULL; | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
509 *ctx->last_out = cl; |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
510 ctx->last_out = &cl->next; |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
511 |
509 | 512 } else { |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
513 ctx->saved = 0; |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
514 } |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
515 } |
497 | 516 |
517 if (ctx->state == ssi_start_state) { | |
518 ctx->copy_start = ctx->pos; | |
519 ctx->copy_end = ctx->pos; | |
240
725129fdd524
nginx-0.0.1-2004-01-26-20:22:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
239
diff
changeset
|
520 |
497 | 521 } else { |
522 ctx->copy_start = NULL; | |
523 ctx->copy_end = NULL; | |
524 } | |
525 | |
526 if (rc == NGX_AGAIN) { | |
527 continue; | |
528 } | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
529 |
497 | 530 |
573 | 531 b = NULL; |
532 | |
497 | 533 if (rc == NGX_OK) { |
534 | |
597 | 535 smcf = ngx_http_get_module_main_conf(r, |
536 ngx_http_ssi_filter_module); | |
537 | |
538 cmd = ngx_hash_find(&smcf->hash, ctx->key, ctx->command.data, | |
539 ctx->command.len); | |
540 | |
541 if (cmd == NULL) { | |
542 if (ctx->output) { | |
543 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
544 "invalid SSI command: \"%V\"", | |
545 &ctx->command); | |
546 goto ssi_error; | |
497 | 547 } |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
548 |
597 | 549 continue; |
497 | 550 } |
551 | |
629 | 552 if (cmd->conditional |
553 && (ctx->conditional == 0 | |
554 || ctx->conditional > cmd->conditional)) | |
555 { | |
556 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
557 "invalid context of SSI command: \"%V\"", | |
558 &ctx->command); | |
559 goto ssi_error; | |
560 } | |
561 | |
562 if (!ctx->output && cmd->conditional == 0) { | |
509 | 563 continue; |
564 } | |
565 | |
597 | 566 if (ctx->params.nelts > NGX_HTTP_SSI_MAX_PARAMS) { |
567 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
568 "too many SSI command paramters: \"%V\"", | |
569 &ctx->command); | |
570 goto ssi_error; | |
571 } | |
572 | |
497 | 573 ngx_memzero(params, |
599 | 574 (NGX_HTTP_SSI_MAX_PARAMS + 1) * sizeof(ngx_str_t *)); |
497 | 575 |
576 param = ctx->params.elts; | |
577 | |
578 for (i = 0; i < ctx->params.nelts; i++) { | |
579 | |
580 for (prm = cmd->params; prm->name.len; prm++) { | |
581 | |
582 if (param[i].key.len != prm->name.len | |
583 || ngx_strncmp(param[i].key.data, prm->name.data, | |
584 prm->name.len) != 0) | |
585 { | |
586 continue; | |
587 } | |
588 | |
597 | 589 if (!prm->multiple) { |
590 if (params[prm->index]) { | |
591 ngx_log_error(NGX_LOG_ERR, | |
592 r->connection->log, 0, | |
593 "duplicate \"%V\" parameter " | |
594 "in \"%V\" SSI command", | |
595 ¶m[i].key, &ctx->command); | |
596 | |
597 goto ssi_error; | |
598 } | |
599 | |
600 params[prm->index] = ¶m[i].value; | |
601 | |
602 break; | |
497 | 603 } |
604 | |
597 | 605 for (index = prm->index; params[index]; index++) { |
606 /* void */ | |
607 } | |
608 | |
609 params[index] = ¶m[i].value; | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
610 |
497 | 611 break; |
612 } | |
613 | |
614 if (prm->name.len == 0) { | |
615 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
616 "invalid parameter name: \"%V\" " | |
617 "in \"%V\" SSI command", | |
618 ¶m[i].key, &ctx->command); | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
619 |
497 | 620 goto ssi_error; |
621 } | |
622 } | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
623 |
497 | 624 for (prm = cmd->params; prm->name.len; prm++) { |
625 if (prm->mandatory && params[prm->index] == 0) { | |
626 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
627 "mandatory \"%V\" parameter is absent " | |
628 "in \"%V\" SSI command", | |
629 &prm->name, &ctx->command); | |
630 | |
631 goto ssi_error; | |
632 } | |
633 } | |
634 | |
509 | 635 if (cmd->flush && ctx->out) { |
636 rc = ngx_http_ssi_output(r, ctx); | |
637 | |
638 if (rc == NGX_ERROR) { | |
639 return NGX_ERROR; | |
640 } | |
641 } | |
642 | |
569 | 643 c = r->connection; |
644 | |
645 rc = cmd->handler(r, ctx, params); | |
646 | |
583 | 647 if (c->destroyed) { |
569 | 648 return NGX_DONE; |
649 } | |
650 | |
651 if (rc == NGX_OK) { | |
497 | 652 continue; |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
653 } |
583 | 654 |
645 | 655 if (rc == NGX_AGAIN) { |
656 return NGX_AGAIN; | |
657 } | |
658 | |
583 | 659 if (rc == NGX_ERROR) { |
660 return NGX_ERROR; | |
661 } | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
662 } |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
663 |
497 | 664 |
665 /* rc == NGX_HTTP_SSI_ERROR */ | |
666 | |
499 | 667 ssi_error: |
497 | 668 |
597 | 669 if (slcf->silent_errors) { |
497 | 670 continue; |
671 } | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
672 |
499 | 673 if (ctx->free) { |
674 cl = ctx->free; | |
675 ctx->free = ctx->free->next; | |
676 b = cl->buf; | |
677 ngx_memzero(b, sizeof(ngx_buf_t)); | |
678 | |
679 } else { | |
680 b = ngx_calloc_buf(r->pool); | |
681 if (b == NULL) { | |
682 return NGX_ERROR; | |
683 } | |
684 | |
685 cl = ngx_alloc_chain_link(r->pool); | |
686 if (cl == NULL) { | |
687 return NGX_ERROR; | |
688 } | |
689 | |
690 cl->buf = b; | |
497 | 691 } |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
15
diff
changeset
|
692 |
497 | 693 b->memory = 1; |
547 | 694 b->pos = ctx->errmsg.data; |
695 b->last = ctx->errmsg.data + ctx->errmsg.len; | |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
15
diff
changeset
|
696 |
497 | 697 cl->next = NULL; |
698 *ctx->last_out = cl; | |
699 ctx->last_out = &cl->next; | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
700 |
497 | 701 continue; |
702 } | |
703 | |
509 | 704 if (ctx->buf->last_buf || ctx->buf->recycled) { |
499 | 705 if (b == NULL) { |
706 if (ctx->free) { | |
707 cl = ctx->free; | |
708 ctx->free = ctx->free->next; | |
709 b = cl->buf; | |
710 ngx_memzero(b, sizeof(ngx_buf_t)); | |
711 | |
712 } else { | |
713 b = ngx_calloc_buf(r->pool); | |
714 if (b == NULL) { | |
715 return NGX_ERROR; | |
716 } | |
497 | 717 |
499 | 718 cl = ngx_alloc_chain_link(r->pool); |
719 if (cl == NULL) { | |
720 return NGX_ERROR; | |
721 } | |
722 | |
723 cl->buf = b; | |
724 } | |
725 | |
509 | 726 b->sync = 1; |
727 | |
499 | 728 cl->next = NULL; |
729 *ctx->last_out = cl; | |
730 ctx->last_out = &cl->next; | |
731 } | |
732 | |
733 b->last_buf = ctx->buf->last_buf; | |
734 b->shadow = ctx->buf; | |
509 | 735 |
597 | 736 if (slcf->ignore_recycled_buffers == 0) { |
509 | 737 b->recycled = ctx->buf->recycled; |
738 } | |
497 | 739 } |
740 | |
499 | 741 ctx->buf = NULL; |
742 | |
497 | 743 ctx->saved = ctx->looked; |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
744 } |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
745 |
499 | 746 if (ctx->out == NULL && ctx->busy == NULL) { |
497 | 747 return NGX_OK; |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
748 } |
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
749 |
509 | 750 return ngx_http_ssi_output(r, ctx); |
751 } | |
752 | |
753 | |
754 static ngx_int_t | |
755 ngx_http_ssi_output(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx) | |
756 { | |
757 ngx_int_t rc; | |
758 ngx_buf_t *b; | |
759 ngx_chain_t *cl; | |
760 | |
641 | 761 #if 1 |
762 b = NULL; | |
763 for (cl = ctx->out; cl; cl = cl->next) { | |
643 | 764 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
765 "ssi out: %p %p", cl->buf, cl->buf->pos); | |
641 | 766 if (cl->buf == b) { |
767 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | |
768 "the same buf was used in ssi"); | |
769 ngx_debug_point(); | |
770 return NGX_ERROR; | |
771 } | |
772 b = cl->buf; | |
773 } | |
774 #endif | |
775 | |
497 | 776 rc = ngx_http_next_body_filter(r, ctx->out); |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
777 |
499 | 778 if (ctx->busy == NULL) { |
779 ctx->busy = ctx->out; | |
780 | |
781 } else { | |
782 for (cl = ctx->busy; cl->next; cl = cl->next) { /* void */ } | |
783 cl->next = ctx->out; | |
784 } | |
785 | |
497 | 786 ctx->out = NULL; |
787 ctx->last_out = &ctx->out; | |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
788 |
499 | 789 while (ctx->busy) { |
790 | |
791 b = ctx->busy->buf; | |
792 | |
793 if (ngx_buf_size(b) != 0) { | |
794 break; | |
795 } | |
796 | |
797 #if (NGX_HAVE_WRITE_ZEROCOPY) | |
798 if (b->zerocopy_busy) { | |
799 break; | |
800 } | |
801 #endif | |
802 | |
803 if (b->shadow) { | |
804 b->shadow->pos = b->shadow->last; | |
805 } | |
806 | |
807 cl = ctx->busy; | |
808 ctx->busy = cl->next; | |
645 | 809 |
810 if (ngx_buf_in_memory(b) || b->in_file) { | |
811 /* add data bufs only to the free buf chain */ | |
812 | |
813 cl->next = ctx->free; | |
814 ctx->free = cl; | |
815 } | |
499 | 816 } |
817 | |
497 | 818 return rc; |
129
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
819 } |
7a886b9a67dc
nginx-0.0.1-2003-08-10-20:14:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
128
diff
changeset
|
820 |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
821 |
489 | 822 static ngx_int_t |
823 ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx) | |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
824 { |
609 | 825 u_char *p, *value, *last, *copy_end, ch; |
497 | 826 size_t looked; |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
827 ngx_http_ssi_state_e state; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
828 |
497 | 829 state = ctx->state; |
830 looked = ctx->looked; | |
831 last = ctx->buf->last; | |
832 copy_end = ctx->copy_end; | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
833 |
497 | 834 for (p = ctx->pos; p < last; p++) { |
489 | 835 |
836 ch = *p; | |
837 | |
838 if (state == ssi_start_state) { | |
839 | |
840 /* the tight loop */ | |
841 | |
499 | 842 for ( ;; ) { |
843 if (ch == '<') { | |
844 copy_end = p; | |
845 looked = 1; | |
846 state = ssi_tag_state; | |
847 | |
848 goto tag_started; | |
489 | 849 } |
850 | |
499 | 851 if (++p == last) { |
852 break; | |
853 } | |
497 | 854 |
499 | 855 ch = *p; |
489 | 856 } |
857 | |
497 | 858 ctx->pos = p; |
859 ctx->looked = looked; | |
860 ctx->copy_end = p; | |
489 | 861 |
497 | 862 if (ctx->copy_start == NULL) { |
863 ctx->copy_start = ctx->buf->pos; | |
489 | 864 } |
497 | 865 |
866 return NGX_AGAIN; | |
867 | |
499 | 868 tag_started: |
869 | |
497 | 870 continue; |
489 | 871 } |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
872 |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
873 switch (state) { |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
874 |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
875 case ssi_start_state: |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
876 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
877 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
878 case ssi_tag_state: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
879 switch (ch) { |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
880 case '!': |
497 | 881 looked = 2; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
882 state = ssi_comment0_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
883 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
884 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
885 case '<': |
497 | 886 copy_end = p; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
887 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
888 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
889 default: |
497 | 890 copy_end = p; |
891 looked = 0; | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
892 state = ssi_start_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
893 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
894 } |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
895 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
896 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
897 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
898 case ssi_comment0_state: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
899 switch (ch) { |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
900 case '-': |
497 | 901 looked = 3; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
902 state = ssi_comment1_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
903 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
904 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
905 case '<': |
497 | 906 copy_end = p; |
907 looked = 1; | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
908 state = ssi_tag_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
909 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
910 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
911 default: |
497 | 912 copy_end = p; |
913 looked = 0; | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
914 state = ssi_start_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
915 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
916 } |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
917 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
918 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
919 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
920 case ssi_comment1_state: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
921 switch (ch) { |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
922 case '-': |
497 | 923 looked = 4; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
924 state = ssi_sharp_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
925 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
926 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
927 case '<': |
497 | 928 copy_end = p; |
929 looked = 1; | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
930 state = ssi_tag_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
931 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
932 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
933 default: |
497 | 934 copy_end = p; |
935 looked = 0; | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
936 state = ssi_start_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
937 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
938 } |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
939 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
940 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
941 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
942 case ssi_sharp_state: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
943 switch (ch) { |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
944 case '#': |
497 | 945 if (ctx->copy_start) { |
946 ctx->saved = 0; | |
947 } | |
948 looked = 0; | |
949 state = ssi_precommand_state; | |
489 | 950 break; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
951 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
952 case '<': |
497 | 953 copy_end = p; |
954 looked = 1; | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
955 state = ssi_tag_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
956 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
957 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
958 default: |
497 | 959 copy_end = p; |
960 looked = 0; | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
961 state = ssi_start_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
962 break; |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
963 } |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
15
diff
changeset
|
964 |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
965 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
966 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
967 case ssi_precommand_state: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
968 switch (ch) { |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
969 case ' ': |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
970 case CR: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
971 case LF: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
972 case '\t': |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
973 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
974 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
975 default: |
489 | 976 ctx->command.len = 1; |
497 | 977 ctx->command.data = ngx_palloc(r->pool, |
609 | 978 NGX_HTTP_SSI_COMMAND_LEN); |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
979 if (ctx->command.data == NULL) { |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
980 return NGX_ERROR; |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
981 } |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
982 |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
983 ctx->command.data[0] = ch; |
609 | 984 |
597 | 985 ctx->key = 0; |
986 ctx->key = ngx_hash(ctx->key, ch); | |
987 | |
497 | 988 ctx->params.nelts = 0; |
629 | 989 |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
990 state = ssi_command_state; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
991 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
992 } |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
15
diff
changeset
|
993 |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
994 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
995 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
996 case ssi_command_state: |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
997 switch (ch) { |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
998 case ' ': |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
999 case CR: |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1000 case LF: |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1001 case '\t': |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1002 state = ssi_preparam_state; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1003 break; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1004 |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1005 case '-': |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1006 state = ssi_comment_end0_state; |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1007 break; |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1008 |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1009 default: |
497 | 1010 if (ctx->command.len == NGX_HTTP_SSI_COMMAND_LEN) { |
1011 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
609 | 1012 "the \"%V%c...\" SSI command is too long", |
1013 &ctx->command, ch); | |
497 | 1014 |
1015 state = ssi_error_state; | |
1016 break; | |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1017 } |
609 | 1018 |
1019 ctx->command.data[ctx->command.len++] = ch; | |
1020 ctx->key = ngx_hash(ctx->key, ch); | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1021 } |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1022 |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1023 break; |
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1024 |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1025 case ssi_preparam_state: |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1026 switch (ch) { |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1027 case ' ': |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1028 case CR: |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1029 case LF: |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1030 case '\t': |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1031 break; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1032 |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1033 case '-': |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1034 state = ssi_comment_end0_state; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1035 break; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1036 |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1037 default: |
499 | 1038 ctx->param = ngx_array_push(&ctx->params); |
1039 if (ctx->param == NULL) { | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
1040 return NGX_ERROR; |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
1041 } |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1042 |
489 | 1043 ctx->param->key.len = 1; |
497 | 1044 ctx->param->key.data = ngx_palloc(r->pool, |
609 | 1045 NGX_HTTP_SSI_PARAM_LEN); |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
1046 if (ctx->param->key.data == NULL) { |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
1047 return NGX_ERROR; |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
1048 } |
497 | 1049 |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1050 ctx->param->key.data[0] = ch; |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1051 |
489 | 1052 ctx->param->value.len = 0; |
609 | 1053 |
1054 if (ctx->value_buf == NULL) { | |
1055 ctx->param->value.data = ngx_palloc(r->pool, | |
1056 ctx->value_len); | |
1057 if (ctx->param->value.data == NULL) { | |
1058 return NGX_ERROR; | |
1059 } | |
1060 | |
1061 } else { | |
1062 ctx->param->value.data = ctx->value_buf; | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
1063 } |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1064 |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1065 state = ssi_param_state; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1066 break; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1067 } |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1068 |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1069 break; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1070 |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1071 case ssi_param_state: |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1072 switch (ch) { |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1073 case ' ': |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1074 case CR: |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1075 case LF: |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1076 case '\t': |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1077 state = ssi_preequal_state; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1078 break; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1079 |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1080 case '=': |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1081 state = ssi_prevalue_state; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1082 break; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1083 |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1084 case '-': |
497 | 1085 state = ssi_error_end0_state; |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1086 |
497 | 1087 ctx->param->key.data[ctx->param->key.len++] = ch; |
1088 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1089 "invalid \"%V\" parameter in \"%V\" SSI command", | |
1090 &ctx->param->key, &ctx->command); | |
1091 break; | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1092 |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1093 default: |
497 | 1094 if (ctx->param->key.len == NGX_HTTP_SSI_PARAM_LEN) { |
1095 state = ssi_error_state; | |
1096 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
609 | 1097 "too long \"%V%c...\" parameter in " |
497 | 1098 "\"%V\" SSI command", |
609 | 1099 &ctx->param->key, ch, &ctx->command); |
497 | 1100 break; |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1101 } |
609 | 1102 |
1103 ctx->param->key.data[ctx->param->key.len++] = ch; | |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1104 } |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1105 |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1106 break; |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1107 |
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1108 case ssi_preequal_state: |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1109 switch (ch) { |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1110 case ' ': |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1111 case CR: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1112 case LF: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1113 case '\t': |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1114 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1115 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1116 case '=': |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1117 state = ssi_prevalue_state; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1118 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1119 |
497 | 1120 default: |
1121 if (ch == '-') { | |
1122 state = ssi_error_end0_state; | |
1123 } else { | |
1124 state = ssi_error_state; | |
1125 } | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1126 |
497 | 1127 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1128 "unexpected \"%c\" symbol after \"%V\" " | |
1129 "parameter in \"%V\" SSI command", | |
1130 ch, &ctx->param->key, &ctx->command); | |
1131 break; | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1132 } |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1133 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1134 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1135 |
127
4cbe22f9907f
nginx-0.0.1-2003-08-07-10:07:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
126
diff
changeset
|
1136 case ssi_prevalue_state: |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1137 switch (ch) { |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1138 case ' ': |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1139 case CR: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1140 case LF: |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1141 case '\t': |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1142 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1143 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1144 case '"': |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1145 state = ssi_double_quoted_value_state; |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1146 break; |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1147 |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1148 case '\'': |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1149 state = ssi_quoted_value_state; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1150 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1151 |
497 | 1152 default: |
1153 if (ch == '-') { | |
1154 state = ssi_error_end0_state; | |
1155 } else { | |
1156 state = ssi_error_state; | |
1157 } | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1158 |
497 | 1159 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1160 "unexpected \"%c\" symbol before value of " | |
1161 "\"%V\" parameter in \"%V\" SSI command", | |
1162 ch, &ctx->param->key, &ctx->command); | |
1163 break; | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1164 } |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1165 |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1166 break; |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1167 |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1168 case ssi_double_quoted_value_state: |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1169 switch (ch) { |
559 | 1170 case '"': |
1171 state = ssi_postparam_state; | |
1172 break; | |
1173 | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1174 case '\\': |
497 | 1175 ctx->saved_state = ssi_double_quoted_value_state; |
1176 state = ssi_quoted_symbol_state; | |
559 | 1177 |
1178 /* fall through */ | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1179 |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1180 default: |
497 | 1181 if (ctx->param->value.len == ctx->value_len) { |
1182 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
609 | 1183 "too long \"%V%c...\" value of \"%V\" " |
1184 "parameter in \"%V\" SSI command", | |
1185 &ctx->param->value, ch, &ctx->param->key, | |
497 | 1186 &ctx->command); |
1187 state = ssi_error_state; | |
1188 break; | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1189 } |
609 | 1190 |
1191 ctx->param->value.data[ctx->param->value.len++] = ch; | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1192 } |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1193 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1194 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1195 |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1196 case ssi_quoted_value_state: |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1197 switch (ch) { |
559 | 1198 case '\'': |
1199 state = ssi_postparam_state; | |
1200 break; | |
1201 | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1202 case '\\': |
497 | 1203 ctx->saved_state = ssi_quoted_value_state; |
1204 state = ssi_quoted_symbol_state; | |
559 | 1205 |
1206 /* fall through */ | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1207 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1208 default: |
497 | 1209 if (ctx->param->value.len == ctx->value_len) { |
1210 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
609 | 1211 "too long \"%V%c...\" value of \"%V\" " |
1212 "parameter in \"%V\" SSI command", | |
1213 &ctx->param->value, ch, &ctx->param->key, | |
497 | 1214 &ctx->command); |
1215 state = ssi_error_state; | |
1216 break; | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1217 } |
609 | 1218 |
1219 ctx->param->value.data[ctx->param->value.len++] = ch; | |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1220 } |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1221 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1222 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1223 |
497 | 1224 case ssi_quoted_symbol_state: |
559 | 1225 state = ctx->saved_state; |
1226 | |
1227 if (ch == '\\') { | |
1228 break; | |
1229 } | |
1230 | |
1231 if (ch == '"' && state == ssi_double_quoted_value_state) { | |
573 | 1232 ctx->param->value.data[ctx->param->value.len - 1] = ch; |
559 | 1233 break; |
1234 } | |
1235 | |
1236 if (ch == '\'' && state == ssi_quoted_value_state) { | |
573 | 1237 ctx->param->value.data[ctx->param->value.len - 1] = ch; |
559 | 1238 break; |
1239 } | |
1240 | |
609 | 1241 if (ctx->param->value.len == ctx->value_len) { |
1242 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1243 "too long \"%V%c...\" value of \"%V\" " | |
1244 "parameter in \"%V\" SSI command", | |
1245 &ctx->param->value, ch, &ctx->param->key, | |
1246 &ctx->command); | |
1247 state = ssi_error_state; | |
1248 break; | |
1249 } | |
1250 | |
497 | 1251 ctx->param->value.data[ctx->param->value.len++] = ch; |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1252 |
497 | 1253 break; |
1254 | |
1255 case ssi_postparam_state: | |
609 | 1256 |
1257 if (ctx->param->value.len < ctx->value_len / 2) { | |
1258 value = ngx_palloc(r->pool, ctx->param->value.len); | |
1259 if (value == NULL) { | |
1260 return NGX_ERROR; | |
1261 } | |
1262 | |
1263 ngx_memcpy(value, ctx->param->value.data, | |
1264 ctx->param->value.len); | |
1265 | |
1266 ctx->value_buf = ctx->param->value.data; | |
1267 ctx->param->value.data = value; | |
1268 | |
1269 } else { | |
1270 ctx->value_buf = NULL; | |
1271 } | |
1272 | |
497 | 1273 switch (ch) { |
1274 case ' ': | |
1275 case CR: | |
1276 case LF: | |
1277 case '\t': | |
1278 state = ssi_preparam_state; | |
1279 break; | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1280 |
497 | 1281 case '-': |
1282 state = ssi_comment_end0_state; | |
1283 break; | |
1284 | |
1285 default: | |
1286 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1287 "unexpected \"%c\" symbol after \"%V\" value " | |
1288 "of \"%V\" parameter in \"%V\" SSI command", | |
1289 ch, &ctx->param->value, &ctx->param->key, | |
1290 &ctx->command); | |
1291 state = ssi_error_state; | |
1292 break; | |
1293 } | |
1294 | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1295 break; |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1296 |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1297 case ssi_comment_end0_state: |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1298 switch (ch) { |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1299 case '-': |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1300 state = ssi_comment_end1_state; |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1301 break; |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1302 |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1303 default: |
497 | 1304 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1305 "unexpected \"%c\" symbol in \"%V\" SSI command", | |
1306 ch, &ctx->command); | |
1307 state = ssi_error_state; | |
1308 break; | |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1309 } |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1310 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1311 break; |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1312 |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1313 case ssi_comment_end1_state: |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1314 switch (ch) { |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1315 case '>': |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1316 ctx->state = ssi_start_state; |
497 | 1317 ctx->pos = p + 1; |
1318 ctx->looked = looked; | |
1319 ctx->copy_end = copy_end; | |
1320 | |
1321 if (ctx->copy_start == NULL && copy_end) { | |
1322 ctx->copy_start = ctx->buf->pos; | |
1323 } | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1324 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1325 return NGX_OK; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1326 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1327 default: |
497 | 1328 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1329 "unexpected \"%c\" symbol in \"%V\" SSI command", | |
1330 ch, &ctx->command); | |
1331 state = ssi_error_state; | |
1332 break; | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1333 } |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1334 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1335 break; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1336 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1337 case ssi_error_state: |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1338 switch (ch) { |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1339 case '-': |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1340 state = ssi_error_end0_state; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1341 break; |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1342 |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1343 default: |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1344 break; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1345 } |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1346 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1347 break; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1348 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1349 case ssi_error_end0_state: |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1350 switch (ch) { |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1351 case '-': |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1352 state = ssi_error_end1_state; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1353 break; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1354 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1355 default: |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1356 state = ssi_error_state; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1357 break; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1358 } |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1359 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1360 break; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1361 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1362 case ssi_error_end1_state: |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1363 switch (ch) { |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1364 case '>': |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1365 ctx->state = ssi_start_state; |
497 | 1366 ctx->pos = p + 1; |
1367 ctx->looked = looked; | |
1368 ctx->copy_end = copy_end; | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1369 |
497 | 1370 if (ctx->copy_start == NULL && copy_end) { |
1371 ctx->copy_start = ctx->buf->pos; | |
1372 } | |
1373 | |
1374 return NGX_HTTP_SSI_ERROR; | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1375 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1376 default: |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
1377 state = ssi_error_state; |
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
1378 break; |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1379 } |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1380 |
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1381 break; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1382 } |
16
6ce4755737b4
nginx-0.0.1-2002-09-26-20:50:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
15
diff
changeset
|
1383 } |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1384 |
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1385 ctx->state = state; |
128
1947c683490f
nginx-0.0.1-2003-08-08-19:13:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
127
diff
changeset
|
1386 ctx->pos = p; |
497 | 1387 ctx->looked = looked; |
126
fcc79370b9a8
nginx-0.0.1-2003-08-06-18:43:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
125
diff
changeset
|
1388 |
497 | 1389 ctx->copy_end = (state == ssi_start_state) ? p : copy_end; |
1390 | |
1391 if (ctx->copy_start == NULL && ctx->copy_end) { | |
1392 ctx->copy_start = ctx->buf->pos; | |
1393 } | |
1394 | |
1395 return NGX_AGAIN; | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
1396 } |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
1397 |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
1398 |
553 | 1399 static ngx_str_t * |
611 | 1400 ngx_http_ssi_get_variable(ngx_http_request_t *r, ngx_str_t *name, |
1401 ngx_uint_t key) | |
553 | 1402 { |
1403 ngx_uint_t i; | |
1404 ngx_http_ssi_var_t *var; | |
1405 ngx_http_ssi_ctx_t *ctx; | |
1406 | |
1407 ctx = ngx_http_get_module_ctx(r->main, ngx_http_ssi_filter_module); | |
1408 | |
1409 var = ctx->variables.elts; | |
1410 for (i = 0; i < ctx->variables.nelts; i++) { | |
1411 if (name->len != var[i].name.len) { | |
1412 continue; | |
1413 } | |
1414 | |
611 | 1415 if (key != var[i].key) { |
1416 continue; | |
1417 } | |
1418 | |
1419 if (ngx_strncmp(name->data, var[i].name.data, name->len) == 0) { | |
553 | 1420 return &var[i].value; |
1421 } | |
1422 } | |
1423 | |
1424 return NULL; | |
1425 } | |
1426 | |
1427 | |
1428 static ngx_int_t | |
1429 ngx_http_ssi_evaluate_string(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, | |
1430 ngx_str_t *text, ngx_uint_t flags) | |
1431 { | |
573 | 1432 u_char ch, *p, **value, *data, *part_data; |
1433 size_t *size, len, prefix, part_len; | |
1434 ngx_str_t var, *val; | |
611 | 1435 ngx_int_t key; |
553 | 1436 ngx_uint_t i, j, n, bracket; |
1437 ngx_array_t lengths, values; | |
1438 ngx_http_variable_value_t *vv; | |
1439 | |
1440 n = ngx_http_script_variables_count(text); | |
1441 | |
1442 if (n == 0) { | |
1443 | |
1444 if (!(flags & NGX_HTTP_SSI_ADD_PREFIX)) { | |
1445 return NGX_OK; | |
1446 } | |
1447 | |
1448 if (text->data[0] != '/') { | |
1449 for (prefix = r->uri.len; prefix; prefix--) { | |
1450 if (r->uri.data[prefix - 1] == '/') { | |
1451 break; | |
1452 } | |
1453 } | |
1454 | |
1455 if (prefix) { | |
1456 len = prefix + text->len; | |
1457 | |
1458 data = ngx_palloc(r->pool, len); | |
1459 if (data == NULL) { | |
1460 return NGX_ERROR; | |
1461 } | |
1462 | |
573 | 1463 p = ngx_copy(data, r->uri.data, prefix); |
553 | 1464 ngx_memcpy(p, text->data, text->len); |
1465 | |
1466 text->len = len; | |
1467 text->data = data; | |
1468 } | |
1469 } | |
1470 | |
1471 return NGX_OK; | |
1472 } | |
1473 | |
1474 if (ngx_array_init(&lengths, r->pool, 8, sizeof(size_t *)) != NGX_OK) { | |
1475 return NGX_ERROR; | |
1476 } | |
1477 | |
1478 if (ngx_array_init(&values, r->pool, 8, sizeof(u_char *)) != NGX_OK) { | |
1479 return NGX_ERROR; | |
1480 } | |
1481 | |
1482 len = 0; | |
1483 i = 0; | |
1484 | |
1485 while (i < text->len) { | |
1486 | |
1487 if (text->data[i] == '$') { | |
1488 | |
1489 var.len = 0; | |
1490 | |
1491 if (++i == text->len) { | |
1492 goto invalid_variable; | |
1493 } | |
1494 | |
1495 if (text->data[i] == '{') { | |
1496 bracket = 1; | |
1497 | |
1498 if (++i == text->len) { | |
1499 goto invalid_variable; | |
1500 } | |
1501 | |
1502 var.data = &text->data[i]; | |
1503 | |
1504 } else { | |
1505 bracket = 0; | |
1506 var.data = &text->data[i]; | |
1507 } | |
1508 | |
1509 for ( /* void */ ; i < text->len; i++, var.len++) { | |
1510 ch = text->data[i]; | |
1511 | |
1512 if (ch == '}' && bracket) { | |
1513 i++; | |
1514 bracket = 0; | |
1515 break; | |
1516 } | |
1517 | |
1518 if ((ch >= 'A' && ch <= 'Z') | |
1519 || (ch >= 'a' && ch <= 'z') | |
1520 || (ch >= '0' && ch <= '9') | |
1521 || ch == '_') | |
1522 { | |
1523 continue; | |
1524 } | |
1525 | |
1526 break; | |
1527 } | |
1528 | |
1529 if (bracket) { | |
1530 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1531 "the closing bracket in \"%V\" " | |
1532 "variable is missing", &var); | |
1533 return NGX_ERROR; | |
1534 } | |
1535 | |
577 | 1536 if (var.len == 0) { |
553 | 1537 goto invalid_variable; |
1538 } | |
1539 | |
611 | 1540 key = 0; |
1541 | |
553 | 1542 for (j = 0; j < var.len; j++) { |
1543 var.data[j] = ngx_tolower(var.data[j]); | |
611 | 1544 key = ngx_hash(key, var.data[j]); |
553 | 1545 } |
1546 | |
611 | 1547 val = ngx_http_ssi_get_variable(r, &var, key); |
553 | 1548 |
1549 if (val == NULL) { | |
635 | 1550 vv = ngx_http_get_variable(r, &var, key, |
1551 flags & NGX_HTTP_SSI_EXPR_TEST); | |
553 | 1552 if (vv == NULL) { |
1553 return NGX_ERROR; | |
1554 } | |
1555 | |
573 | 1556 if (vv->not_found) { |
553 | 1557 continue; |
1558 } | |
1559 | |
573 | 1560 part_data = vv->data; |
1561 part_len = vv->len; | |
553 | 1562 |
1563 } else { | |
573 | 1564 part_data = val->data; |
1565 part_len = val->len; | |
553 | 1566 } |
1567 | |
1568 } else { | |
573 | 1569 part_data = &text->data[i]; |
1570 | |
1571 for (p = part_data; i < text->len; i++) { | |
559 | 1572 ch = text->data[i]; |
1573 | |
1574 if (ch == '$') { | |
1575 if (text->data[i - 1] != '\\') { | |
1576 break; | |
1577 } | |
1578 | |
1579 *(p - 1) = ch; | |
1580 | |
1581 continue; | |
1582 } | |
1583 | |
1584 *p++ = ch; | |
553 | 1585 } |
559 | 1586 |
573 | 1587 part_len = p - part_data; |
553 | 1588 } |
1589 | |
573 | 1590 len += part_len; |
553 | 1591 |
1592 size = ngx_array_push(&lengths); | |
1593 if (size == NULL) { | |
1594 return NGX_ERROR; | |
1595 } | |
1596 | |
573 | 1597 *size = part_len; |
553 | 1598 |
1599 value = ngx_array_push(&values); | |
1600 if (value == NULL) { | |
1601 return NGX_ERROR; | |
1602 } | |
1603 | |
573 | 1604 *value = part_data; |
553 | 1605 } |
1606 | |
1607 prefix = 0; | |
1608 | |
1609 size = lengths.elts; | |
1610 value = values.elts; | |
1611 | |
1612 if (flags & NGX_HTTP_SSI_ADD_PREFIX) { | |
1613 for (i = 0; i < values.nelts; i++) { | |
1614 if (size[i] != 0) { | |
1615 if (*value[i] != '/') { | |
1616 for (prefix = r->uri.len; prefix; prefix--) { | |
1617 if (r->uri.data[prefix - 1] == '/') { | |
1618 len += prefix; | |
1619 break; | |
1620 } | |
1621 } | |
1622 } | |
1623 | |
1624 break; | |
1625 } | |
1626 } | |
1627 } | |
1628 | |
629 | 1629 p = ngx_palloc(r->pool, len + ((flags & NGX_HTTP_SSI_ADD_ZERO) ? 1 : 0)); |
553 | 1630 if (p == NULL) { |
1631 return NGX_ERROR; | |
1632 } | |
1633 | |
1634 text->len = len; | |
1635 text->data = p; | |
1636 | |
573 | 1637 p = ngx_copy(p, r->uri.data, prefix); |
553 | 1638 |
1639 for (i = 0; i < values.nelts; i++) { | |
573 | 1640 p = ngx_copy(p, value[i], size[i]); |
553 | 1641 } |
1642 | |
1643 return NGX_OK; | |
1644 | |
1645 invalid_variable: | |
1646 | |
1647 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1648 "invalid variable name in \"%V\"", text); | |
1649 | |
1650 return NGX_ERROR; | |
1651 } | |
1652 | |
1653 | |
1654 static ngx_int_t | |
1655 ngx_http_ssi_include(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, | |
1656 ngx_str_t **params) | |
1657 { | |
645 | 1658 ngx_int_t rc; |
1659 ngx_str_t *uri, *file, *wait, args; | |
573 | 1660 ngx_uint_t flags; |
553 | 1661 |
1662 uri = params[NGX_HTTP_SSI_INCLUDE_VIRTUAL]; | |
1663 file = params[NGX_HTTP_SSI_INCLUDE_FILE]; | |
645 | 1664 wait = params[NGX_HTTP_SSI_INCLUDE_WAIT]; |
553 | 1665 |
1666 if (uri && file) { | |
1667 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1668 "inlcusion may be either virtual=\"%V\" or file=\"%V\"", | |
1669 uri, file); | |
1670 return NGX_HTTP_SSI_ERROR; | |
1671 } | |
1672 | |
1673 if (uri == NULL && file == NULL) { | |
1674 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1675 "no parameter in \"include\" SSI command"); | |
1676 return NGX_HTTP_SSI_ERROR; | |
1677 } | |
1678 | |
645 | 1679 if (wait) { |
1680 if (uri == NULL) { | |
1681 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1682 "\"wait\" may not be used with file=\"%V\"", | |
1683 uri, file); | |
1684 return NGX_HTTP_SSI_ERROR; | |
1685 } | |
1686 | |
1687 if (wait->len == 2 && ngx_strncasecmp(wait->data, "no", 2) == 0) { | |
1688 wait = NULL; | |
1689 | |
1690 } else if (wait->len != 3 || ngx_strncasecmp(wait->data, "yes", 3) != 0) | |
1691 { | |
1692 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1693 "invalid value \"%V\" in the \"wait\" parameter", | |
1694 &wait); | |
1695 return NGX_HTTP_SSI_ERROR; | |
1696 } | |
1697 } | |
1698 | |
553 | 1699 if (uri == NULL) { |
1700 uri = file; | |
1701 } | |
1702 | |
1703 if (ngx_http_ssi_evaluate_string(r, ctx, uri, NGX_HTTP_SSI_ADD_PREFIX) | |
1704 != NGX_OK) | |
1705 { | |
1706 return NGX_HTTP_SSI_ERROR; | |
1707 } | |
1708 | |
1709 args.len = 0; | |
1710 args.data = NULL; | |
573 | 1711 flags = 0; |
1712 | |
1713 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1714 "ssi include: \"%V\"", uri); | |
1715 | |
1716 if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) { | |
1717 return NGX_HTTP_SSI_ERROR; | |
553 | 1718 } |
1719 | |
645 | 1720 rc = ngx_http_subrequest(r, uri, &args, flags); |
1721 | |
1722 if (rc == NGX_ERROR) { | |
553 | 1723 return NGX_HTTP_SSI_ERROR; |
1724 } | |
1725 | |
645 | 1726 if (wait == NULL) { |
1727 return NGX_OK; | |
1728 } | |
1729 | |
1730 if (rc == NGX_AGAIN) { | |
1731 ctx->wait = 1; | |
1732 } | |
1733 | |
1734 return rc; | |
553 | 1735 } |
1736 | |
1737 | |
497 | 1738 static ngx_int_t |
1739 ngx_http_ssi_echo(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, | |
1740 ngx_str_t **params) | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1741 { |
611 | 1742 ngx_int_t key; |
501 | 1743 ngx_uint_t i; |
499 | 1744 ngx_buf_t *b; |
573 | 1745 ngx_str_t *var, *value, text; |
499 | 1746 ngx_chain_t *cl; |
501 | 1747 ngx_http_variable_value_t *vv; |
497 | 1748 |
1749 var = params[NGX_HTTP_SSI_ECHO_VAR]; | |
1750 | |
643 | 1751 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1752 "ssi echo \"%V\"", var); | |
1753 | |
611 | 1754 key = 0; |
1755 | |
1756 for (i = 0; i < var->len; i++) { | |
1757 var->data[i] = ngx_tolower(var->data[i]); | |
1758 key = ngx_hash(key, var->data[i]); | |
1759 } | |
1760 | |
1761 value = ngx_http_ssi_get_variable(r, var, key); | |
553 | 1762 |
1763 if (value == NULL) { | |
635 | 1764 vv = ngx_http_get_variable(r, var, key, 1); |
553 | 1765 |
1766 if (vv == NULL) { | |
1767 return NGX_HTTP_SSI_ERROR; | |
1768 } | |
1769 | |
573 | 1770 if (!vv->not_found) { |
1771 text.data = vv->data; | |
1772 text.len = vv->len; | |
1773 value = &text; | |
553 | 1774 } |
501 | 1775 } |
497 | 1776 |
553 | 1777 if (value == NULL) { |
499 | 1778 value = params[NGX_HTTP_SSI_ECHO_DEFAULT]; |
1779 | |
1780 if (value == NULL) { | |
1781 value = &ngx_http_ssi_none; | |
1782 | |
1783 } else if (value->len == 0) { | |
1784 return NGX_OK; | |
1785 } | |
1786 | |
1787 } else { | |
1788 if (value->len == 0) { | |
1789 return NGX_OK; | |
1790 } | |
1791 } | |
1792 | |
1793 b = ngx_calloc_buf(r->pool); | |
1794 if (b == NULL) { | |
1795 return NGX_HTTP_SSI_ERROR; | |
1796 } | |
1797 | |
1798 cl = ngx_alloc_chain_link(r->pool); | |
1799 if (cl == NULL) { | |
497 | 1800 return NGX_HTTP_SSI_ERROR; |
1801 } | |
1802 | |
1803 b->memory = 1; | |
1804 b->pos = value->data; | |
1805 b->last = value->data + value->len; | |
1806 | |
1807 cl->buf = b; | |
1808 cl->next = NULL; | |
1809 *ctx->last_out = cl; | |
1810 ctx->last_out = &cl->next; | |
1811 | |
242
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1812 return NGX_OK; |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1813 } |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1814 |
5d4f49dc8de5
nginx-0.0.1-2004-01-28-18:22:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
241
diff
changeset
|
1815 |
509 | 1816 static ngx_int_t |
1817 ngx_http_ssi_config(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, | |
1818 ngx_str_t **params) | |
1819 { | |
1820 ngx_str_t *value; | |
1821 | |
1822 value = params[NGX_HTTP_SSI_CONFIG_TIMEFMT]; | |
1823 | |
1824 if (value) { | |
589 | 1825 ctx->timefmt.len = value->len; |
1826 ctx->timefmt.data = ngx_palloc(r->pool, value->len + 1); | |
1827 if (ctx->timefmt.data == NULL) { | |
1828 return NGX_HTTP_SSI_ERROR; | |
1829 } | |
1830 | |
1831 ngx_cpystrn(ctx->timefmt.data, value->data, value->len + 1); | |
509 | 1832 } |
1833 | |
547 | 1834 value = params[NGX_HTTP_SSI_CONFIG_ERRMSG]; |
1835 | |
1836 if (value) { | |
1837 ctx->errmsg = *value; | |
1838 } | |
1839 | |
509 | 1840 return NGX_OK; |
1841 } | |
1842 | |
1843 | |
1844 static ngx_int_t | |
553 | 1845 ngx_http_ssi_set(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, |
509 | 1846 ngx_str_t **params) |
1847 { | |
611 | 1848 ngx_int_t key; |
1849 ngx_uint_t i; | |
553 | 1850 ngx_str_t *name, *value, *vv; |
1851 ngx_http_ssi_var_t *var; | |
1852 ngx_http_ssi_ctx_t *mctx; | |
1853 | |
1854 mctx = ngx_http_get_module_ctx(r->main, ngx_http_ssi_filter_module); | |
1855 | |
1856 if (mctx->variables.elts == NULL) { | |
1857 if (ngx_array_init(&mctx->variables, r->pool, 4, | |
1858 sizeof(ngx_http_ssi_var_t)) != NGX_OK) | |
1859 { | |
509 | 1860 return NGX_HTTP_SSI_ERROR; |
1861 } | |
1862 } | |
1863 | |
553 | 1864 name = params[NGX_HTTP_SSI_SET_VAR]; |
1865 value = params[NGX_HTTP_SSI_SET_VALUE]; | |
1866 | |
643 | 1867 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1868 "ssi set \"%V\" \"%V\"", name, value); | |
1869 | |
553 | 1870 if (ngx_http_ssi_evaluate_string(r, ctx, value, 0) != NGX_OK) { |
509 | 1871 return NGX_HTTP_SSI_ERROR; |
1872 } | |
1873 | |
611 | 1874 key = 0; |
1875 | |
1876 for (i = 0; i < name->len; i++) { | |
1877 name->data[i] = ngx_tolower(name->data[i]); | |
1878 key = ngx_hash(key, name->data[i]); | |
1879 } | |
1880 | |
1881 vv = ngx_http_ssi_get_variable(r, name, key); | |
553 | 1882 |
1883 if (vv) { | |
1884 *vv = *value; | |
1885 return NGX_OK; | |
1886 } | |
1887 | |
1888 var = ngx_array_push(&mctx->variables); | |
1889 if (var == NULL) { | |
1890 return NGX_HTTP_SSI_ERROR; | |
1891 } | |
1892 | |
1893 var->name = *name; | |
611 | 1894 var->key = key; |
553 | 1895 var->value = *value; |
1896 | |
1897 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1898 "set: \"%V\"=\"%V\"", name, value); | |
1899 | |
509 | 1900 return NGX_OK; |
1901 } | |
1902 | |
1903 | |
1904 static ngx_int_t | |
1905 ngx_http_ssi_if(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, | |
1906 ngx_str_t **params) | |
1907 { | |
553 | 1908 u_char *p, *last; |
1909 ngx_str_t *expr, left, right; | |
1910 ngx_int_t rc; | |
629 | 1911 ngx_uint_t negative, noregex, flags; |
551 | 1912 #if (NGX_PCRE) |
553 | 1913 ngx_str_t err; |
1914 ngx_regex_t *regex; | |
1915 u_char errstr[NGX_MAX_CONF_ERRSTR]; | |
551 | 1916 #endif |
509 | 1917 |
629 | 1918 if (ctx->command.len == 2) { |
1919 if (ctx->conditional) { | |
1920 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1921 "the \"if\" command inside the \"if\" command"); | |
1922 return NGX_HTTP_SSI_ERROR; | |
1923 } | |
1924 } | |
1925 | |
1926 if (ctx->output_chosen) { | |
1927 ctx->output = 0; | |
1928 return NGX_OK; | |
1929 } | |
1930 | |
509 | 1931 expr = params[NGX_HTTP_SSI_IF_EXPR]; |
1932 | |
643 | 1933 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1934 "ssi if expr=\"%V\"", expr); | |
1935 | |
553 | 1936 left.data = expr->data; |
551 | 1937 last = expr->data + expr->len; |
1938 | |
553 | 1939 for (p = left.data; p < last; p++) { |
551 | 1940 if (*p >= 'A' && *p <= 'Z') { |
1941 *p |= 0x20; | |
1942 continue; | |
1943 } | |
509 | 1944 |
553 | 1945 if ((*p >= 'a' && *p <= 'z') |
1946 || (*p >= '0' && *p <= '9') | |
573 | 1947 || *p == '$' || *p == '{' || *p == '}' || *p == '_' |
1948 || *p == '"' || *p == '\'') | |
553 | 1949 { |
551 | 1950 continue; |
1951 } | |
1952 | |
1953 break; | |
1954 } | |
1955 | |
553 | 1956 left.len = p - left.data; |
551 | 1957 |
1958 while (p < last && *p == ' ') { | |
1959 p++; | |
509 | 1960 } |
1961 | |
635 | 1962 flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0; |
1963 | |
553 | 1964 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1965 "left: \"%V\"", &left); | |
1966 | |
635 | 1967 if (ngx_http_ssi_evaluate_string(r, ctx, &left, flags) != NGX_OK) { |
509 | 1968 return NGX_HTTP_SSI_ERROR; |
1969 } | |
1970 | |
553 | 1971 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1972 "evaluted left: \"%V\"", &left); | |
1973 | |
551 | 1974 if (p == last) { |
553 | 1975 if (left.len) { |
551 | 1976 ctx->output = 1; |
629 | 1977 ctx->output_chosen = 1; |
551 | 1978 |
1979 } else { | |
1980 ctx->output = 0; | |
1981 } | |
1982 | |
629 | 1983 ctx->conditional = NGX_HTTP_SSI_COND_IF; |
1984 | |
551 | 1985 return NGX_OK; |
1986 } | |
1987 | |
1988 if (p < last && *p == '=') { | |
1989 negative = 0; | |
1990 p++; | |
1991 | |
1992 } else if (p + 1 < last && *p == '!' && *(p + 1) == '=') { | |
1993 negative = 1; | |
1994 p += 2; | |
1995 | |
1996 } else { | |
1997 goto invalid_expression; | |
1998 } | |
1999 | |
2000 while (p < last && *p == ' ') { | |
2001 p++; | |
2002 } | |
2003 | |
2004 if (p < last && *p == '/') { | |
2005 if (*(last - 1) != '/') { | |
2006 goto invalid_expression; | |
2007 } | |
2008 | |
2009 noregex = 0; | |
629 | 2010 flags = NGX_HTTP_SSI_ADD_ZERO; |
551 | 2011 last--; |
2012 p++; | |
2013 | |
2014 } else { | |
2015 noregex = 1; | |
629 | 2016 flags = 0; |
2017 | |
2018 if (p < last - 1 && p[0] == '\\' && p[1] == '/') { | |
2019 p++; | |
2020 } | |
551 | 2021 } |
2022 | |
2023 right.len = last - p; | |
2024 right.data = p; | |
2025 | |
553 | 2026 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2027 "right: \"%V\"", &right); | |
2028 | |
629 | 2029 if (ngx_http_ssi_evaluate_string(r, ctx, &right, flags) != NGX_OK) { |
553 | 2030 return NGX_HTTP_SSI_ERROR; |
551 | 2031 } |
2032 | |
553 | 2033 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2034 "evaluted right: \"%V\"", &right); | |
551 | 2035 |
2036 if (noregex) { | |
2037 if (left.len != right.len) { | |
2038 rc = -1; | |
2039 | |
2040 } else { | |
2041 rc = ngx_strncmp(left.data, right.data, right.len); | |
2042 } | |
2043 | |
2044 } else { | |
2045 #if (NGX_PCRE) | |
2046 err.len = NGX_MAX_CONF_ERRSTR; | |
2047 err.data = errstr; | |
2048 | |
2049 right.data[right.len] = '\0'; | |
2050 | |
2051 regex = ngx_regex_compile(&right, 0, r->pool, &err); | |
2052 | |
2053 if (regex == NULL) { | |
2054 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "%s", err.data); | |
2055 return NGX_HTTP_SSI_ERROR; | |
2056 } | |
2057 | |
2058 rc = ngx_regex_exec(regex, &left, NULL, 0); | |
2059 | |
2060 if (rc != NGX_REGEX_NO_MATCHED && rc < 0) { | |
2061 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | |
2062 ngx_regex_exec_n " failed: %d on \"%V\" using \"%V\"", | |
2063 rc, &left, &right); | |
2064 return NGX_HTTP_SSI_ERROR; | |
2065 } | |
2066 #else | |
2067 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | |
2068 "the using of the regex \"%V\" in SSI " | |
2069 "requires PCRE library", &right); | |
2070 | |
2071 return NGX_HTTP_SSI_ERROR; | |
2072 #endif | |
2073 } | |
2074 | |
2075 if ((rc == 0 && !negative) || (rc != 0 && negative)) { | |
509 | 2076 ctx->output = 1; |
629 | 2077 ctx->output_chosen = 1; |
509 | 2078 |
2079 } else { | |
2080 ctx->output = 0; | |
2081 } | |
2082 | |
629 | 2083 ctx->conditional = NGX_HTTP_SSI_COND_IF; |
2084 | |
509 | 2085 return NGX_OK; |
551 | 2086 |
2087 invalid_expression: | |
2088 | |
2089 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
2090 "invalid expression in \"%V\"", expr); | |
2091 | |
2092 return NGX_HTTP_SSI_ERROR; | |
509 | 2093 } |
2094 | |
2095 | |
2096 static ngx_int_t | |
2097 ngx_http_ssi_else(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, | |
2098 ngx_str_t **params) | |
2099 { | |
643 | 2100 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2101 "ssi else"); | |
2102 | |
629 | 2103 if (ctx->output_chosen) { |
2104 ctx->output = 0; | |
2105 } else { | |
2106 ctx->output = 1; | |
2107 } | |
2108 | |
2109 ctx->conditional = NGX_HTTP_SSI_COND_ELSE; | |
509 | 2110 |
2111 return NGX_OK; | |
2112 } | |
2113 | |
2114 | |
2115 static ngx_int_t | |
2116 ngx_http_ssi_endif(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, | |
2117 ngx_str_t **params) | |
2118 { | |
643 | 2119 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2120 "ssi endif"); | |
2121 | |
509 | 2122 ctx->output = 1; |
629 | 2123 ctx->output_chosen = 0; |
2124 ctx->conditional = 0; | |
509 | 2125 |
2126 return NGX_OK; | |
2127 } | |
2128 | |
2129 | |
573 | 2130 static ngx_int_t |
2131 ngx_http_ssi_date_gmt_local_variable(ngx_http_request_t *r, | |
2132 ngx_http_variable_value_t *v, uintptr_t gmt) | |
509 | 2133 { |
573 | 2134 ngx_http_ssi_ctx_t *ctx; |
2135 ngx_time_t *tp; | |
2136 struct tm tm; | |
2137 char buf[NGX_HTTP_SSI_DATE_LEN]; | |
2138 | |
577 | 2139 v->valid = 1; |
573 | 2140 v->no_cachable = 0; |
2141 v->not_found = 0; | |
509 | 2142 |
563 | 2143 tp = ngx_timeofday(); |
2144 | |
509 | 2145 ctx = ngx_http_get_module_ctx(r, ngx_http_ssi_filter_module); |
2146 | |
2147 if (ctx->timefmt.len == sizeof("%s") - 1 | |
2148 && ctx->timefmt.data[0] == '%' && ctx->timefmt.data[1] == 's') | |
2149 { | |
573 | 2150 v->data = ngx_palloc(r->pool, NGX_TIME_T_LEN); |
2151 if (v->data == NULL) { | |
2152 return NGX_ERROR; | |
509 | 2153 } |
2154 | |
573 | 2155 v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff)) |
2156 - v->data; | |
2157 return NGX_OK; | |
509 | 2158 } |
2159 | |
2160 if (gmt) { | |
563 | 2161 ngx_libc_gmtime(tp->sec, &tm); |
509 | 2162 } else { |
563 | 2163 ngx_libc_localtime(tp->sec, &tm); |
509 | 2164 } |
2165 | |
573 | 2166 v->len = strftime(buf, NGX_HTTP_SSI_DATE_LEN, |
2167 (char *) ctx->timefmt.data, &tm); | |
2168 if (v->len == 0) { | |
2169 return NGX_ERROR; | |
509 | 2170 } |
2171 | |
573 | 2172 v->data = ngx_palloc(r->pool, v->len); |
2173 if (v->data == NULL) { | |
2174 return NGX_ERROR; | |
509 | 2175 } |
2176 | |
573 | 2177 ngx_memcpy(v->data, buf, v->len); |
2178 | |
2179 return NGX_OK; | |
509 | 2180 } |
2181 | |
2182 | |
527 | 2183 static char * |
2184 ngx_http_ssi_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
2185 { | |
597 | 2186 ngx_http_ssi_loc_conf_t *slcf = conf; |
527 | 2187 |
2188 ngx_str_t *value, *type; | |
2189 ngx_uint_t i; | |
2190 | |
597 | 2191 if (slcf->types == NULL) { |
2192 slcf->types = ngx_array_create(cf->pool, 4, sizeof(ngx_str_t)); | |
2193 if (slcf->types == NULL) { | |
527 | 2194 return NGX_CONF_ERROR; |
2195 } | |
2196 | |
597 | 2197 type = ngx_array_push(slcf->types); |
527 | 2198 if (type == NULL) { |
2199 return NGX_CONF_ERROR; | |
2200 } | |
2201 | |
2202 type->len = sizeof("text/html") - 1; | |
2203 type->data = (u_char *) "text/html"; | |
2204 } | |
2205 | |
2206 value = cf->args->elts; | |
2207 | |
2208 for (i = 1; i < cf->args->nelts; i++) { | |
2209 | |
2210 if (ngx_strcmp(value[i].data, "text/html") == 0) { | |
2211 continue; | |
2212 } | |
2213 | |
597 | 2214 type = ngx_array_push(slcf->types); |
527 | 2215 if (type == NULL) { |
2216 return NGX_CONF_ERROR; | |
2217 } | |
2218 | |
2219 type->len = value[i].len; | |
2220 | |
2221 type->data = ngx_palloc(cf->pool, type->len + 1); | |
2222 if (type->data == NULL) { | |
2223 return NGX_CONF_ERROR; | |
2224 } | |
2225 | |
2226 ngx_cpystrn(type->data, value[i].data, type->len + 1); | |
2227 } | |
2228 | |
2229 return NGX_CONF_OK; | |
2230 } | |
2231 | |
2232 | |
509 | 2233 static ngx_int_t |
597 | 2234 ngx_http_ssi_preconfiguration(ngx_conf_t *cf) |
509 | 2235 { |
597 | 2236 ngx_int_t rc; |
2237 ngx_http_variable_t *var, *v; | |
2238 ngx_http_ssi_command_t *cmd; | |
2239 ngx_http_ssi_main_conf_t *smcf; | |
509 | 2240 |
2241 for (v = ngx_http_ssi_vars; v->name.len; v++) { | |
2242 var = ngx_http_add_variable(cf, &v->name, v->flags); | |
2243 if (var == NULL) { | |
2244 return NGX_ERROR; | |
2245 } | |
2246 | |
637 | 2247 var->get_handler = v->get_handler; |
509 | 2248 var->data = v->data; |
2249 } | |
2250 | |
597 | 2251 smcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_ssi_filter_module); |
2252 | |
2253 for (cmd = ngx_http_ssi_commands; cmd->name.len; cmd++) { | |
2254 rc = ngx_hash_add_key(&smcf->commands, &cmd->name, cmd, | |
2255 NGX_HASH_READONLY_KEY); | |
2256 | |
2257 if (rc == NGX_OK) { | |
2258 continue; | |
2259 } | |
2260 | |
2261 if (rc == NGX_BUSY) { | |
2262 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
2263 "conflicting SSI command \"%V\"", &cmd->name); | |
2264 } | |
2265 | |
2266 return NGX_ERROR; | |
2267 } | |
2268 | |
577 | 2269 return NGX_OK; |
509 | 2270 } |
2271 | |
2272 | |
497 | 2273 static void * |
597 | 2274 ngx_http_ssi_create_main_conf(ngx_conf_t *cf) |
2275 { | |
2276 ngx_http_ssi_main_conf_t *smcf; | |
2277 | |
2278 smcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssi_main_conf_t)); | |
2279 if (smcf == NULL) { | |
2280 return NGX_CONF_ERROR; | |
2281 } | |
2282 | |
2283 smcf->commands.pool = cf->pool; | |
2284 smcf->commands.temp_pool = cf->temp_pool; | |
2285 | |
2286 if (ngx_hash_keys_array_init(&smcf->commands, NGX_HASH_SMALL) != NGX_OK) { | |
2287 return NGX_CONF_ERROR; | |
2288 } | |
2289 | |
2290 return smcf; | |
2291 } | |
2292 | |
2293 | |
2294 static char * | |
2295 ngx_http_ssi_init_main_conf(ngx_conf_t *cf, void *conf) | |
2296 { | |
2297 ngx_http_ssi_main_conf_t *smcf = conf; | |
2298 | |
2299 ngx_hash_init_t hash; | |
2300 | |
2301 hash.hash = &smcf->hash; | |
2302 hash.key = ngx_hash_key; | |
2303 hash.max_size = 1024; | |
2304 hash.bucket_size = ngx_cacheline_size; | |
2305 hash.name = "ssi_command_hash"; | |
2306 hash.pool = cf->pool; | |
2307 hash.temp_pool = NULL; | |
2308 | |
2309 if (ngx_hash_init(&hash, smcf->commands.keys.elts, | |
2310 smcf->commands.keys.nelts) | |
2311 != NGX_OK) | |
2312 { | |
2313 return NGX_CONF_ERROR; | |
2314 } | |
2315 | |
2316 return NGX_CONF_OK; | |
2317 } | |
2318 | |
2319 | |
2320 static void * | |
497 | 2321 ngx_http_ssi_create_conf(ngx_conf_t *cf) |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2322 { |
597 | 2323 ngx_http_ssi_loc_conf_t *slcf; |
2324 | |
2325 slcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssi_loc_conf_t)); | |
2326 if (slcf == NULL) { | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2327 return NGX_CONF_ERROR; |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2328 } |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2329 |
527 | 2330 /* |
2331 * set by ngx_pcalloc(): | |
2332 * | |
2333 * conf->types = NULL; | |
2334 */ | |
2335 | |
597 | 2336 slcf->enable = NGX_CONF_UNSET; |
2337 slcf->silent_errors = NGX_CONF_UNSET; | |
2338 slcf->ignore_recycled_buffers = NGX_CONF_UNSET; | |
2339 | |
2340 slcf->min_file_chunk = NGX_CONF_UNSET_SIZE; | |
2341 slcf->value_len = NGX_CONF_UNSET_SIZE; | |
2342 | |
2343 return slcf; | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2344 } |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2345 |
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2346 |
497 | 2347 static char * |
2348 ngx_http_ssi_merge_conf(ngx_conf_t *cf, void *parent, void *child) | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2349 { |
597 | 2350 ngx_http_ssi_loc_conf_t *prev = parent; |
2351 ngx_http_ssi_loc_conf_t *conf = child; | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2352 |
527 | 2353 ngx_str_t *type; |
2354 | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2355 ngx_conf_merge_value(conf->enable, prev->enable, 0); |
497 | 2356 ngx_conf_merge_value(conf->silent_errors, prev->silent_errors, 0); |
509 | 2357 ngx_conf_merge_value(conf->ignore_recycled_buffers, |
2358 prev->ignore_recycled_buffers, 0); | |
497 | 2359 |
2360 ngx_conf_merge_size_value(conf->min_file_chunk, prev->min_file_chunk, 1024); | |
241
3bfa496bc22e
nginx-0.0.1-2004-01-27-10:08:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
240
diff
changeset
|
2361 ngx_conf_merge_size_value(conf->value_len, prev->value_len, 256); |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2362 |
527 | 2363 if (conf->types == NULL) { |
2364 if (prev->types == NULL) { | |
2365 conf->types = ngx_array_create(cf->pool, 1, sizeof(ngx_str_t)); | |
2366 if (conf->types == NULL) { | |
2367 return NGX_CONF_ERROR; | |
2368 } | |
2369 | |
2370 type = ngx_array_push(conf->types); | |
2371 if (type == NULL) { | |
2372 return NGX_CONF_ERROR; | |
2373 } | |
2374 | |
2375 type->len = sizeof("text/html") - 1; | |
2376 type->data = (u_char *) "text/html"; | |
2377 | |
2378 } else { | |
2379 conf->types = prev->types; | |
2380 } | |
2381 } | |
2382 | |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2383 return NGX_CONF_OK; |
15
cbb38b60495c
nginx-0.0.1-2002-09-18-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
14
diff
changeset
|
2384 } |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2385 |
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2386 |
497 | 2387 static ngx_int_t |
2388 ngx_http_ssi_filter_init(ngx_cycle_t *cycle) | |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
2389 { |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2390 ngx_http_next_header_filter = ngx_http_top_header_filter; |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
2391 ngx_http_top_header_filter = ngx_http_ssi_header_filter; |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2392 |
239
574bea0142be
nginx-0.0.1-2004-01-26-11:52:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
131
diff
changeset
|
2393 ngx_http_next_body_filter = ngx_http_top_body_filter; |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
2394 ngx_http_top_body_filter = ngx_http_ssi_body_filter; |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2395 |
125
885ffb8cc32a
nginx-0.0.1-2003-08-06-09:30:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
16
diff
changeset
|
2396 return NGX_OK; |
14
f8a0d0f31a24
nginx-0.0.1-2002-09-17-21:49:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2397 } |