Mercurial > hg > nginx-quic
annotate src/http/modules/ngx_http_uwsgi_module.c @ 4789:179a4d4073b3 stable-1.2
Merge of r4740: fixed $request_length for pipelined requests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 06 Aug 2012 15:45:44 +0000 |
parents | 979e0f5b196d |
children | 4251e72b8bb4 |
rev | line source |
---|---|
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2 /* |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
3 * Copyright (C) Unbit S.a.s. 2009-2010 |
3544 | 4 * Copyright (C) 2008 Manlio Perillo (manlio.perillo@gmail.com) |
5 * Copyright (C) Igor Sysoev | |
4412 | 6 * Copyright (C) Nginx, Inc. |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 */ |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 #include <ngx_config.h> |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 #include <ngx_core.h> |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 #include <ngx_http.h> |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
13 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
14 |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 typedef struct { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
16 ngx_http_upstream_conf_t upstream; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
17 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
18 ngx_array_t *flushes; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
19 ngx_array_t *params_len; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
20 ngx_array_t *params; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
21 ngx_array_t *params_source; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
22 |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
23 ngx_hash_t headers_hash; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
24 ngx_uint_t header_params; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
25 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
26 ngx_array_t *uwsgi_lengths; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
27 ngx_array_t *uwsgi_values; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 |
3568 | 29 #if (NGX_HTTP_CACHE) |
30 ngx_http_complex_value_t cache_key; | |
31 #endif | |
32 | |
3550 | 33 ngx_str_t uwsgi_string; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 |
3552
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
35 ngx_uint_t modifier1; |
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
36 ngx_uint_t modifier2; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
37 } ngx_http_uwsgi_loc_conf_t; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
38 |
3556 | 39 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
40 static ngx_int_t ngx_http_uwsgi_eval(ngx_http_request_t *r, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
41 ngx_http_uwsgi_loc_conf_t *uwcf); |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
42 static ngx_int_t ngx_http_uwsgi_create_request(ngx_http_request_t *r); |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
43 static ngx_int_t ngx_http_uwsgi_reinit_request(ngx_http_request_t *r); |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
44 static ngx_int_t ngx_http_uwsgi_process_status_line(ngx_http_request_t *r); |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
45 static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r); |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
46 static void ngx_http_uwsgi_abort_request(ngx_http_request_t *r); |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
47 static void ngx_http_uwsgi_finalize_request(ngx_http_request_t *r, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
48 ngx_int_t rc); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
49 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
50 static void *ngx_http_uwsgi_create_loc_conf(ngx_conf_t *cf); |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
51 static char *ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
52 void *child); |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
53 static ngx_int_t ngx_http_uwsgi_merge_params(ngx_conf_t *cf, |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
54 ngx_http_uwsgi_loc_conf_t *conf, ngx_http_uwsgi_loc_conf_t *prev); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
55 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
56 static char *ngx_http_uwsgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
57 void *conf); |
3565 | 58 static char *ngx_http_uwsgi_store(ngx_conf_t *cf, ngx_command_t *cmd, |
59 void *conf); | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
60 |
3568 | 61 #if (NGX_HTTP_CACHE) |
62 static ngx_int_t ngx_http_uwsgi_create_key(ngx_http_request_t *r); | |
63 static char *ngx_http_uwsgi_cache(ngx_conf_t *cf, ngx_command_t *cmd, | |
64 void *conf); | |
65 static char *ngx_http_uwsgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, | |
66 void *conf); | |
67 #endif | |
68 | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
69 |
3552
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
70 static ngx_conf_num_bounds_t ngx_http_uwsgi_modifier_bounds = { |
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
71 ngx_conf_check_num_bounds, 0, 255 |
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
72 }; |
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
73 |
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
74 |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
75 static ngx_conf_bitmask_t ngx_http_uwsgi_next_upstream_masks[] = { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
76 { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR }, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
77 { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT }, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
78 { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER }, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
79 { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 }, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
80 { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 }, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
81 { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 }, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
82 { ngx_string("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING }, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
83 { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF }, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
84 { ngx_null_string, 0 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
85 }; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
86 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
87 |
3568 | 88 ngx_module_t ngx_http_uwsgi_module; |
89 | |
90 | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
91 static ngx_command_t ngx_http_uwsgi_commands[] = { |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
92 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
93 { ngx_string("uwsgi_pass"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
94 NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
95 ngx_http_uwsgi_pass, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
96 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
97 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
98 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
99 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
100 { ngx_string("uwsgi_modifier1"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
101 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3552
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
102 ngx_conf_set_num_slot, |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
103 NGX_HTTP_LOC_CONF_OFFSET, |
3552
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
104 offsetof(ngx_http_uwsgi_loc_conf_t, modifier1), |
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
105 &ngx_http_uwsgi_modifier_bounds }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
106 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
107 { ngx_string("uwsgi_modifier2"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
108 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3552
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
109 ngx_conf_set_num_slot, |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
110 NGX_HTTP_LOC_CONF_OFFSET, |
3552
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
111 offsetof(ngx_http_uwsgi_loc_conf_t, modifier2), |
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
112 &ngx_http_uwsgi_modifier_bounds }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
113 |
3565 | 114 { ngx_string("uwsgi_store"), |
115 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
116 ngx_http_uwsgi_store, | |
117 NGX_HTTP_LOC_CONF_OFFSET, | |
118 0, | |
119 NULL }, | |
120 | |
121 { ngx_string("uwsgi_store_access"), | |
122 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123, | |
123 ngx_conf_set_access_slot, | |
124 NGX_HTTP_LOC_CONF_OFFSET, | |
125 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.store_access), | |
126 NULL }, | |
127 | |
4157
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
128 { ngx_string("uwsgi_buffering"), |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
129 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
130 ngx_conf_set_flag_slot, |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
131 NGX_HTTP_LOC_CONF_OFFSET, |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
132 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.buffering), |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
133 NULL }, |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
134 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
135 { ngx_string("uwsgi_ignore_client_abort"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
136 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
137 ngx_conf_set_flag_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
138 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
139 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.ignore_client_abort), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
140 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
141 |
3567 | 142 { ngx_string("uwsgi_bind"), |
143 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
144 ngx_http_upstream_bind_set_slot, | |
145 NGX_HTTP_LOC_CONF_OFFSET, | |
146 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.local), | |
147 NULL }, | |
148 | |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
149 { ngx_string("uwsgi_connect_timeout"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
150 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
151 ngx_conf_set_msec_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
152 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
153 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.connect_timeout), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
154 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
155 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
156 { ngx_string("uwsgi_send_timeout"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
157 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
158 ngx_conf_set_msec_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
159 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
160 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.send_timeout), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
161 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
162 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
163 { ngx_string("uwsgi_buffer_size"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
164 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
165 ngx_conf_set_size_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
166 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
167 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.buffer_size), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
168 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
169 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
170 { ngx_string("uwsgi_pass_request_headers"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
171 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
172 ngx_conf_set_flag_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
173 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
174 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.pass_request_headers), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
175 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
176 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
177 { ngx_string("uwsgi_pass_request_body"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
178 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
179 ngx_conf_set_flag_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
180 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
181 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.pass_request_body), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
182 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
183 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
184 { ngx_string("uwsgi_intercept_errors"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
185 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
186 ngx_conf_set_flag_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
187 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
188 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.intercept_errors), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
189 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
190 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
191 { ngx_string("uwsgi_read_timeout"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
192 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
193 ngx_conf_set_msec_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
194 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
195 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.read_timeout), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
196 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
197 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
198 { ngx_string("uwsgi_buffers"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
199 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
200 ngx_conf_set_bufs_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
201 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
202 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.bufs), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
203 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
204 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
205 { ngx_string("uwsgi_busy_buffers_size"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
206 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
207 ngx_conf_set_size_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
208 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
209 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.busy_buffers_size_conf), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
210 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
211 |
3568 | 212 #if (NGX_HTTP_CACHE) |
213 | |
214 { ngx_string("uwsgi_cache"), | |
3729 | 215 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3568 | 216 ngx_http_uwsgi_cache, |
217 NGX_HTTP_LOC_CONF_OFFSET, | |
218 0, | |
219 NULL }, | |
220 | |
221 { ngx_string("uwsgi_cache_key"), | |
3729 | 222 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3568 | 223 ngx_http_uwsgi_cache_key, |
224 NGX_HTTP_LOC_CONF_OFFSET, | |
225 0, | |
226 NULL }, | |
227 | |
228 { ngx_string("uwsgi_cache_path"), | |
229 NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE, | |
230 ngx_http_file_cache_set_slot, | |
231 0, | |
232 0, | |
233 &ngx_http_uwsgi_module }, | |
234 | |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
235 { ngx_string("uwsgi_cache_bypass"), |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
236 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
237 ngx_http_set_predicate_slot, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
238 NGX_HTTP_LOC_CONF_OFFSET, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
239 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_bypass), |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
240 NULL }, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
241 |
3568 | 242 { ngx_string("uwsgi_no_cache"), |
243 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
3692
045ea40cbfe8
use ngx_http_test_predicates(), ngx_http_set_predicate_slot()
Igor Sysoev <igor@sysoev.ru>
parents:
3670
diff
changeset
|
244 ngx_http_set_predicate_slot, |
3568 | 245 NGX_HTTP_LOC_CONF_OFFSET, |
246 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.no_cache), | |
247 NULL }, | |
248 | |
249 { ngx_string("uwsgi_cache_valid"), | |
250 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
251 ngx_http_file_cache_valid_set_slot, | |
252 NGX_HTTP_LOC_CONF_OFFSET, | |
253 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_valid), | |
254 NULL }, | |
255 | |
256 { ngx_string("uwsgi_cache_min_uses"), | |
257 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
258 ngx_conf_set_num_slot, | |
259 NGX_HTTP_LOC_CONF_OFFSET, | |
260 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_min_uses), | |
261 NULL }, | |
262 | |
263 { ngx_string("uwsgi_cache_use_stale"), | |
264 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
265 ngx_conf_set_bitmask_slot, | |
266 NGX_HTTP_LOC_CONF_OFFSET, | |
267 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_use_stale), | |
268 &ngx_http_uwsgi_next_upstream_masks }, | |
269 | |
270 { ngx_string("uwsgi_cache_methods"), | |
271 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
272 ngx_conf_set_bitmask_slot, | |
273 NGX_HTTP_LOC_CONF_OFFSET, | |
274 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_methods), | |
275 &ngx_http_upstream_cache_method_mask }, | |
276 | |
4386
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
277 { ngx_string("uwsgi_cache_lock"), |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
278 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
279 ngx_conf_set_flag_slot, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
280 NGX_HTTP_LOC_CONF_OFFSET, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
281 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_lock), |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
282 NULL }, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
283 |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
284 { ngx_string("uwsgi_cache_lock_timeout"), |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
285 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
286 ngx_conf_set_msec_slot, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
287 NGX_HTTP_LOC_CONF_OFFSET, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
288 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_lock_timeout), |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
289 NULL }, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
290 |
3568 | 291 #endif |
292 | |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
293 { ngx_string("uwsgi_temp_path"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
294 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
295 ngx_conf_set_path_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
296 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
297 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.temp_path), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
298 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
299 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
300 { ngx_string("uwsgi_max_temp_file_size"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
301 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
302 ngx_conf_set_size_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
303 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
304 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.max_temp_file_size_conf), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
305 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
306 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
307 { ngx_string("uwsgi_temp_file_write_size"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
308 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
309 ngx_conf_set_size_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
310 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
311 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.temp_file_write_size_conf), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
312 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
313 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
314 { ngx_string("uwsgi_next_upstream"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
315 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
316 ngx_conf_set_bitmask_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
317 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
318 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.next_upstream), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
319 &ngx_http_uwsgi_next_upstream_masks }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
320 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
321 { ngx_string("uwsgi_param"), |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
322 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE23, |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
323 ngx_http_upstream_param_set_slot, |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
324 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
325 offsetof(ngx_http_uwsgi_loc_conf_t, params_source), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
326 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
327 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
328 { ngx_string("uwsgi_string"), |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
329 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
330 ngx_conf_set_str_slot, |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
331 NGX_HTTP_LOC_CONF_OFFSET, |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
332 offsetof(ngx_http_uwsgi_loc_conf_t, uwsgi_string), |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
333 NULL }, |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
334 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
335 { ngx_string("uwsgi_pass_header"), |
3729 | 336 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
337 ngx_conf_set_str_array_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
338 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
339 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.pass_headers), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
340 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
341 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
342 { ngx_string("uwsgi_hide_header"), |
3729 | 343 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
344 ngx_conf_set_str_array_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
345 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
346 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.hide_headers), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
347 NULL }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
348 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
349 { ngx_string("uwsgi_ignore_headers"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
350 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
351 ngx_conf_set_bitmask_slot, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
352 NGX_HTTP_LOC_CONF_OFFSET, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
353 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.ignore_headers), |
3667
12bd9e26fadb
use shared ngx_http_upstream_ignore_headers_masks[]
Igor Sysoev <igor@sysoev.ru>
parents:
3630
diff
changeset
|
354 &ngx_http_upstream_ignore_headers_masks }, |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
355 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
356 ngx_null_command |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
357 }; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
358 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
359 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
360 static ngx_http_module_t ngx_http_uwsgi_module_ctx = { |
3553
b4a60663f6c0
delete unused ngx_http_uwsgi_add_variables()
Igor Sysoev <igor@sysoev.ru>
parents:
3552
diff
changeset
|
361 NULL, /* preconfiguration */ |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
362 NULL, /* postconfiguration */ |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
363 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
364 NULL, /* create main configuration */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
365 NULL, /* init main configuration */ |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
366 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
367 NULL, /* create server configuration */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
368 NULL, /* merge server configuration */ |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
369 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
370 ngx_http_uwsgi_create_loc_conf, /* create location configuration */ |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
371 ngx_http_uwsgi_merge_loc_conf /* merge location configuration */ |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
372 }; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
373 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
374 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
375 ngx_module_t ngx_http_uwsgi_module = { |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
376 NGX_MODULE_V1, |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
377 &ngx_http_uwsgi_module_ctx, /* module context */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
378 ngx_http_uwsgi_commands, /* module directives */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
379 NGX_HTTP_MODULE, /* module type */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
380 NULL, /* init master */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
381 NULL, /* init module */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
382 NULL, /* init process */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
383 NULL, /* init thread */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
384 NULL, /* exit thread */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
385 NULL, /* exit process */ |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
386 NULL, /* exit master */ |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
387 NGX_MODULE_V1_PADDING |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
388 }; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
389 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
390 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
391 static ngx_str_t ngx_http_uwsgi_hide_headers[] = { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
392 ngx_string("X-Accel-Expires"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
393 ngx_string("X-Accel-Redirect"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
394 ngx_string("X-Accel-Limit-Rate"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
395 ngx_string("X-Accel-Buffering"), |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
396 ngx_string("X-Accel-Charset"), |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
397 ngx_null_string |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
398 }; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
399 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
400 |
3568 | 401 #if (NGX_HTTP_CACHE) |
402 | |
403 static ngx_keyval_t ngx_http_uwsgi_cache_headers[] = { | |
404 { ngx_string("HTTP_IF_MODIFIED_SINCE"), ngx_string("") }, | |
405 { ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") }, | |
406 { ngx_string("HTTP_IF_NONE_MATCH"), ngx_string("") }, | |
407 { ngx_string("HTTP_IF_MATCH"), ngx_string("") }, | |
408 { ngx_string("HTTP_RANGE"), ngx_string("") }, | |
409 { ngx_string("HTTP_IF_RANGE"), ngx_string("") }, | |
410 { ngx_null_string, ngx_null_string } | |
411 }; | |
412 | |
413 #endif | |
414 | |
415 | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
416 static ngx_path_init_t ngx_http_uwsgi_temp_path = { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
417 ngx_string(NGX_HTTP_UWSGI_TEMP_PATH), { 1, 2, 0 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
418 }; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
419 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
420 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
421 static ngx_int_t |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
422 ngx_http_uwsgi_handler(ngx_http_request_t *r) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
423 { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
424 ngx_int_t rc; |
3629 | 425 ngx_http_status_t *status; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
426 ngx_http_upstream_t *u; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
427 ngx_http_uwsgi_loc_conf_t *uwcf; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
428 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
429 if (r->subrequest_in_memory) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
430 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
431 "ngx_http_uwsgi_module does not support " |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
432 "subrequests in memory"); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
433 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
434 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
435 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
436 if (ngx_http_upstream_create(r) != NGX_OK) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
437 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
438 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
439 |
3629 | 440 status = ngx_pcalloc(r->pool, sizeof(ngx_http_status_t)); |
441 if (status == NULL) { | |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
442 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
443 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
444 |
3629 | 445 ngx_http_set_ctx(r, status, ngx_http_uwsgi_module); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
446 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
447 uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
448 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
449 if (uwcf->uwsgi_lengths) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
450 if (ngx_http_uwsgi_eval(r, uwcf) != NGX_OK) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
451 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
452 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
453 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
454 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
455 u = r->upstream; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
456 |
3545
11c4f3a1e439
use ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3544
diff
changeset
|
457 ngx_str_set(&u->schema, "uwsgi://"); |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
458 u->output.tag = (ngx_buf_tag_t) &ngx_http_uwsgi_module; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
459 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
460 u->conf = &uwcf->upstream; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
461 |
3568 | 462 #if (NGX_HTTP_CACHE) |
463 u->create_key = ngx_http_uwsgi_create_key; | |
464 #endif | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
465 u->create_request = ngx_http_uwsgi_create_request; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
466 u->reinit_request = ngx_http_uwsgi_reinit_request; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
467 u->process_header = ngx_http_uwsgi_process_status_line; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
468 u->abort_request = ngx_http_uwsgi_abort_request; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
469 u->finalize_request = ngx_http_uwsgi_finalize_request; |
4662
979e0f5b196d
Merge of r4616: r->state fix.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
470 r->state = 0; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
471 |
4157
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
472 u->buffering = uwcf->upstream.buffering; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
473 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
474 u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
475 if (u->pipe == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
476 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
477 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
478 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
479 u->pipe->input_filter = ngx_event_pipe_copy_input_filter; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
480 u->pipe->input_ctx = r; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
481 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
482 rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
483 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
484 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
485 return rc; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
486 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
487 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
488 return NGX_DONE; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
489 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
490 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
491 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
492 static ngx_int_t |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
493 ngx_http_uwsgi_eval(ngx_http_request_t *r, ngx_http_uwsgi_loc_conf_t * uwcf) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
494 { |
3610 | 495 ngx_url_t url; |
496 ngx_http_upstream_t *u; | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
497 |
3610 | 498 ngx_memzero(&url, sizeof(ngx_url_t)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
499 |
3610 | 500 if (ngx_http_script_run(r, &url.url, uwcf->uwsgi_lengths->elts, 0, |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
501 uwcf->uwsgi_values->elts) |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
502 == NULL) |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
503 { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
504 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
505 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
506 |
3610 | 507 url.no_resolve = 1; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
508 |
3610 | 509 if (ngx_parse_url(r->pool, &url) != NGX_OK) { |
510 if (url.err) { | |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
511 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
3610 | 512 "%s in upstream \"%V\"", url.err, &url.url); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
513 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
514 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
515 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
516 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
517 |
3610 | 518 u = r->upstream; |
519 | |
520 u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t)); | |
521 if (u->resolved == NULL) { | |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
522 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
523 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
524 |
3610 | 525 if (url.addrs && url.addrs[0].sockaddr) { |
526 u->resolved->sockaddr = url.addrs[0].sockaddr; | |
527 u->resolved->socklen = url.addrs[0].socklen; | |
528 u->resolved->naddrs = 1; | |
529 u->resolved->host = url.addrs[0].name; | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
530 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
531 } else { |
3610 | 532 u->resolved->host = url.host; |
533 u->resolved->port = url.port; | |
3879
502a6b0acf3f
fix case when a host in fastcgi_pass, scgi_pass, and uwsgi_pass
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
534 u->resolved->no_port = url.no_port; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
535 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
536 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
537 return NGX_OK; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
538 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
539 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
540 |
3568 | 541 #if (NGX_HTTP_CACHE) |
542 | |
543 static ngx_int_t | |
544 ngx_http_uwsgi_create_key(ngx_http_request_t *r) | |
545 { | |
546 ngx_str_t *key; | |
547 ngx_http_uwsgi_loc_conf_t *uwcf; | |
548 | |
549 key = ngx_array_push(&r->cache->keys); | |
550 if (key == NULL) { | |
551 return NGX_ERROR; | |
552 } | |
553 | |
554 uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module); | |
555 | |
556 if (ngx_http_complex_value(r, &uwcf->cache_key, key) != NGX_OK) { | |
557 return NGX_ERROR; | |
558 } | |
559 | |
560 return NGX_OK; | |
561 } | |
562 | |
563 #endif | |
564 | |
565 | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
566 static ngx_int_t |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
567 ngx_http_uwsgi_create_request(ngx_http_request_t *r) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
568 { |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
569 u_char ch, *lowcase_key; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
570 size_t key_len, val_len, len, allocated; |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
571 ngx_uint_t i, n, hash, skip_empty, header_params; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
572 ngx_buf_t *b; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
573 ngx_chain_t *cl, *body; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
574 ngx_list_part_t *part; |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
575 ngx_table_elt_t *header, **ignored; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
576 ngx_http_script_code_pt code; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
577 ngx_http_script_engine_t e, le; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
578 ngx_http_uwsgi_loc_conf_t *uwcf; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
579 ngx_http_script_len_code_pt lcode; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
580 |
3546
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
581 len = 0; |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
582 header_params = 0; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
583 ignored = NULL; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
584 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
585 uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
586 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
587 if (uwcf->params_len) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
588 ngx_memzero(&le, sizeof(ngx_http_script_engine_t)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
589 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
590 ngx_http_script_flush_no_cacheable_variables(r, uwcf->flushes); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
591 le.flushed = 1; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
592 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
593 le.ip = uwcf->params_len->elts; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
594 le.request = r; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
595 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
596 while (*(uintptr_t *) le.ip) { |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
597 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
598 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
599 key_len = lcode(&le); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
600 |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
601 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
602 skip_empty = lcode(&le); |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
603 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
604 for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode (&le)) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
605 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
606 } |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
607 le.ip += sizeof(uintptr_t); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
608 |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
609 if (skip_empty && val_len == 0) { |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
610 continue; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
611 } |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
612 |
3546
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
613 len += 2 + key_len + 2 + val_len; |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
614 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
615 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
616 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
617 if (uwcf->upstream.pass_request_headers) { |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
618 |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
619 allocated = 0; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
620 lowcase_key = NULL; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
621 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
622 if (uwcf->header_params) { |
4015
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
623 n = 0; |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
624 part = &r->headers_in.headers.part; |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
625 |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
626 while (part) { |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
627 n += part->nelts; |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
628 part = part->next; |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
629 } |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
630 |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
631 ignored = ngx_palloc(r->pool, n * sizeof(void *)); |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
632 if (ignored == NULL) { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
633 return NGX_ERROR; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
634 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
635 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
636 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
637 part = &r->headers_in.headers.part; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
638 header = part->elts; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
639 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
640 for (i = 0; /* void */ ; i++) { |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
641 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
642 if (i >= part->nelts) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
643 if (part->next == NULL) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
644 break; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
645 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
646 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
647 part = part->next; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
648 header = part->elts; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
649 i = 0; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
650 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
651 |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
652 if (uwcf->header_params) { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
653 if (allocated < header[i].key.len) { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
654 allocated = header[i].key.len + 16; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
655 lowcase_key = ngx_pnalloc(r->pool, allocated); |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
656 if (lowcase_key == NULL) { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
657 return NGX_ERROR; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
658 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
659 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
660 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
661 hash = 0; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
662 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
663 for (n = 0; n < header[i].key.len; n++) { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
664 ch = header[i].key.data[n]; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
665 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
666 if (ch >= 'A' && ch <= 'Z') { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
667 ch |= 0x20; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
668 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
669 } else if (ch == '-') { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
670 ch = '_'; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
671 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
672 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
673 hash = ngx_hash(hash, ch); |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
674 lowcase_key[n] = ch; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
675 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
676 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
677 if (ngx_hash_find(&uwcf->headers_hash, hash, lowcase_key, n)) { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
678 ignored[header_params++] = &header[i]; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
679 continue; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
680 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
681 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
682 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
683 len += 2 + sizeof("HTTP_") - 1 + header[i].key.len |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
684 + 2 + header[i].value.len; |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
685 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
686 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
687 |
3555
bc734cf061b0
improve uwsgi_string processing
Igor Sysoev <igor@sysoev.ru>
parents:
3554
diff
changeset
|
688 len += uwcf->uwsgi_string.len; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
689 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
690 #if 0 |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
691 /* allow custom uwsgi packet */ |
3546
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
692 if (len > 0 && len < 2) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
693 ngx_log_error (NGX_LOG_ALERT, r->connection->log, 0, |
3546
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
694 "uwsgi request is too little: %uz", len); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
695 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
696 } |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
697 #endif |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
698 |
3546
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
699 b = ngx_create_temp_buf(r->pool, len + 4); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
700 if (b == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
701 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
702 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
703 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
704 cl = ngx_alloc_chain_link(r->pool); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
705 if (cl == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
706 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
707 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
708 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
709 cl->buf = b; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
710 |
3552
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
711 *b->last++ = (u_char) uwcf->modifier1; |
3546
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
712 *b->last++ = (u_char) (len & 0xff); |
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
713 *b->last++ = (u_char) ((len >> 8) & 0xff); |
3552
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
714 *b->last++ = (u_char) uwcf->modifier2; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
715 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
716 if (uwcf->params_len) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
717 ngx_memzero(&e, sizeof(ngx_http_script_engine_t)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
718 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
719 e.ip = uwcf->params->elts; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
720 e.pos = b->last; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
721 e.request = r; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
722 e.flushed = 1; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
723 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
724 le.ip = uwcf->params_len->elts; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
725 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
726 while (*(uintptr_t *) le.ip) { |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
727 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
728 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
729 key_len = (u_char) lcode (&le); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
730 |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
731 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
732 skip_empty = lcode(&le); |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
733 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
734 for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
735 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
736 } |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
737 le.ip += sizeof(uintptr_t); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
738 |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
739 if (skip_empty && val_len == 0) { |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
740 e.skip = 1; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
741 |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
742 while (*(uintptr_t *) e.ip) { |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
743 code = *(ngx_http_script_code_pt *) e.ip; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
744 code((ngx_http_script_engine_t *) &e); |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
745 } |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
746 e.ip += sizeof(uintptr_t); |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
747 |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
748 e.skip = 0; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
749 |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
750 continue; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
751 } |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
752 |
3546
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
753 *e.pos++ = (u_char) (key_len & 0xff); |
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
754 *e.pos++ = (u_char) ((key_len >> 8) & 0xff); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
755 |
3547
c2da61796410
remove useless copy: key name should be just copied before value length
Igor Sysoev <igor@sysoev.ru>
parents:
3546
diff
changeset
|
756 code = *(ngx_http_script_code_pt *) e.ip; |
c2da61796410
remove useless copy: key name should be just copied before value length
Igor Sysoev <igor@sysoev.ru>
parents:
3546
diff
changeset
|
757 code((ngx_http_script_engine_t *) & e); |
c2da61796410
remove useless copy: key name should be just copied before value length
Igor Sysoev <igor@sysoev.ru>
parents:
3546
diff
changeset
|
758 |
c2da61796410
remove useless copy: key name should be just copied before value length
Igor Sysoev <igor@sysoev.ru>
parents:
3546
diff
changeset
|
759 *e.pos++ = (u_char) (val_len & 0xff); |
c2da61796410
remove useless copy: key name should be just copied before value length
Igor Sysoev <igor@sysoev.ru>
parents:
3546
diff
changeset
|
760 *e.pos++ = (u_char) ((val_len >> 8) & 0xff); |
c2da61796410
remove useless copy: key name should be just copied before value length
Igor Sysoev <igor@sysoev.ru>
parents:
3546
diff
changeset
|
761 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
762 while (*(uintptr_t *) e.ip) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
763 code = *(ngx_http_script_code_pt *) e.ip; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
764 code((ngx_http_script_engine_t *) & e); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
765 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
766 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
767 e.ip += sizeof(uintptr_t); |
3564
3da009cc90f3
add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents:
3556
diff
changeset
|
768 |
3da009cc90f3
add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents:
3556
diff
changeset
|
769 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
3da009cc90f3
add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents:
3556
diff
changeset
|
770 "uwsgi param: \"%*s: %*s\"", |
3da009cc90f3
add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents:
3556
diff
changeset
|
771 key_len, e.pos - (key_len + 2 + val_len), |
3da009cc90f3
add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents:
3556
diff
changeset
|
772 val_len, e.pos - val_len); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
773 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
774 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
775 b->last = e.pos; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
776 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
777 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
778 if (uwcf->upstream.pass_request_headers) { |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
779 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
780 part = &r->headers_in.headers.part; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
781 header = part->elts; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
782 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
783 for (i = 0; /* void */ ; i++) { |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
784 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
785 if (i >= part->nelts) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
786 if (part->next == NULL) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
787 break; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
788 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
789 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
790 part = part->next; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
791 header = part->elts; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
792 i = 0; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
793 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
794 |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
795 for (n = 0; n < header_params; n++) { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
796 if (&header[i] == ignored[n]) { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
797 goto next; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
798 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
799 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
800 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
801 key_len = sizeof("HTTP_") - 1 + header[i].key.len; |
3546
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
802 *b->last++ = (u_char) (key_len & 0xff); |
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
803 *b->last++ = (u_char) ((key_len >> 8) & 0xff); |
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
804 |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
805 b->last = ngx_cpymem(b->last, "HTTP_", sizeof("HTTP_") - 1); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
806 for (n = 0; n < header[i].key.len; n++) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
807 ch = header[i].key.data[n]; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
808 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
809 if (ch >= 'a' && ch <= 'z') { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
810 ch &= ~0x20; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
811 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
812 } else if (ch == '-') { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
813 ch = '_'; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
814 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
815 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
816 *b->last++ = ch; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
817 } |
3546
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
818 |
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
819 val_len = header[i].value.len; |
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
820 *b->last++ = (u_char) (val_len & 0xff); |
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
821 *b->last++ = (u_char) ((val_len >> 8) & 0xff); |
3a9fca8cbdfc
simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents:
3545
diff
changeset
|
822 b->last = ngx_copy(b->last, header[i].value.data, val_len); |
3564
3da009cc90f3
add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents:
3556
diff
changeset
|
823 |
3da009cc90f3
add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents:
3556
diff
changeset
|
824 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
3da009cc90f3
add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents:
3556
diff
changeset
|
825 "uwsgi param: \"%*s: %*s\"", |
3da009cc90f3
add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents:
3556
diff
changeset
|
826 key_len, b->last - (key_len + 2 + val_len), |
3da009cc90f3
add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents:
3556
diff
changeset
|
827 val_len, b->last - val_len); |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
828 next: |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
829 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
830 continue; |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
831 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
832 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
833 |
3555
bc734cf061b0
improve uwsgi_string processing
Igor Sysoev <igor@sysoev.ru>
parents:
3554
diff
changeset
|
834 b->last = ngx_copy(b->last, uwcf->uwsgi_string.data, |
bc734cf061b0
improve uwsgi_string processing
Igor Sysoev <igor@sysoev.ru>
parents:
3554
diff
changeset
|
835 uwcf->uwsgi_string.len); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
836 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
837 if (uwcf->upstream.pass_request_body) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
838 body = r->upstream->request_bufs; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
839 r->upstream->request_bufs = cl; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
840 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
841 while (body) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
842 b = ngx_alloc_buf(r->pool); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
843 if (b == NULL) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
844 return NGX_ERROR; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
845 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
846 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
847 ngx_memcpy(b, body->buf, sizeof(ngx_buf_t)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
848 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
849 cl->next = ngx_alloc_chain_link(r->pool); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
850 if (cl->next == NULL) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
851 return NGX_ERROR; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
852 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
853 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
854 cl = cl->next; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
855 cl->buf = b; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
856 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
857 body = body->next; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
858 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
859 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
860 } else { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
861 r->upstream->request_bufs = cl; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
862 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
863 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
864 cl->next = NULL; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
865 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
866 return NGX_OK; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
867 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
868 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
869 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
870 static ngx_int_t |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
871 ngx_http_uwsgi_reinit_request(ngx_http_request_t *r) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
872 { |
3629 | 873 ngx_http_status_t *status; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
874 |
3629 | 875 status = ngx_http_get_module_ctx(r, ngx_http_uwsgi_module); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
876 |
3629 | 877 if (status == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
878 return NGX_OK; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
879 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
880 |
3629 | 881 status->code = 0; |
882 status->count = 0; | |
883 status->start = NULL; | |
884 status->end = NULL; | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
885 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
886 r->upstream->process_header = ngx_http_uwsgi_process_status_line; |
4662
979e0f5b196d
Merge of r4616: r->state fix.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
887 r->state = 0; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
888 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
889 return NGX_OK; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
890 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
891 |
3623 | 892 |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
893 static ngx_int_t |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
894 ngx_http_uwsgi_process_status_line(ngx_http_request_t *r) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
895 { |
3628 | 896 size_t len; |
3623 | 897 ngx_int_t rc; |
3630 | 898 ngx_http_status_t *status; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
899 ngx_http_upstream_t *u; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
900 |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3625
diff
changeset
|
901 status = ngx_http_get_module_ctx(r, ngx_http_uwsgi_module); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
902 |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3625
diff
changeset
|
903 if (status == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
904 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
905 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
906 |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3625
diff
changeset
|
907 u = r->upstream; |
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3625
diff
changeset
|
908 |
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3625
diff
changeset
|
909 rc = ngx_http_parse_status_line(r, &u->buffer, status); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
910 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
911 if (rc == NGX_AGAIN) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
912 return rc; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
913 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
914 |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3625
diff
changeset
|
915 if (rc == NGX_ERROR) { |
3624 | 916 u->process_header = ngx_http_uwsgi_process_header; |
917 return ngx_http_uwsgi_process_header(r); | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
918 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
919 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
920 if (u->state) { |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3625
diff
changeset
|
921 u->state->status = status->code; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
922 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
923 |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3625
diff
changeset
|
924 u->headers_in.status_n = status->code; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
925 |
3628 | 926 len = status->end - status->start; |
927 u->headers_in.status_line.len = len; | |
928 | |
929 u->headers_in.status_line.data = ngx_pnalloc(r->pool, len); | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
930 if (u->headers_in.status_line.data == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
931 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
932 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
933 |
3628 | 934 ngx_memcpy(u->headers_in.status_line.data, status->start, len); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
935 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
936 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
937 "http uwsgi status %ui \"%V\"", |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
938 u->headers_in.status_n, &u->headers_in.status_line); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
939 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
940 u->process_header = ngx_http_uwsgi_process_header; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
941 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
942 return ngx_http_uwsgi_process_header(r); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
943 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
944 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
945 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
946 static ngx_int_t |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
947 ngx_http_uwsgi_process_header(ngx_http_request_t *r) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
948 { |
3624 | 949 ngx_str_t *status_line; |
950 ngx_int_t rc, status; | |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
951 ngx_table_elt_t *h; |
3624 | 952 ngx_http_upstream_t *u; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
953 ngx_http_upstream_header_t *hh; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
954 ngx_http_upstream_main_conf_t *umcf; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
955 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
956 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
957 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
958 for ( ;; ) { |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
959 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
960 rc = ngx_http_parse_header_line(r, &r->upstream->buffer, 1); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
961 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
962 if (rc == NGX_OK) { |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
963 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
964 /* a header line has been parsed successfully */ |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
965 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
966 h = ngx_list_push(&r->upstream->headers_in.headers); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
967 if (h == NULL) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
968 return NGX_ERROR; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
969 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
970 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
971 h->hash = r->header_hash; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
972 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
973 h->key.len = r->header_name_end - r->header_name_start; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
974 h->value.len = r->header_end - r->header_start; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
975 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
976 h->key.data = ngx_pnalloc(r->pool, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
977 h->key.len + 1 + h->value.len + 1 |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
978 + h->key.len); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
979 if (h->key.data == NULL) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
980 return NGX_ERROR; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
981 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
982 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
983 h->value.data = h->key.data + h->key.len + 1; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
984 h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
985 |
4529
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4527
diff
changeset
|
986 ngx_memcpy(h->key.data, r->header_name_start, h->key.len); |
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4527
diff
changeset
|
987 h->key.data[h->key.len] = '\0'; |
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4527
diff
changeset
|
988 ngx_memcpy(h->value.data, r->header_start, h->value.len); |
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4527
diff
changeset
|
989 h->value.data[h->value.len] = '\0'; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
990 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
991 if (h->key.len == r->lowcase_index) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
992 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
993 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
994 } else { |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
995 ngx_strlow(h->lowcase_key, h->key.data, h->key.len); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
996 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
997 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
998 hh = ngx_hash_find(&umcf->headers_in_hash, h->hash, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
999 h->lowcase_key, h->key.len); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1000 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1001 if (hh && hh->handler(r, h, hh->offset) != NGX_OK) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1002 return NGX_ERROR; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1003 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1004 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1005 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1006 "http uwsgi header: \"%V: %V\"", &h->key, &h->value); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1007 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1008 continue; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1009 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1010 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1011 if (rc == NGX_HTTP_PARSE_HEADER_DONE) { |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1012 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1013 /* a whole header has been parsed successfully */ |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1014 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1015 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1016 "http uwsgi header done"); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1017 |
4527
9c3a2fc3c460
Uwsgi: merged r->http_version fixes from scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4522
diff
changeset
|
1018 u = r->upstream; |
9c3a2fc3c460
Uwsgi: merged r->http_version fixes from scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4522
diff
changeset
|
1019 |
9c3a2fc3c460
Uwsgi: merged r->http_version fixes from scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4522
diff
changeset
|
1020 if (u->headers_in.status_n) { |
3624 | 1021 return NGX_OK; |
1022 } | |
1023 | |
1024 if (u->headers_in.status) { | |
1025 status_line = &u->headers_in.status->value; | |
1026 | |
1027 status = ngx_atoi(status_line->data, 3); | |
1028 if (status == NGX_ERROR) { | |
1029 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1030 "upstream sent invalid status \"%V\"", | |
1031 status_line); | |
1032 return NGX_HTTP_UPSTREAM_INVALID_HEADER; | |
1033 } | |
1034 | |
1035 u->headers_in.status_n = status; | |
1036 u->headers_in.status_line = *status_line; | |
1037 | |
1038 } else if (u->headers_in.location) { | |
1039 u->headers_in.status_n = 302; | |
1040 ngx_str_set(&u->headers_in.status_line, | |
1041 "302 Moved Temporarily"); | |
1042 | |
1043 } else { | |
1044 u->headers_in.status_n = 200; | |
1045 ngx_str_set(&u->headers_in.status_line, "200 OK"); | |
1046 } | |
1047 | |
1048 if (u->state) { | |
1049 u->state->status = u->headers_in.status_n; | |
1050 } | |
1051 | |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1052 return NGX_OK; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1053 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1054 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1055 if (rc == NGX_AGAIN) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1056 return NGX_AGAIN; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1057 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1058 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1059 /* there was error while a header line parsing */ |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1060 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1061 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1062 "upstream sent invalid header"); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1063 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1064 return NGX_HTTP_UPSTREAM_INVALID_HEADER; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1065 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1066 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1067 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1068 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1069 static void |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1070 ngx_http_uwsgi_abort_request(ngx_http_request_t *r) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1071 { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1072 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1073 "abort http uwsgi request"); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1074 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1075 return; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1076 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1077 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1078 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1079 static void |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1080 ngx_http_uwsgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1081 { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1082 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1083 "finalize http uwsgi request"); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1084 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1085 return; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1086 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1087 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1088 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1089 static void * |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1090 ngx_http_uwsgi_create_loc_conf(ngx_conf_t *cf) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1091 { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1092 ngx_http_uwsgi_loc_conf_t *conf; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1093 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1094 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_uwsgi_loc_conf_t)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1095 if (conf == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1096 return NULL; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1097 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1098 |
3552
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
1099 conf->modifier1 = NGX_CONF_UNSET_UINT; |
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
1100 conf->modifier2 = NGX_CONF_UNSET_UINT; |
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
1101 |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1102 conf->upstream.store = NGX_CONF_UNSET; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1103 conf->upstream.store_access = NGX_CONF_UNSET_UINT; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1104 conf->upstream.buffering = NGX_CONF_UNSET; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1105 conf->upstream.ignore_client_abort = NGX_CONF_UNSET; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1106 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1107 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1108 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1109 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1110 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1111 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1112 conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1113 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1114 conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1115 conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1116 conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1117 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1118 conf->upstream.pass_request_headers = NGX_CONF_UNSET; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1119 conf->upstream.pass_request_body = NGX_CONF_UNSET; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1120 |
3568 | 1121 #if (NGX_HTTP_CACHE) |
1122 conf->upstream.cache = NGX_CONF_UNSET_PTR; | |
1123 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT; | |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
1124 conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR; |
3693
e3bcc2f4c418
fix scgi_no_cache and uwsgi_no_cache initialization
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
1125 conf->upstream.no_cache = NGX_CONF_UNSET_PTR; |
3568 | 1126 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; |
4386
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
1127 conf->upstream.cache_lock = NGX_CONF_UNSET; |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
1128 conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC; |
3568 | 1129 #endif |
1130 | |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1131 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1132 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1133 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1134 conf->upstream.intercept_errors = NGX_CONF_UNSET; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1135 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1136 /* "uwsgi_cyclic_temp_file" is disabled */ |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1137 conf->upstream.cyclic_temp_file = 0; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1138 |
4157
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
1139 conf->upstream.change_buffering = 1; |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
1140 |
3976
215fe9223419
update r3945 with more descriptive error message
Igor Sysoev <igor@sysoev.ru>
parents:
3879
diff
changeset
|
1141 ngx_str_set(&conf->upstream.module, "uwsgi"); |
215fe9223419
update r3945 with more descriptive error message
Igor Sysoev <igor@sysoev.ru>
parents:
3879
diff
changeset
|
1142 |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1143 return conf; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1144 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1145 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1146 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1147 static char * |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1148 ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1149 { |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1150 ngx_http_uwsgi_loc_conf_t *prev = parent; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1151 ngx_http_uwsgi_loc_conf_t *conf = child; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1152 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1153 size_t size; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1154 ngx_hash_init_t hash; |
3731
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1155 ngx_http_core_loc_conf_t *clcf; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1156 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1157 if (conf->upstream.store != 0) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1158 ngx_conf_merge_value(conf->upstream.store, prev->upstream.store, 0); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1159 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1160 if (conf->upstream.store_lengths == NULL) { |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1161 conf->upstream.store_lengths = prev->upstream.store_lengths; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1162 conf->upstream.store_values = prev->upstream.store_values; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1163 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1164 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1165 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1166 ngx_conf_merge_uint_value(conf->upstream.store_access, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1167 prev->upstream.store_access, 0600); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1168 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1169 ngx_conf_merge_value(conf->upstream.buffering, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1170 prev->upstream.buffering, 1); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1171 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1172 ngx_conf_merge_value(conf->upstream.ignore_client_abort, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1173 prev->upstream.ignore_client_abort, 0); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1174 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1175 ngx_conf_merge_msec_value(conf->upstream.connect_timeout, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1176 prev->upstream.connect_timeout, 60000); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1177 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1178 ngx_conf_merge_msec_value(conf->upstream.send_timeout, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1179 prev->upstream.send_timeout, 60000); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1180 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1181 ngx_conf_merge_msec_value(conf->upstream.read_timeout, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1182 prev->upstream.read_timeout, 60000); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1183 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1184 ngx_conf_merge_size_value(conf->upstream.send_lowat, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1185 prev->upstream.send_lowat, 0); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1186 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1187 ngx_conf_merge_size_value(conf->upstream.buffer_size, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1188 prev->upstream.buffer_size, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1189 (size_t) ngx_pagesize); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1190 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1191 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1192 ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1193 8, ngx_pagesize); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1194 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1195 if (conf->upstream.bufs.num < 2) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1196 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1197 "there must be at least 2 \"uwsgi_buffers\""); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1198 return NGX_CONF_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1199 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1200 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1201 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1202 size = conf->upstream.buffer_size; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1203 if (size < conf->upstream.bufs.size) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1204 size = conf->upstream.bufs.size; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1205 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1206 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1207 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1208 ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1209 prev->upstream.busy_buffers_size_conf, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1210 NGX_CONF_UNSET_SIZE); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1211 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1212 if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1213 conf->upstream.busy_buffers_size = 2 * size; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1214 } else { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1215 conf->upstream.busy_buffers_size = |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1216 conf->upstream.busy_buffers_size_conf; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1217 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1218 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1219 if (conf->upstream.busy_buffers_size < size) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1220 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1221 "\"uwsgi_busy_buffers_size\" must be equal to or greater " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1222 "than the maximum of the value of \"uwsgi_buffer_size\" and " |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1223 "one of the \"uwsgi_buffers\""); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1224 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1225 return NGX_CONF_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1226 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1227 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1228 if (conf->upstream.busy_buffers_size |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1229 > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size) |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1230 { |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1231 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1232 "\"uwsgi_busy_buffers_size\" must be less than " |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1233 "the size of all \"uwsgi_buffers\" minus one buffer"); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1234 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1235 return NGX_CONF_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1236 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1237 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1238 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1239 ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1240 prev->upstream.temp_file_write_size_conf, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1241 NGX_CONF_UNSET_SIZE); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1242 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1243 if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1244 conf->upstream.temp_file_write_size = 2 * size; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1245 } else { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1246 conf->upstream.temp_file_write_size = |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1247 conf->upstream.temp_file_write_size_conf; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1248 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1249 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1250 if (conf->upstream.temp_file_write_size < size) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1251 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1252 "\"uwsgi_temp_file_write_size\" must be equal to or greater than " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1253 "the maximum of the value of \"uwsgi_buffer_size\" and " |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1254 "one of the \"uwsgi_buffers\""); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1255 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1256 return NGX_CONF_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1257 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1258 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1259 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1260 ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1261 prev->upstream.max_temp_file_size_conf, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1262 NGX_CONF_UNSET_SIZE); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1263 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1264 if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1265 conf->upstream.max_temp_file_size = 1024 * 1024 * 1024; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1266 } else { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1267 conf->upstream.max_temp_file_size = |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1268 conf->upstream.max_temp_file_size_conf; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1269 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1270 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1271 if (conf->upstream.max_temp_file_size != 0 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1272 && conf->upstream.max_temp_file_size < size) { |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1273 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1274 "\"uwsgi_max_temp_file_size\" must be equal to zero to disable " |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1275 "temporary files usage or must be equal to or greater than " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1276 "the maximum of the value of \"uwsgi_buffer_size\" and " |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1277 "one of the \"uwsgi_buffers\""); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1278 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1279 return NGX_CONF_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1280 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1281 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1282 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1283 ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1284 prev->upstream.ignore_headers, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1285 NGX_CONF_BITMASK_SET); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1286 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1287 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1288 ngx_conf_merge_bitmask_value(conf->upstream.next_upstream, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1289 prev->upstream.next_upstream, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1290 (NGX_CONF_BITMASK_SET |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1291 |NGX_HTTP_UPSTREAM_FT_ERROR |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1292 |NGX_HTTP_UPSTREAM_FT_TIMEOUT)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1293 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1294 if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1295 conf->upstream.next_upstream = NGX_CONF_BITMASK_SET |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1296 |NGX_HTTP_UPSTREAM_FT_OFF; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1297 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1298 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1299 if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1300 prev->upstream.temp_path, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1301 &ngx_http_uwsgi_temp_path) |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1302 != NGX_OK) |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1303 { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1304 return NGX_CONF_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1305 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1306 |
3568 | 1307 #if (NGX_HTTP_CACHE) |
1308 | |
1309 ngx_conf_merge_ptr_value(conf->upstream.cache, | |
1310 prev->upstream.cache, NULL); | |
1311 | |
1312 if (conf->upstream.cache && conf->upstream.cache->data == NULL) { | |
1313 ngx_shm_zone_t *shm_zone; | |
1314 | |
1315 shm_zone = conf->upstream.cache; | |
1316 | |
1317 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1318 "\"uwsgi_cache\" zone \"%V\" is unknown", | |
1319 &shm_zone->shm.name); | |
1320 | |
1321 return NGX_CONF_ERROR; | |
1322 } | |
1323 | |
1324 ngx_conf_merge_uint_value(conf->upstream.cache_min_uses, | |
1325 prev->upstream.cache_min_uses, 1); | |
1326 | |
1327 ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale, | |
1328 prev->upstream.cache_use_stale, | |
1329 (NGX_CONF_BITMASK_SET | |
1330 |NGX_HTTP_UPSTREAM_FT_OFF)); | |
1331 | |
1332 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) { | |
1333 conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET | |
1334 |NGX_HTTP_UPSTREAM_FT_OFF; | |
1335 } | |
1336 | |
4401
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4386
diff
changeset
|
1337 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_ERROR) { |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4386
diff
changeset
|
1338 conf->upstream.cache_use_stale |= NGX_HTTP_UPSTREAM_FT_NOLIVE; |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4386
diff
changeset
|
1339 } |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4386
diff
changeset
|
1340 |
3568 | 1341 if (conf->upstream.cache_methods == 0) { |
1342 conf->upstream.cache_methods = prev->upstream.cache_methods; | |
1343 } | |
1344 | |
1345 conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD; | |
1346 | |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
1347 ngx_conf_merge_ptr_value(conf->upstream.cache_bypass, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
1348 prev->upstream.cache_bypass, NULL); |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
1349 |
3568 | 1350 ngx_conf_merge_ptr_value(conf->upstream.no_cache, |
1351 prev->upstream.no_cache, NULL); | |
1352 | |
1353 ngx_conf_merge_ptr_value(conf->upstream.cache_valid, | |
1354 prev->upstream.cache_valid, NULL); | |
1355 | |
1356 if (conf->cache_key.value.data == NULL) { | |
1357 conf->cache_key = prev->cache_key; | |
1358 } | |
1359 | |
4386
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
1360 ngx_conf_merge_value(conf->upstream.cache_lock, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
1361 prev->upstream.cache_lock, 0); |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
1362 |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
1363 ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
1364 prev->upstream.cache_lock_timeout, 5000); |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4330
diff
changeset
|
1365 |
3568 | 1366 #endif |
1367 | |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1368 ngx_conf_merge_value(conf->upstream.pass_request_headers, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1369 prev->upstream.pass_request_headers, 1); |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1370 ngx_conf_merge_value(conf->upstream.pass_request_body, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1371 prev->upstream.pass_request_body, 1); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1372 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1373 ngx_conf_merge_value(conf->upstream.intercept_errors, |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1374 prev->upstream.intercept_errors, 0); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1375 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1376 ngx_conf_merge_str_value(conf->uwsgi_string, prev->uwsgi_string, ""); |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1377 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1378 hash.max_size = 512; |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1379 hash.bucket_size = ngx_align(64, ngx_cacheline_size); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1380 hash.name = "uwsgi_hide_headers_hash"; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1381 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1382 if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream, |
3670
2728c4e4a9ae
do not use a cache headers set to hide
Igor Sysoev <igor@sysoev.ru>
parents:
3667
diff
changeset
|
1383 &prev->upstream, ngx_http_uwsgi_hide_headers, &hash) |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1384 != NGX_OK) |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1385 { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1386 return NGX_CONF_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1387 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1388 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1389 if (conf->upstream.upstream == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1390 conf->upstream.upstream = prev->upstream.upstream; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1391 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1392 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1393 if (conf->uwsgi_lengths == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1394 conf->uwsgi_lengths = prev->uwsgi_lengths; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1395 conf->uwsgi_values = prev->uwsgi_values; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1396 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1397 |
3731
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1398 if (conf->upstream.upstream || conf->uwsgi_lengths) { |
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1399 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1400 if (clcf->handler == NULL && clcf->lmt_excpt) { |
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1401 clcf->handler = ngx_http_uwsgi_handler; |
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1402 } |
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1403 } |
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1404 |
3552
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
1405 ngx_conf_merge_uint_value(conf->modifier1, prev->modifier1, 0); |
40eba0271b1d
improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents:
3551
diff
changeset
|
1406 ngx_conf_merge_uint_value(conf->modifier2, prev->modifier2, 0); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1407 |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1408 if (ngx_http_uwsgi_merge_params(cf, conf, prev) != NGX_OK) { |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1409 return NGX_CONF_ERROR; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1410 } |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1411 |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1412 return NGX_CONF_OK; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1413 } |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1414 |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1415 |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1416 static ngx_int_t |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1417 ngx_http_uwsgi_merge_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf, |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1418 ngx_http_uwsgi_loc_conf_t *prev) |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1419 { |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1420 u_char *p; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1421 size_t size; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1422 uintptr_t *code; |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1423 ngx_uint_t i, nsrc; |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1424 ngx_array_t headers_names; |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1425 #if (NGX_HTTP_CACHE) |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1426 ngx_array_t params_merged; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1427 #endif |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1428 ngx_hash_key_t *hk; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1429 ngx_hash_init_t hash; |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1430 ngx_http_upstream_param_t *src; |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1431 ngx_http_script_compile_t sc; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1432 ngx_http_script_copy_code_t *copy; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1433 |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1434 if (conf->params_source == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1435 conf->params_source = prev->params_source; |
3568 | 1436 |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1437 if (prev->headers_hash.buckets |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1438 #if (NGX_HTTP_CACHE) |
4522 | 1439 && ((conf->upstream.cache == NULL) |
1440 == (prev->upstream.cache == NULL)) | |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1441 #endif |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1442 ) |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1443 { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1444 conf->flushes = prev->flushes; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1445 conf->params_len = prev->params_len; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1446 conf->params = prev->params; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1447 conf->headers_hash = prev->headers_hash; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1448 conf->header_params = prev->header_params; |
3568 | 1449 |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1450 return NGX_OK; |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1451 } |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1452 } |
3568 | 1453 |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1454 if (conf->params_source == NULL |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1455 #if (NGX_HTTP_CACHE) |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1456 && (conf->upstream.cache == NULL) |
3568 | 1457 #endif |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1458 ) |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1459 { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1460 conf->headers_hash.buckets = (void *) 1; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1461 return NGX_OK; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1462 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1463 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1464 conf->params_len = ngx_array_create(cf->pool, 64, 1); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1465 if (conf->params_len == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1466 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1467 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1468 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1469 conf->params = ngx_array_create(cf->pool, 512, 1); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1470 if (conf->params == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1471 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1472 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1473 |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1474 if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t)) |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1475 != NGX_OK) |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1476 { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1477 return NGX_ERROR; |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1478 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1479 |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1480 if (conf->params_source) { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1481 src = conf->params_source->elts; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1482 nsrc = conf->params_source->nelts; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1483 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1484 } else { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1485 src = NULL; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1486 nsrc = 0; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1487 } |
3568 | 1488 |
1489 #if (NGX_HTTP_CACHE) | |
1490 | |
1491 if (conf->upstream.cache) { | |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1492 ngx_keyval_t *h; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1493 ngx_http_upstream_param_t *s; |
3568 | 1494 |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1495 if (ngx_array_init(¶ms_merged, cf->temp_pool, 4, |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1496 sizeof(ngx_http_upstream_param_t)) |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1497 != NGX_OK) |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1498 { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1499 return NGX_ERROR; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1500 } |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1501 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1502 for (i = 0; i < nsrc; i++) { |
3568 | 1503 |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1504 s = ngx_array_push(¶ms_merged); |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1505 if (s == NULL) { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1506 return NGX_ERROR; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1507 } |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1508 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1509 *s = src[i]; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1510 } |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1511 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1512 h = ngx_http_uwsgi_cache_headers; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1513 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1514 while (h->key.len) { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1515 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1516 src = params_merged.elts; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1517 nsrc = params_merged.nelts; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1518 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1519 for (i = 0; i < nsrc; i++) { |
3568 | 1520 if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) { |
1521 goto next; | |
1522 } | |
1523 } | |
1524 | |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1525 s = ngx_array_push(¶ms_merged); |
3568 | 1526 if (s == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1527 return NGX_ERROR; |
3568 | 1528 } |
1529 | |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1530 s->key = h->key; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1531 s->value = h->value; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1532 s->skip_empty = 0; |
3568 | 1533 |
1534 next: | |
1535 | |
1536 h++; | |
1537 } | |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1538 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1539 src = params_merged.elts; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1540 nsrc = params_merged.nelts; |
3568 | 1541 } |
1542 | |
1543 #endif | |
1544 | |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1545 for (i = 0; i < nsrc; i++) { |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1546 |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1547 if (src[i].key.len > sizeof("HTTP_") - 1 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1548 && ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0) |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1549 { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1550 hk = ngx_array_push(&headers_names); |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1551 if (hk == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1552 return NGX_ERROR; |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1553 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1554 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1555 hk->key.len = src[i].key.len - 5; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1556 hk->key.data = src[i].key.data + 5; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1557 hk->key_hash = ngx_hash_key_lc(hk->key.data, hk->key.len); |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1558 hk->value = (void *) 1; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1559 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1560 if (src[i].value.len == 0) { |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1561 continue; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1562 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1563 } |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1564 |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1565 copy = ngx_array_push_n(conf->params_len, |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1566 sizeof(ngx_http_script_copy_code_t)); |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1567 if (copy == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1568 return NGX_ERROR; |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1569 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1570 |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1571 copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code; |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1572 copy->len = src[i].key.len; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1573 |
4330
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1574 copy = ngx_array_push_n(conf->params_len, |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1575 sizeof(ngx_http_script_copy_code_t)); |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1576 if (copy == NULL) { |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1577 return NGX_ERROR; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1578 } |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1579 |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1580 copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1581 copy->len = src[i].skip_empty; |
5ee5ddec17b1
uwsgi: added "if_not_empty" flag support to the "uwsgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
1582 |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1583 |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1584 size = (sizeof(ngx_http_script_copy_code_t) |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1585 + src[i].key.len + sizeof(uintptr_t) - 1) |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1586 & ~(sizeof(uintptr_t) - 1); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1587 |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1588 copy = ngx_array_push_n(conf->params, size); |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1589 if (copy == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1590 return NGX_ERROR; |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1591 } |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1592 |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1593 copy->code = ngx_http_script_copy_code; |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1594 copy->len = src[i].key.len; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1595 |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1596 p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t); |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1597 ngx_memcpy(p, src[i].key.data, src[i].key.len); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1598 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1599 |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1600 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1601 |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1602 sc.cf = cf; |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1603 sc.source = &src[i].value; |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1604 sc.flushes = &conf->flushes; |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1605 sc.lengths = &conf->params_len; |
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1606 sc.values = &conf->params; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1607 |
3548
fc7541a6959d
fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents:
3547
diff
changeset
|
1608 if (ngx_http_script_compile(&sc) != NGX_OK) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1609 return NGX_ERROR; |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1610 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1611 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1612 code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t)); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1613 if (code == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1614 return NGX_ERROR; |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1615 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1616 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1617 *code = (uintptr_t) NULL; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1618 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1619 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1620 code = ngx_array_push_n(conf->params, sizeof(uintptr_t)); |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1621 if (code == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1622 return NGX_ERROR; |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1623 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1624 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1625 *code = (uintptr_t) NULL; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1626 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1627 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1628 code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1629 if (code == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1630 return NGX_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1631 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1632 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1633 *code = (uintptr_t) NULL; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1634 |
3566
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1635 conf->header_params = headers_names.nelts; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1636 |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1637 hash.hash = &conf->headers_hash; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1638 hash.key = ngx_hash_key_lc; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1639 hash.max_size = 512; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1640 hash.bucket_size = 64; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1641 hash.name = "uwsgi_params_hash"; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1642 hash.pool = cf->pool; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1643 hash.temp_pool = NULL; |
b81d44244cb1
allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents:
3565
diff
changeset
|
1644 |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1645 return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1646 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1647 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1648 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1649 static char * |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1650 ngx_http_uwsgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1651 { |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1652 ngx_http_uwsgi_loc_conf_t *uwcf = conf; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1653 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1654 ngx_url_t u; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1655 ngx_str_t *value, *url; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1656 ngx_uint_t n; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1657 ngx_http_core_loc_conf_t *clcf; |
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1658 ngx_http_script_compile_t sc; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1659 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1660 if (uwcf->upstream.upstream || uwcf->uwsgi_lengths) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1661 return "is duplicate"; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1662 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1663 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1664 clcf = ngx_http_conf_get_module_loc_conf (cf, ngx_http_core_module); |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1665 clcf->handler = ngx_http_uwsgi_handler; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1666 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1667 value = cf->args->elts; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1668 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1669 url = &value[1]; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1670 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1671 n = ngx_http_script_variables_count(url); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1672 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1673 if (n) { |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1674 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1675 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1676 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1677 sc.cf = cf; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1678 sc.source = url; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1679 sc.lengths = &uwcf->uwsgi_lengths; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1680 sc.values = &uwcf->uwsgi_values; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1681 sc.variables = n; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1682 sc.complete_lengths = 1; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1683 sc.complete_values = 1; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1684 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1685 if (ngx_http_script_compile(&sc) != NGX_OK) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1686 return NGX_CONF_ERROR; |
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1687 } |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1688 |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1689 return NGX_CONF_OK; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1690 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1691 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1692 ngx_memzero(&u, sizeof(ngx_url_t)); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1693 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1694 u.url = value[1]; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1695 u.no_resolve = 1; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1696 |
3543
e132566a942e
fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents:
3542
diff
changeset
|
1697 uwcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0); |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1698 if (uwcf->upstream.upstream == NULL) { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1699 return NGX_CONF_ERROR; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1700 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1701 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1702 if (clcf->name.data[clcf->name.len - 1] == '/') { |
3542
9bf51b3fc1c1
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
3541
diff
changeset
|
1703 clcf->auto_redirect = 1; |
3541
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1704 } |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1705 |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1706 return NGX_CONF_OK; |
21452748d165
import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1707 } |
3565 | 1708 |
1709 | |
1710 static char * | |
1711 ngx_http_uwsgi_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1712 { | |
1713 ngx_http_uwsgi_loc_conf_t *uwcf = conf; | |
1714 | |
1715 ngx_str_t *value; | |
1716 ngx_http_script_compile_t sc; | |
1717 | |
1718 if (uwcf->upstream.store != NGX_CONF_UNSET || uwcf->upstream.store_lengths) | |
1719 { | |
1720 return "is duplicate"; | |
1721 } | |
1722 | |
1723 value = cf->args->elts; | |
1724 | |
3568 | 1725 if (ngx_strcmp(value[1].data, "off") == 0) { |
1726 uwcf->upstream.store = 0; | |
3565 | 1727 return NGX_CONF_OK; |
1728 } | |
1729 | |
3568 | 1730 #if (NGX_HTTP_CACHE) |
1731 | |
1732 if (uwcf->upstream.cache != NGX_CONF_UNSET_PTR | |
1733 && uwcf->upstream.cache != NULL) | |
1734 { | |
1735 return "is incompatible with \"uwsgi_cache\""; | |
1736 } | |
1737 | |
1738 #endif | |
1739 | |
1740 if (ngx_strcmp(value[1].data, "on") == 0) { | |
1741 uwcf->upstream.store = 1; | |
3565 | 1742 return NGX_CONF_OK; |
1743 } | |
1744 | |
1745 /* include the terminating '\0' into script */ | |
1746 value[1].len++; | |
1747 | |
1748 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
1749 | |
1750 sc.cf = cf; | |
1751 sc.source = &value[1]; | |
1752 sc.lengths = &uwcf->upstream.store_lengths; | |
1753 sc.values = &uwcf->upstream.store_values; | |
1754 sc.variables = ngx_http_script_variables_count(&value[1]);; | |
1755 sc.complete_lengths = 1; | |
1756 sc.complete_values = 1; | |
1757 | |
1758 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
1759 return NGX_CONF_ERROR; | |
1760 } | |
1761 | |
1762 return NGX_CONF_OK; | |
1763 } | |
3568 | 1764 |
1765 | |
1766 #if (NGX_HTTP_CACHE) | |
1767 | |
1768 static char * | |
1769 ngx_http_uwsgi_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1770 { | |
1771 ngx_http_uwsgi_loc_conf_t *uwcf = conf; | |
1772 | |
1773 ngx_str_t *value; | |
1774 | |
1775 value = cf->args->elts; | |
1776 | |
1777 if (uwcf->upstream.cache != NGX_CONF_UNSET_PTR) { | |
1778 return "is duplicate"; | |
1779 } | |
1780 | |
1781 if (ngx_strcmp(value[1].data, "off") == 0) { | |
1782 uwcf->upstream.cache = NULL; | |
1783 return NGX_CONF_OK; | |
1784 } | |
1785 | |
1786 if (uwcf->upstream.store > 0 || uwcf->upstream.store_lengths) { | |
1787 return "is incompatible with \"uwsgi_store\""; | |
1788 } | |
1789 | |
1790 uwcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, | |
1791 &ngx_http_uwsgi_module); | |
1792 if (uwcf->upstream.cache == NULL) { | |
1793 return NGX_CONF_ERROR; | |
1794 } | |
1795 | |
1796 return NGX_CONF_OK; | |
1797 } | |
1798 | |
1799 | |
1800 static char * | |
1801 ngx_http_uwsgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1802 { | |
1803 ngx_http_uwsgi_loc_conf_t *uwcf = conf; | |
1804 | |
1805 ngx_str_t *value; | |
1806 ngx_http_compile_complex_value_t ccv; | |
1807 | |
1808 value = cf->args->elts; | |
1809 | |
1810 if (uwcf->cache_key.value.len) { | |
1811 return "is duplicate"; | |
1812 } | |
1813 | |
1814 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); | |
1815 | |
1816 ccv.cf = cf; | |
1817 ccv.value = &value[1]; | |
1818 ccv.complex_value = &uwcf->cache_key; | |
1819 | |
1820 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { | |
1821 return NGX_CONF_ERROR; | |
1822 } | |
1823 | |
1824 return NGX_CONF_OK; | |
1825 } | |
1826 | |
1827 #endif |