mirror of
https://github.com/nginx/nginx.git
synced 2025-06-12 13:42:55 +08:00
use %v for ngx_variable_value_t in ngx_sprintf(),
this fixes nginx on FreeBSD/sparc64
This commit is contained in:
parent
d4ff561681
commit
0d4b372e44
@ -59,8 +59,9 @@ ngx_pstrdup(ngx_pool_t *pool, ngx_str_t *src)
|
|||||||
* %P ngx_pid_t
|
* %P ngx_pid_t
|
||||||
* %M ngx_msec_t
|
* %M ngx_msec_t
|
||||||
* %r rlim_t
|
* %r rlim_t
|
||||||
* %p pointer
|
* %p void *
|
||||||
* %V pointer to ngx_str_t
|
* %V ngx_str_t *
|
||||||
|
* %v ngx_variable_value_t *
|
||||||
* %s null-terminated string
|
* %s null-terminated string
|
||||||
* %Z '\0'
|
* %Z '\0'
|
||||||
* %N '\n'
|
* %N '\n'
|
||||||
@ -117,7 +118,8 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
|
|||||||
uint64_t ui64;
|
uint64_t ui64;
|
||||||
ngx_msec_t ms;
|
ngx_msec_t ms;
|
||||||
ngx_uint_t width, sign, hexadecimal, max_width;
|
ngx_uint_t width, sign, hexadecimal, max_width;
|
||||||
ngx_variable_value_t *v;
|
ngx_str_t *v;
|
||||||
|
ngx_variable_value_t *vv;
|
||||||
static u_char hex[] = "0123456789abcdef";
|
static u_char hex[] = "0123456789abcdef";
|
||||||
static u_char HEX[] = "0123456789ABCDEF";
|
static u_char HEX[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
@ -188,7 +190,7 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
|
|||||||
switch (*fmt) {
|
switch (*fmt) {
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
v = va_arg(args, ngx_variable_value_t *);
|
v = va_arg(args, ngx_str_t *);
|
||||||
|
|
||||||
len = v->len;
|
len = v->len;
|
||||||
len = (buf + len < last) ? len : (size_t) (last - buf);
|
len = (buf + len < last) ? len : (size_t) (last - buf);
|
||||||
@ -198,6 +200,17 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case 'v':
|
||||||
|
vv = va_arg(args, ngx_variable_value_t *);
|
||||||
|
|
||||||
|
len = vv->len;
|
||||||
|
len = (buf + len < last) ? len : (size_t) (last - buf);
|
||||||
|
|
||||||
|
buf = ngx_cpymem(buf, vv->data, len);
|
||||||
|
fmt++;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
p = va_arg(args, u_char *);
|
p = va_arg(args, u_char *);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ ngx_http_geo_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
|||||||
*v = *vv;
|
*v = *vv;
|
||||||
|
|
||||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||||
"http geo: %V %V", &r->connection->addr_text, v);
|
"http geo: %V %v", &r->connection->addr_text, v);
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
@ -100,8 +100,8 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
ngx_conf_t save;
|
ngx_conf_t save;
|
||||||
ngx_pool_t *pool;
|
ngx_pool_t *pool;
|
||||||
ngx_radix_tree_t *tree;
|
ngx_radix_tree_t *tree;
|
||||||
|
ngx_http_variable_t *var;
|
||||||
ngx_http_geo_conf_ctx_t ctx;
|
ngx_http_geo_conf_ctx_t ctx;
|
||||||
ngx_http_variable_t *var;
|
|
||||||
|
|
||||||
value = cf->args->elts;
|
value = cf->args->elts;
|
||||||
|
|
||||||
@ -285,9 +285,8 @@ ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
|
|||||||
ngx_radix32tree_find(ctx->tree, cidrin.addr & cidrin.mask);
|
ngx_radix32tree_find(ctx->tree, cidrin.addr & cidrin.mask);
|
||||||
|
|
||||||
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
||||||
"duplicate parameter \"%V\", value: \"%V\", "
|
"duplicate parameter \"%V\", value: \"%v\", old value: \"%v\"",
|
||||||
"old value: \"%V\"",
|
&value[0], var, old);
|
||||||
&value[0], var, old);
|
|
||||||
|
|
||||||
rc = ngx_radix32tree_delete(ctx->tree, cidrin.addr, cidrin.mask);
|
rc = ngx_radix32tree_delete(ctx->tree, cidrin.addr, cidrin.mask);
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ ngx_http_limit_zone_handler(ngx_http_request_t *r)
|
|||||||
if (len > 255) {
|
if (len > 255) {
|
||||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||||
"the value of the \"%V\" variable "
|
"the value of the \"%V\" variable "
|
||||||
"is more than 255 bytes: \"%V\"",
|
"is more than 255 bytes: \"%v\"",
|
||||||
&ctx->var, vv);
|
&ctx->var, vv);
|
||||||
return NGX_DECLINED;
|
return NGX_DECLINED;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||||
"http map: \"%V\" \"%V\"", vv, v);
|
"http map: \"%v\" \"%v\"", vv, v);
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
@ -1191,7 +1191,7 @@ ngx_http_script_var_code(ngx_http_script_engine_t *e)
|
|||||||
|
|
||||||
if (value && !value->not_found) {
|
if (value && !value->not_found) {
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
|
||||||
"http script var: \"%V\"", value);
|
"http script var: \"%v\"", value);
|
||||||
|
|
||||||
*e->sp = *value;
|
*e->sp = *value;
|
||||||
e->sp++;
|
e->sp++;
|
||||||
|
Loading…
Reference in New Issue
Block a user