comparison src/http/ngx_http_script.c @ 4947:4251e72b8bb4

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.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 06 Dec 2012 23:03:53 +0000
parents 972642646f06
children 12dd27b74117
comparison
equal deleted inserted replaced
4946:2570296374b4 4947:4251e72b8bb4
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;