comparison src/http/ngx_http_script.c @ 5040:05beaa2d87b3 stable-1.2

Merge of r4948, r4949, r4964, r4973, r5011: variables. *) Allow the complex value to be defined as an empty string. This makes conversion from strings to complex values possible without the loss of functionality. *) The "auth_basic" directive gained support of variables. *) Fixed variable syntax checking in "set", "geo", "limit_conn_zone", and "perl_set" directives. *) Added checks that disallow adding a variable with an empty name. Added variable name syntax checks to "geo" and "map" directives. *) Variables $pipe, $request_length, $time_iso8601, and $time_local. Log module counterparts are preserved for efficiency. Based on patch by Kiril Kalchev.
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 10 Feb 2013 03:08:42 +0000
parents 356c91151658
children 12dd27b74117
comparison
equal deleted inserted replaced
5039:b5601d23b61e 5040:05beaa2d87b3
112 ngx_array_t flushes, lengths, values, *pf, *pl, *pv; 112 ngx_array_t flushes, lengths, values, *pf, *pl, *pv;
113 ngx_http_script_compile_t sc; 113 ngx_http_script_compile_t sc;
114 114
115 v = ccv->value; 115 v = ccv->value;
116 116
117 if (v->len == 0) {
118 ngx_conf_log_error(NGX_LOG_EMERG, ccv->cf, 0, "empty parameter");
119 return NGX_ERROR;
120 }
121
122 nv = 0; 117 nv = 0;
123 nc = 0; 118 nc = 0;
124 119
125 for (i = 0; i < v->len; i++) { 120 for (i = 0; i < v->len; i++) {
126 if (v->data[i] == '$') { 121 if (v->data[i] == '$') {
131 nv++; 126 nv++;
132 } 127 }
133 } 128 }
134 } 129 }
135 130
136 if (v->data[0] != '$' && (ccv->conf_prefix || ccv->root_prefix)) { 131 if ((v->len == 0 || v->data[0] != '$')
137 132 && (ccv->conf_prefix || ccv->root_prefix))
133 {
138 if (ngx_conf_full_name(ccv->cf->cycle, v, ccv->conf_prefix) != NGX_OK) { 134 if (ngx_conf_full_name(ccv->cf->cycle, v, ccv->conf_prefix) != NGX_OK) {
139 return NGX_ERROR; 135 return NGX_ERROR;
140 } 136 }
141 137
142 ccv->conf_prefix = 0; 138 ccv->conf_prefix = 0;