From cada4ee47d37e1e954e15a07afc6f45d6fb04342 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 28 Jan 2004 15:22:37 +0000 Subject: nginx-0.0.1-2004-01-28-18:22:37 import --- src/http/modules/ngx_http_ssi_filter.c | 292 ++++++++++++++++++++++++++++----- 1 file changed, 247 insertions(+), 45 deletions(-) (limited to 'src/http/modules') diff --git a/src/http/modules/ngx_http_ssi_filter.c b/src/http/modules/ngx_http_ssi_filter.c index 0972523d6..b6dc637ac 100644 --- a/src/http/modules/ngx_http_ssi_filter.c +++ b/src/http/modules/ngx_http_ssi_filter.c @@ -20,6 +20,10 @@ typedef struct { } ngx_http_ssi_conf_t; +typedef struct { +} ngx_http_ssi_command_t; + + typedef struct { ngx_hunk_t *buf; @@ -38,10 +42,18 @@ typedef struct { int state; size_t saved; - ngx_int_t err; } ngx_http_ssi_ctx_t; +typedef ngx_int_t (*ngx_http_ssi_opcode_pt) (ngx_http_request_t *r, + ngx_http_ssi_ctx_t *ctx); + +typedef struct { + ngx_str_t name; + ngx_http_ssi_opcode_pt op; +} ngx_http_ssi_op_t; + + typedef enum { ssi_start_state = 0, ssi_tag_state, @@ -58,20 +70,34 @@ typedef enum { ssi_double_quoted_value_quote_state, ssi_quoted_value_state, ssi_quoted_value_quote_state, - ssi_error_state, ssi_comment_end0_state, - ssi_comment_end1_state + ssi_comment_end1_state, + ssi_error_state, + ssi_error_end0_state, + ssi_error_end1_state } ngx_http_ssi_state_e; +static ngx_int_t ngx_http_ssi_error(ngx_http_request_t *r, + ngx_http_ssi_ctx_t *ctx); static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx); + +static ngx_int_t ngx_http_ssi_echo(ngx_http_request_t *r, + ngx_http_ssi_ctx_t *ctx); + static void *ngx_http_ssi_create_conf(ngx_conf_t *cf); static char *ngx_http_ssi_merge_conf(ngx_conf_t *cf, void *parent, void *child); static int ngx_http_ssi_filter_init(ngx_cycle_t *cycle); +static ngx_http_ssi_op_t ngx_http_ssi_commands[] = { + { ngx_string("echo"), ngx_http_ssi_echo }, + { ngx_null_string, NULL } +}; + + static ngx_command_t ngx_http_ssi_filter_commands[] = { { ngx_string("ssi"), @@ -111,13 +137,14 @@ ngx_module_t ngx_http_ssi_filter_module = { static int (*ngx_http_next_header_filter) (ngx_http_request_t *r); -static int (*ngx_http_next_body_filter) (ngx_http_request_t *r, ngx_chain_t *in); - +static int (*ngx_http_next_body_filter) (ngx_http_request_t *r, + ngx_chain_t *in); static char ssi_string[] = "