Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 4328:d15a00e6d9e6
Added the ngx_http_upstream_param_set_slot().
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Fri, 09 Dec 2011 13:19:57 +0000 |
parents | 186f02886bed |
children | f31146f282fd |
comparison
equal
deleted
inserted
replaced
4327:73d37e1ccb91 | 4328:d15a00e6d9e6 |
---|---|
4442 return NGX_CONF_ERROR; | 4442 return NGX_CONF_ERROR; |
4443 } | 4443 } |
4444 } | 4444 } |
4445 | 4445 |
4446 | 4446 |
4447 char * | |
4448 ngx_http_upstream_param_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, | |
4449 void *conf) | |
4450 { | |
4451 char *p = conf; | |
4452 | |
4453 ngx_str_t *value; | |
4454 ngx_array_t **a; | |
4455 ngx_http_upstream_param_t *param; | |
4456 | |
4457 a = (ngx_array_t **) (p + cmd->offset); | |
4458 | |
4459 if (*a == NULL) { | |
4460 *a = ngx_array_create(cf->pool, 4, sizeof(ngx_http_upstream_param_t)); | |
4461 if (*a == NULL) { | |
4462 return NGX_CONF_ERROR; | |
4463 } | |
4464 } | |
4465 | |
4466 param = ngx_array_push(*a); | |
4467 if (param == NULL) { | |
4468 return NGX_CONF_ERROR; | |
4469 } | |
4470 | |
4471 value = cf->args->elts; | |
4472 | |
4473 param->key = value[1]; | |
4474 param->value = value[2]; | |
4475 param->skip_empty = 0; | |
4476 | |
4477 if (cf->args->nelts == 4) { | |
4478 if (ngx_strcmp(value[3].data, "if_not_empty") != 0) { | |
4479 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4480 "invalid parameter \"%V\"", &value[3]); | |
4481 return NGX_CONF_ERROR; | |
4482 } | |
4483 | |
4484 param->skip_empty = 1; | |
4485 } | |
4486 | |
4487 return NGX_CONF_OK; | |
4488 } | |
4489 | |
4490 | |
4447 ngx_int_t | 4491 ngx_int_t |
4448 ngx_http_upstream_hide_headers_hash(ngx_conf_t *cf, | 4492 ngx_http_upstream_hide_headers_hash(ngx_conf_t *cf, |
4449 ngx_http_upstream_conf_t *conf, ngx_http_upstream_conf_t *prev, | 4493 ngx_http_upstream_conf_t *conf, ngx_http_upstream_conf_t *prev, |
4450 ngx_str_t *default_hide_headers, ngx_hash_init_t *hash) | 4494 ngx_str_t *default_hide_headers, ngx_hash_init_t *hash) |
4451 { | 4495 { |