Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4331 - trunk/src/http/modules

Anonymous User
December 09, 2011 08:48AM
Author: vbart
Date: 2011-12-09 13:47:04 +0000 (Fri, 09 Dec 2011)
New Revision: 4331

Modified:
trunk/src/http/modules/ngx_http_uwsgi_module.c
Log:
uWSGI: added "if_not_empty" flag support to the "uwsgi_param" directive.


Modified: trunk/src/http/modules/ngx_http_uwsgi_module.c
===================================================================
--- trunk/src/http/modules/ngx_http_uwsgi_module.c 2011-12-09 13:32:51 UTC (rev 4330)
+++ trunk/src/http/modules/ngx_http_uwsgi_module.c 2011-12-09 13:47:04 UTC (rev 4331)
@@ -305,8 +305,8 @@
&ngx_http_uwsgi_next_upstream_masks },

{ ngx_string("uwsgi_param"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
- ngx_conf_set_keyval_slot,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE23,
+ ngx_http_upstream_param_set_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_uwsgi_loc_conf_t, params_source),
NULL },
@@ -553,7 +553,7 @@
{
u_char ch, *lowcase_key;
size_t key_len, val_len, len, allocated;
- ngx_uint_t i, n, hash, header_params;
+ ngx_uint_t i, n, hash, skip_empty, header_params;
ngx_buf_t *b;
ngx_chain_t *cl, *body;
ngx_list_part_t *part;
@@ -583,11 +583,18 @@
lcode = *(ngx_http_script_len_code_pt *) le.ip;
key_len = lcode(&le);

+ lcode = *(ngx_http_script_len_code_pt *) le.ip;
+ skip_empty = lcode(&le);
+
for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode (&le)) {
lcode = *(ngx_http_script_len_code_pt *) le.ip;
}
le.ip += sizeof(uintptr_t);

+ if (skip_empty && val_len == 0) {
+ continue;
+ }
+
len += 2 + key_len + 2 + val_len;
}
}
@@ -706,11 +713,28 @@
lcode = *(ngx_http_script_len_code_pt *) le.ip;
key_len = (u_char) lcode (&le);

+ lcode = *(ngx_http_script_len_code_pt *) le.ip;
+ skip_empty = lcode(&le);
+
for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) {
lcode = *(ngx_http_script_len_code_pt *) le.ip;
}
le.ip += sizeof(uintptr_t);

+ if (skip_empty && val_len == 0) {
+ e.skip = 1;
+
+ while (*(uintptr_t *) e.ip) {
+ code = *(ngx_http_script_code_pt *) e.ip;
+ code((ngx_http_script_engine_t *) &e);
+ }
+ e.ip += sizeof(uintptr_t);
+
+ e.skip = 0;
+
+ continue;
+ }
+
*e.pos++ = (u_char) (key_len & 0xff);
*e.pos++ = (u_char) ((key_len >> 8) & 0xff);

@@ -1379,9 +1403,9 @@
#if (NGX_HTTP_CACHE)
ngx_array_t params_merged;
#endif
- ngx_keyval_t *src;
ngx_hash_key_t *hk;
ngx_hash_init_t hash;
+ ngx_http_upstream_param_t *src;
ngx_http_script_compile_t sc;
ngx_http_script_copy_code_t *copy;

@@ -1442,9 +1466,11 @@
#if (NGX_HTTP_CACHE)

if (conf->upstream.cache) {
- ngx_keyval_t *h, *s;
+ ngx_keyval_t *h;
+ ngx_http_upstream_param_t *s;

- if (ngx_array_init(&params_merged, cf->temp_pool, 4, sizeof(ngx_keyval_t))
+ if (ngx_array_init(&params_merged, cf->temp_pool, 4,
+ sizeof(ngx_http_upstream_param_t))
!= NGX_OK)
{
return NGX_ERROR;
@@ -1478,7 +1504,9 @@
return NGX_ERROR;
}

- *s = *h;
+ s->key = h->key;
+ s->value = h->value;
+ s->skip_empty = 0;

next:

@@ -1520,7 +1548,16 @@
copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
copy->len = src[i].key.len;

+ copy = ngx_array_push_n(conf->params_len,
+ sizeof(ngx_http_script_copy_code_t));
+ if (copy == NULL) {
+ return NGX_ERROR;
+ }

+ copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
+ copy->len = src[i].skip_empty;
+
+
size = (sizeof(ngx_http_script_copy_code_t)
+ src[i].key.len + sizeof(uintptr_t) - 1)
& ~(sizeof(uintptr_t) - 1);

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4331 - trunk/src/http/modules

Anonymous User 1163 December 09, 2011 08:48AM

Re: [nginx] svn commit: r4331 - trunk/src/http/modules

Maxim Dounin 555 December 09, 2011 08:56AM

Re: [nginx] svn commit: r4331 - trunk/src/http/modules

Maxim Dounin 517 December 09, 2011 08:58AM

Re: [nginx] svn commit: r4331 - trunk/src/http/modules

Valentin V. Bartenev 661 December 09, 2011 09:10AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 81
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready