Klaus Demo nginx / 0d4b372
use %v for ngx_variable_value_t in ngx_sprintf(), this fixes nginx on FreeBSD/sparc64 Igor Sysoev 13 years ago
5 changed file(s) with 24 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
5858 * %P ngx_pid_t
5959 * %M ngx_msec_t
6060 * %r rlim_t
61 * %p pointer
62 * %V pointer to ngx_str_t
61 * %p void *
62 * %V ngx_str_t *
63 * %v ngx_variable_value_t *
6364 * %s null-terminated string
6465 * %Z '\0'
6566 * %N '\n'
116117 uint64_t ui64;
117118 ngx_msec_t ms;
118119 ngx_uint_t width, sign, hexadecimal, max_width;
119 ngx_variable_value_t *v;
120 ngx_str_t *v;
121 ngx_variable_value_t *vv;
120122 static u_char hex[] = "0123456789abcdef";
121123 static u_char HEX[] = "0123456789ABCDEF";
122124
187189 switch (*fmt) {
188190
189191 case 'V':
190 v = va_arg(args, ngx_variable_value_t *);
192 v = va_arg(args, ngx_str_t *);
191193
192194 len = v->len;
193195 len = (buf + len < last) ? len : (size_t) (last - buf);
194196
195197 buf = ngx_cpymem(buf, v->data, len);
198 fmt++;
199
200 continue;
201
202 case 'v':
203 vv = va_arg(args, ngx_variable_value_t *);
204
205 len = vv->len;
206 len = (buf + len < last) ? len : (size_t) (last - buf);
207
208 buf = ngx_cpymem(buf, vv->data, len);
196209 fmt++;
197210
198211 continue;
8585 *v = *vv;
8686
8787 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
88 "http geo: %V %V", &r->connection->addr_text, v);
88 "http geo: %V %v", &r->connection->addr_text, v);
8989
9090 return NGX_OK;
9191 }
9999 ngx_conf_t save;
100100 ngx_pool_t *pool;
101101 ngx_radix_tree_t *tree;
102 ngx_http_variable_t *var;
102103 ngx_http_geo_conf_ctx_t ctx;
103 ngx_http_variable_t *var;
104104
105105 value = cf->args->elts;
106106
284284 ngx_radix32tree_find(ctx->tree, cidrin.addr & cidrin.mask);
285285
286286 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
287 "duplicate parameter \"%V\", value: \"%V\", "
288 "old value: \"%V\"",
289 &value[0], var, old);
287 "duplicate parameter \"%V\", value: \"%v\", old value: \"%v\"",
288 &value[0], var, old);
290289
291290 rc = ngx_radix32tree_delete(ctx->tree, cidrin.addr, cidrin.mask);
292291
140140 if (len > 255) {
141141 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
142142 "the value of the \"%V\" variable "
143 "is more than 255 bytes: \"%V\"",
143 "is more than 255 bytes: \"%v\"",
144144 &ctx->var, vv);
145145 return NGX_DECLINED;
146146 }
150150 }
151151
152152 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
153 "http map: \"%V\" \"%V\"", vv, v);
153 "http map: \"%v\" \"%v\"", vv, v);
154154
155155 return NGX_OK;
156156 }
11901190
11911191 if (value && !value->not_found) {
11921192 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
1193 "http script var: \"%V\"", value);
1193 "http script var: \"%v\"", value);
11941194
11951195 *e->sp = *value;
11961196 e->sp++;