comparison src/http/modules/ngx_http_ssi_filter_module.c @ 96:ca4f70b3ccc6 NGINX_0_2_2

nginx 0.2.2 *) Feature: the "config errmsg" command of the ngx_http_ssi_module. *) Change: the ngx_http_geo_module variables can be overridden by the "set" directive. *) Feature: the "ssl_protocols" and "ssl_prefer_server_ciphers" directives of the ngx_http_ssl_module and ngx_imap_ssl_module. *) Bugfix: the ngx_http_autoindex_module did not show correctly the long file names; *) Bugfix: the ngx_http_autoindex_module now do not show the files starting by dot. *) Bugfix: if the SSL handshake failed then another connection may be closed too. Thanks to Rob Mueller. *) Bugfix: the export versions of MSIE 5.x could not connect via HTTPS.
author Igor Sysoev <http://sysoev.ru>
date Fri, 30 Sep 2005 00:00:00 +0400
parents 71c46860eb55
children d6800bbe720e
comparison
equal deleted inserted replaced
95:2f95911bc4b4 96:ca4f70b3ccc6
57 size_t value_len; 57 size_t value_len;
58 58
59 ngx_uint_t output; /* unsigned output:1; */ 59 ngx_uint_t output; /* unsigned output:1; */
60 60
61 ngx_str_t timefmt; 61 ngx_str_t timefmt;
62 ngx_str_t errmsg;
62 } ngx_http_ssi_ctx_t; 63 } ngx_http_ssi_ctx_t;
63 64
64 65
65 typedef ngx_int_t (*ngx_http_ssi_command_pt) (ngx_http_request_t *r, 66 typedef ngx_int_t (*ngx_http_ssi_command_pt) (ngx_http_request_t *r,
66 ngx_http_ssi_ctx_t *ctx, ngx_str_t **); 67 ngx_http_ssi_ctx_t *ctx, ngx_str_t **);
215 static ngx_int_t (*ngx_http_next_body_filter) (ngx_http_request_t *r, 216 static ngx_int_t (*ngx_http_next_body_filter) (ngx_http_request_t *r,
216 ngx_chain_t *in); 217 ngx_chain_t *in);
217 218
218 219
219 static u_char ngx_http_ssi_string[] = "<!--"; 220 static u_char ngx_http_ssi_string[] = "<!--";
220 static u_char ngx_http_ssi_error_string[] =
221 "[an error occurred while processing the directive]";
222 221
223 static ngx_str_t ngx_http_ssi_none = ngx_string("(none)"); 222 static ngx_str_t ngx_http_ssi_none = ngx_string("(none)");
224 223
225 224
226 #define NGX_HTTP_SSI_ECHO_VAR 0 225 #define NGX_HTTP_SSI_ECHO_VAR 0
227 #define NGX_HTTP_SSI_ECHO_DEFAULT 1 226 #define NGX_HTTP_SSI_ECHO_DEFAULT 1
228 227
229 #define NGX_HTTP_SSI_CONFIG_TIMEFMT 0 228 #define NGX_HTTP_SSI_CONFIG_ERRMSG 0
229 #define NGX_HTTP_SSI_CONFIG_TIMEFMT 1
230 230
231 #define NGX_HTTP_SSI_INCLUDE_VIRTUAL 0 231 #define NGX_HTTP_SSI_INCLUDE_VIRTUAL 0
232 #define NGX_HTTP_SSI_INCLUDE_FILE 1 232 #define NGX_HTTP_SSI_INCLUDE_FILE 1
233 233
234 #define NGX_HTTP_SSI_IF_EXPR 0 234 #define NGX_HTTP_SSI_IF_EXPR 0
248 { ngx_null_string, 0, 0 } 248 { ngx_null_string, 0, 0 }
249 }; 249 };
250 250
251 251
252 static ngx_http_ssi_param_t ngx_http_ssi_config_params[] = { 252 static ngx_http_ssi_param_t ngx_http_ssi_config_params[] = {
253 { ngx_string("errmsg"), NGX_HTTP_SSI_CONFIG_ERRMSG, 0 },
253 { ngx_string("timefmt"), NGX_HTTP_SSI_CONFIG_TIMEFMT, 0 }, 254 { ngx_string("timefmt"), NGX_HTTP_SSI_CONFIG_TIMEFMT, 0 },
254 { ngx_null_string, 0, 0 } 255 { ngx_null_string, 0, 0 }
255 }; 256 };
256 257
257 258
344 ctx->params.nalloc = NGX_HTTP_SSI_PARAMS_N; 345 ctx->params.nalloc = NGX_HTTP_SSI_PARAMS_N;
345 ctx->params.pool = r->pool; 346 ctx->params.pool = r->pool;
346 347
347 ctx->timefmt.len = sizeof("%A, %d-%b-%Y %H:%M:%S %Z") - 1; 348 ctx->timefmt.len = sizeof("%A, %d-%b-%Y %H:%M:%S %Z") - 1;
348 ctx->timefmt.data = (u_char *) "%A, %d-%b-%Y %H:%M:%S %Z"; 349 ctx->timefmt.data = (u_char *) "%A, %d-%b-%Y %H:%M:%S %Z";
350
351 ctx->errmsg.len =
352 sizeof("[an error occurred while processing the directive]") - 1;
353 ctx->errmsg.data = (u_char *)
354 "[an error occurred while processing the directive]";
349 355
350 r->filter_need_in_memory = 1; 356 r->filter_need_in_memory = 1;
351 357
352 if (r->main == NULL) { 358 if (r->main == NULL) {
353 r->headers_out.content_length_n = -1; 359 r->headers_out.content_length_n = -1;
651 657
652 cl->buf = b; 658 cl->buf = b;
653 } 659 }
654 660
655 b->memory = 1; 661 b->memory = 1;
656 b->pos = ngx_http_ssi_error_string; 662 b->pos = ctx->errmsg.data;
657 b->last = ngx_http_ssi_error_string 663 b->last = ctx->errmsg.data + ctx->errmsg.len;
658 + sizeof(ngx_http_ssi_error_string) - 1;
659 664
660 cl->next = NULL; 665 cl->next = NULL;
661 *ctx->last_out = cl; 666 *ctx->last_out = cl;
662 ctx->last_out = &cl->next; 667 ctx->last_out = &cl->next;
663 668
1367 1372
1368 value = params[NGX_HTTP_SSI_CONFIG_TIMEFMT]; 1373 value = params[NGX_HTTP_SSI_CONFIG_TIMEFMT];
1369 1374
1370 if (value) { 1375 if (value) {
1371 ctx->timefmt = *value; 1376 ctx->timefmt = *value;
1377 }
1378
1379 value = params[NGX_HTTP_SSI_CONFIG_ERRMSG];
1380
1381 if (value) {
1382 ctx->errmsg = *value;
1372 } 1383 }
1373 1384
1374 return NGX_OK; 1385 return NGX_OK;
1375 } 1386 }
1376 1387