Mercurial > hg > nginx-vendor-0-7
comparison src/http/modules/ngx_http_rewrite_module.c @ 186:54aabf2b0bc6 NGINX_0_3_40
nginx 0.3.40
*) Feature: the ngx_http_dav_module supports the MKCOL method.
*) Feature: the "create_full_put_path" directive.
*) Feature: the "$limit_rate" variable.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 19 Apr 2006 00:00:00 +0400 |
parents | 71ff1e2b484a |
children | 3689cd4e3228 |
comparison
equal
deleted
inserted
replaced
185:a9c5dc369ffe | 186:54aabf2b0bc6 |
---|---|
72 ngx_http_rewrite_if, | 72 ngx_http_rewrite_if, |
73 NGX_HTTP_LOC_CONF_OFFSET, | 73 NGX_HTTP_LOC_CONF_OFFSET, |
74 0, | 74 0, |
75 NULL }, | 75 NULL }, |
76 | 76 |
77 #if 0 | |
78 { ngx_string("valid_referers"), | |
79 NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
80 ngx_http_rewrite_valid_referers, | |
81 NGX_HTTP_LOC_CONF_OFFSET, | |
82 0, | |
83 NULL }, | |
84 #endif | |
85 | |
86 { ngx_string("set"), | 77 { ngx_string("set"), |
87 NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF | 78 NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |
88 |NGX_CONF_TAKE2, | 79 |NGX_CONF_TAKE2, |
89 ngx_http_rewrite_set, | 80 ngx_http_rewrite_set, |
90 NGX_HTTP_LOC_CONF_OFFSET, | 81 NGX_HTTP_LOC_CONF_OFFSET, |
877 static char * | 868 static char * |
878 ngx_http_rewrite_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 869 ngx_http_rewrite_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
879 { | 870 { |
880 ngx_http_rewrite_loc_conf_t *lcf = conf; | 871 ngx_http_rewrite_loc_conf_t *lcf = conf; |
881 | 872 |
882 ngx_int_t index; | 873 ngx_int_t index; |
883 ngx_str_t *value; | 874 ngx_str_t *value; |
884 ngx_http_variable_t *v; | 875 ngx_http_variable_t *v; |
885 ngx_http_script_var_code_t *var; | 876 ngx_http_script_var_code_t *vcode; |
877 ngx_http_script_var_handler_code_t *vhcode; | |
886 | 878 |
887 value = cf->args->elts; | 879 value = cf->args->elts; |
888 | 880 |
889 if (value[1].data[0] != '$') { | 881 if (value[1].data[0] != '$') { |
890 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 882 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
903 index = ngx_http_get_variable_index(cf, &value[1]); | 895 index = ngx_http_get_variable_index(cf, &value[1]); |
904 if (index == NGX_ERROR) { | 896 if (index == NGX_ERROR) { |
905 return NGX_CONF_ERROR; | 897 return NGX_CONF_ERROR; |
906 } | 898 } |
907 | 899 |
908 if (v->handler == NULL) { | 900 if (v->get_handler == NULL) { |
909 v->handler = ngx_http_rewrite_var; | 901 v->get_handler = ngx_http_rewrite_var; |
910 v->data = index; | 902 v->data = index; |
911 } | 903 } |
912 | 904 |
913 if (ngx_http_rewrite_value(cf, lcf, &value[2]) != NGX_CONF_OK) { | 905 if (ngx_http_rewrite_value(cf, lcf, &value[2]) != NGX_CONF_OK) { |
914 return NGX_CONF_ERROR; | 906 return NGX_CONF_ERROR; |
915 } | 907 } |
916 | 908 |
917 var = ngx_http_script_start_code(cf->pool, &lcf->codes, | 909 if (v->set_handler) { |
918 sizeof(ngx_http_script_var_code_t)); | 910 vhcode = ngx_http_script_start_code(cf->pool, &lcf->codes, |
919 if (var == NULL) { | 911 sizeof(ngx_http_script_var_handler_code_t)); |
920 return NGX_CONF_ERROR; | 912 if (vhcode == NULL) { |
921 } | 913 return NGX_CONF_ERROR; |
922 | 914 } |
923 var->code = ngx_http_script_set_var_code; | 915 |
924 var->index = (uintptr_t) index; | 916 vhcode->code = ngx_http_script_var_set_handler_code; |
917 vhcode->handler = v->set_handler; | |
918 vhcode->data = v->data; | |
919 | |
920 return NGX_CONF_OK; | |
921 } | |
922 | |
923 vcode = ngx_http_script_start_code(cf->pool, &lcf->codes, | |
924 sizeof(ngx_http_script_var_code_t)); | |
925 if (vcode == NULL) { | |
926 return NGX_CONF_ERROR; | |
927 } | |
928 | |
929 vcode->code = ngx_http_script_set_var_code; | |
930 vcode->index = (uintptr_t) index; | |
925 | 931 |
926 return NGX_CONF_OK; | 932 return NGX_CONF_OK; |
927 } | 933 } |
928 | 934 |
929 | 935 |