diff --git a/src/http/modules/ngx_http_ssi_filter.c b/src/http/modules/ngx_http_ssi_filter.c index 13c11f0ce..0972523d6 100644 --- a/src/http/modules/ngx_http_ssi_filter.c +++ b/src/http/modules/ngx_http_ssi_filter.c @@ -16,6 +16,7 @@ typedef struct { int enable; + ssize_t value_len; } ngx_http_ssi_conf_t; @@ -26,23 +27,43 @@ typedef struct { char *last; char *pos; - ngx_table_elt_t *param; ngx_str_t command; ngx_array_t params; - int state; + ngx_table_elt_t *param; ngx_chain_t *in; - ngx_chain_t *current; ngx_chain_t *out; ngx_chain_t **last_out; ngx_chain_t *busy; - size_t prev; - - u_int value_len; + int state; + size_t saved; + ngx_int_t err; } ngx_http_ssi_ctx_t; +typedef enum { + ssi_start_state = 0, + ssi_tag_state, + ssi_comment0_state, + ssi_comment1_state, + ssi_sharp_state, + ssi_precommand_state, + ssi_command_state, + ssi_preparam_state, + ssi_param_state, + ssi_preequal_state, + ssi_prevalue_state, + ssi_double_quoted_value_state, + 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 +} ngx_http_ssi_state_e; + + static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx); static void *ngx_http_ssi_create_conf(ngx_conf_t *cf); @@ -94,7 +115,7 @@ static int (*ngx_http_next_body_filter) (ngx_http_request_t *r, ngx_chain_t *in) -static char comment_string[] = "