Mercurial > hg > nginx
comparison src/http/modules/ngx_http_ssi_filter.c @ 131:049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 14 Aug 2003 06:00:28 +0000 |
parents | 7a886b9a67dc |
children | 574bea0142be |
comparison
equal
deleted
inserted
replaced
130:a490ad05164d | 131:049e78b1f852 |
---|---|
13 #define NGX_HTTP_SSI_INVALID_VALUE 4 | 13 #define NGX_HTTP_SSI_INVALID_VALUE 4 |
14 #define NGX_HTTP_SSI_LONG_VALUE 5 | 14 #define NGX_HTTP_SSI_LONG_VALUE 5 |
15 | 15 |
16 | 16 |
17 typedef struct { | 17 typedef struct { |
18 ngx_hunk_t *hunk; | |
18 ngx_table_elt_t *param; | 19 ngx_table_elt_t *param; |
19 ngx_str_t command; | 20 ngx_str_t command; |
20 ngx_array_t params; | 21 ngx_array_t params; |
21 int state; | 22 int state; |
22 int looked; | 23 int looked; |
23 char *pos; | 24 char *pos; |
24 ngx_chain_t *out; | 25 ngx_chain_t *incoming; |
25 int new_hunk; | 26 int new_hunk; |
26 u_int value_len; | 27 u_int value_len; |
27 } ngx_http_ssi_ctx_t; | 28 } ngx_http_ssi_ctx_t; |
28 | 29 |
29 | 30 |
73 } | 74 } |
74 | 75 |
75 | 76 |
76 static int ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in) | 77 static int ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in) |
77 { | 78 { |
79 int rc; | |
78 ngx_chain_t chain; | 80 ngx_chain_t chain; |
79 ngx_http_ssi_ctx_t *ctx; | 81 ngx_http_ssi_ctx_t *ctx; |
80 | 82 |
81 ctx = ngx_http_get_module_ctx(r, ngx_http_ssi_filter_module); | 83 ctx = ngx_http_get_module_ctx(r, ngx_http_ssi_filter_module); |
82 | 84 |
83 if ((ctx == NULL) || (in == NULL && ctx->out == NULL)) { | 85 if ((ctx == NULL) || (in == NULL && ctx->incoming == NULL)) { |
84 return next_body_filter(r, NULL); | 86 return next_body_filter(r, NULL); |
85 } | 87 } |
86 | 88 |
87 if (ctx->hunk && | 89 if (ctx->hunk && |
88 (((ctx->hunk->type & NGX_HUNK_FILE) | 90 (((ctx->hunk->type & NGX_HUNK_FILE) |
113 | 115 |
114 } | 116 } |
115 | 117 |
116 #if 0 | 118 #if 0 |
117 | 119 |
118 add in to ctx->out chain | 120 add in to ctx->incoming chain |
119 | 121 |
120 while (ctx->out) { | 122 while (ctx->incoming) { |
121 rc == ngx_http_ssi_exec(r, ctx); | 123 rc == ngx_http_ssi_exec(r, ctx); |
122 | 124 |
123 if (rc != NGX_ERROR) { | 125 if (rc != NGX_ERROR) { |
124 return rc; | 126 return rc; |
125 } | 127 } |
126 | 128 |
127 ctx->out = ctx->out->next; | 129 ctx->incoming = ctx->incoming->next; |
128 } | 130 } |
129 | 131 |
130 #endif | 132 #endif |
131 | 133 |
132 return NGX_OK; | 134 return NGX_OK; |
134 | 136 |
135 | 137 |
136 #if 0 | 138 #if 0 |
137 | 139 |
138 | 140 |
139 while (ctx->out) { | 141 while (ctx->incoming) { |
140 rc = ngx_http_ssi_parse(r, ctx, ctx->out->hunk); | 142 rc = ngx_http_ssi_parse(r, ctx, ctx->incoming->hunk); |
141 | 143 |
142 if (rc == NGX_ERROR) { | 144 if (rc == NGX_ERROR) { |
143 return rc; | 145 return rc; |
144 } | 146 } |
145 | 147 |
153 if (rc == NGX_HTTP_SSI_DONE) { | 155 if (rc == NGX_HTTP_SSI_DONE) { |
154 | 156 |
155 | 157 |
156 - looked | 158 - looked |
157 | 159 |
158 chain.hunk = ctx->out->hunk; | 160 chain.hunk = ctx->incoming->hunk; |
159 chain.next = NULL; | 161 chain.next = NULL; |
160 | 162 |
161 rc = next_body_filter(r, &chain); | 163 rc = next_body_filter(r, &chain); |
162 | 164 |
163 if (rc != NGX_OK) { | 165 if (rc != NGX_OK) { |
164 ctx->out = ctx->out->next; | 166 ctx->incoming = ctx->incoming->next; |
165 return rc; | 167 return rc; |
166 } | 168 } |
167 | 169 |
168 } else if (rc == NGX_HTTP_SSI_INVALID_COMMAND) { | 170 } else if (rc == NGX_HTTP_SSI_INVALID_COMMAND) { |
169 } else if (rc == NGX_HTTP_SSI_INVALID_PARAM) { | 171 } else if (rc == NGX_HTTP_SSI_INVALID_PARAM) { |
170 } else if (rc == NGX_HTTP_SSI_INVALID_VALUE) { | 172 } else if (rc == NGX_HTTP_SSI_INVALID_VALUE) { |
171 } else if (rc == NGX_HTTP_SSI_LONG_VALUE) { | 173 } else if (rc == NGX_HTTP_SSI_LONG_VALUE) { |
172 } | 174 } |
173 | 175 |
174 ctx->out = ctx->out->next; | 176 ctx->incoming = ctx->incoming->next; |
175 } | 177 } |
176 | 178 |
177 #endif | 179 #endif |
178 | 180 |
179 | 181 |
188 ngx_http_ssi_copy_t *copy = data; | 190 ngx_http_ssi_copy_t *copy = data; |
189 | 191 |
190 ngx_hunk_t *h; | 192 ngx_hunk_t *h; |
191 ngx_chain_t chain; | 193 ngx_chain_t chain; |
192 | 194 |
193 h = ctx->out->hunk; | 195 h = ctx->incoming->hunk; |
194 | 196 |
195 if (ctx->looked == 0 && ctx->pos == h->last) { | 197 if (ctx->looked == 0 && ctx->pos == h->last) { |
196 chain.hunk = h; | 198 chain.hunk = h; |
197 chain.next = NULL; | 199 chain.next = NULL; |
198 | 200 |