Mercurial > hg > nginx
comparison src/http/modules/ngx_http_ssi_filter.c @ 290:87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 16 Mar 2004 07:10:12 +0000 |
parents | 0ba4821f4460 |
children | da8c5707af39 |
comparison
equal
deleted
inserted
replaced
289:0750faf8d7e3 | 290:87e73f067470 |
---|---|
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 int enable; | 18 ngx_flag_t enable; |
19 ssize_t value_len; | 19 size_t value_len; |
20 } ngx_http_ssi_conf_t; | 20 } ngx_http_ssi_conf_t; |
21 | 21 |
22 | 22 |
23 typedef struct { | 23 typedef struct { |
24 int dummy; | 24 int dummy; |
26 | 26 |
27 | 27 |
28 typedef struct { | 28 typedef struct { |
29 ngx_hunk_t *buf; | 29 ngx_hunk_t *buf; |
30 | 30 |
31 char *start; | 31 u_char *start; |
32 char *last; | 32 u_char *last; |
33 char *pos; | 33 u_char *pos; |
34 | 34 |
35 ngx_str_t command; | 35 ngx_str_t command; |
36 ngx_array_t params; | 36 ngx_array_t params; |
37 ngx_table_elt_t *param; | 37 ngx_table_elt_t *param; |
38 | 38 |
39 ngx_chain_t *in; | 39 ngx_chain_t *in; |
40 ngx_chain_t *out; | 40 ngx_chain_t *out; |
41 ngx_chain_t **last_out; | 41 ngx_chain_t **last_out; |
42 ngx_chain_t *busy; | 42 ngx_chain_t *busy; |
43 | 43 |
44 int state; | 44 ngx_uint_t state; |
45 size_t saved; | 45 size_t saved; |
46 } ngx_http_ssi_ctx_t; | 46 } ngx_http_ssi_ctx_t; |
47 | 47 |
48 | 48 |
49 typedef ngx_int_t (*ngx_http_ssi_opcode_pt) (ngx_http_request_t *r, | 49 typedef ngx_int_t (*ngx_http_ssi_opcode_pt) (ngx_http_request_t *r, |
837 case '"': | 837 case '"': |
838 state = ssi_preparam_state; | 838 state = ssi_preparam_state; |
839 break; | 839 break; |
840 | 840 |
841 default: | 841 default: |
842 if ((ssize_t) ctx->param->value.len >= conf->value_len) { | 842 if (ctx->param->value.len >= conf->value_len) { |
843 ctx->last = last; | 843 ctx->last = last; |
844 ctx->pos = p; | 844 ctx->pos = p; |
845 ctx->state = ssi_error_state; | 845 ctx->state = ssi_error_state; |
846 | 846 |
847 return NGX_HTTP_SSI_LONG_VALUE; | 847 return NGX_HTTP_SSI_LONG_VALUE; |
851 } | 851 } |
852 | 852 |
853 break; | 853 break; |
854 | 854 |
855 case ssi_double_quoted_value_quote_state: | 855 case ssi_double_quoted_value_quote_state: |
856 if ((ssize_t) ctx->param->value.len >= conf->value_len) { | 856 if (ctx->param->value.len >= conf->value_len) { |
857 ctx->last = last; | 857 ctx->last = last; |
858 ctx->pos = p; | 858 ctx->pos = p; |
859 ctx->state = ssi_error_state; | 859 ctx->state = ssi_error_state; |
860 | 860 |
861 return NGX_HTTP_SSI_LONG_VALUE; | 861 return NGX_HTTP_SSI_LONG_VALUE; |
875 case '\'': | 875 case '\'': |
876 state = ssi_preparam_state; | 876 state = ssi_preparam_state; |
877 break; | 877 break; |
878 | 878 |
879 default: | 879 default: |
880 if ((ssize_t) ctx->param->value.len >= conf->value_len) { | 880 if (ctx->param->value.len >= conf->value_len) { |
881 ctx->last = last; | 881 ctx->last = last; |
882 ctx->pos = p; | 882 ctx->pos = p; |
883 ctx->state = ssi_error_state; | 883 ctx->state = ssi_error_state; |
884 | 884 |
885 return NGX_HTTP_SSI_LONG_VALUE; | 885 return NGX_HTTP_SSI_LONG_VALUE; |
889 } | 889 } |
890 | 890 |
891 break; | 891 break; |
892 | 892 |
893 case ssi_quoted_value_quote_state: | 893 case ssi_quoted_value_quote_state: |
894 if ((ssize_t) ctx->param->value.len >= conf->value_len) { | 894 if (ctx->param->value.len >= conf->value_len) { |
895 ctx->last = last; | 895 ctx->last = last; |
896 ctx->pos = p; | 896 ctx->pos = p; |
897 ctx->state = ssi_error_state; | 897 ctx->state = ssi_error_state; |
898 | 898 |
899 return NGX_HTTP_SSI_LONG_VALUE; | 899 return NGX_HTTP_SSI_LONG_VALUE; |
1004 if (!(conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssi_conf_t)))) { | 1004 if (!(conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssi_conf_t)))) { |
1005 return NGX_CONF_ERROR; | 1005 return NGX_CONF_ERROR; |
1006 } | 1006 } |
1007 | 1007 |
1008 conf->enable = NGX_CONF_UNSET; | 1008 conf->enable = NGX_CONF_UNSET; |
1009 conf->value_len = NGX_CONF_UNSET; | 1009 conf->value_len = NGX_CONF_UNSET_SIZE; |
1010 | 1010 |
1011 return conf; | 1011 return conf; |
1012 } | 1012 } |
1013 | 1013 |
1014 | 1014 |