annotate src/http/modules/ngx_http_uwsgi_module.c @ 3629:a2a3378824ba

fix r3628
author Igor Sysoev <igor@sysoev.ru>
date Tue, 15 Jun 2010 15:27:06 +0000
parents cf47471a9eda
children b5819529738a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
6048c77cfbb2 fix copyrights
Igor Sysoev <igor@sysoev.ru>
parents: 3543
diff changeset
4 * Copyright (C) 2008 Manlio Perillo (manlio.perillo@gmail.com)
6048c77cfbb2 fix copyrights
Igor Sysoev <igor@sysoev.ru>
parents: 3543
diff changeset
5 * Copyright (C) Igor Sysoev
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6 */
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 #include <ngx_config.h>
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10 #include <ngx_core.h>
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11 #include <ngx_http.h>
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
13
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14 typedef struct {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
15 ngx_http_upstream_conf_t upstream;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
16
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
17 ngx_array_t *flushes;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
18 ngx_array_t *params_len;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
19 ngx_array_t *params;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
20 ngx_array_t *params_source;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
21
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
22 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
23 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
24
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
25 ngx_array_t *uwsgi_lengths;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
26 ngx_array_t *uwsgi_values;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
27
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
28 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
29 ngx_http_complex_value_t cache_key;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
30 #endif
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
31
3550
9f715c9e5b82 style fix
Igor Sysoev <igor@sysoev.ru>
parents: 3549
diff changeset
32 ngx_str_t uwsgi_string;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
33
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
34 ngx_uint_t modifier1;
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
35 ngx_uint_t modifier2;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
36 } ngx_http_uwsgi_loc_conf_t;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
37
3556
b9415935d95d style fix
Igor Sysoev <igor@sysoev.ru>
parents: 3555
diff changeset
38
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
39 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
40 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
41 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
42 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
43 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
44 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
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);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
53
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
54 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
55 void *conf);
3565
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
56 static char *ngx_http_uwsgi_store(ngx_conf_t *cf, ngx_command_t *cmd,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
57 void *conf);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
58
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
59 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
60 static ngx_int_t ngx_http_uwsgi_create_key(ngx_http_request_t *r);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
61 static char *ngx_http_uwsgi_cache(ngx_conf_t *cf, ngx_command_t *cmd,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
62 void *conf);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
63 static char *ngx_http_uwsgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
64 void *conf);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
65 #endif
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
66
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
67
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
68 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
69 ngx_conf_check_num_bounds, 0, 255
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
70 };
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
71
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
72
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
73 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
74 { 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
75 { 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
76 { 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
77 { 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
78 { 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
79 { 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
80 { 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
81 { 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
82 { ngx_null_string, 0 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
83 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
84
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 static ngx_conf_bitmask_t ngx_http_uwsgi_ignore_headers_masks[] = {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
87 { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
88 { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES },
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
89 { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
90 { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
91 { ngx_null_string, 0 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
92 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
93
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
94
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
95 ngx_module_t ngx_http_uwsgi_module;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
96
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
97
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
98 static ngx_command_t ngx_http_uwsgi_commands[] = {
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_pass"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
101 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
102 ngx_http_uwsgi_pass,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
103 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
104 0,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
105 NULL },
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_modifier1"),
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, modifier1),
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
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
114 { ngx_string("uwsgi_modifier2"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
115 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
116 ngx_conf_set_num_slot,
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
117 NGX_HTTP_LOC_CONF_OFFSET,
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
118 offsetof(ngx_http_uwsgi_loc_conf_t, modifier2),
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
119 &ngx_http_uwsgi_modifier_bounds },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
120
3565
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
121 { ngx_string("uwsgi_store"),
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
122 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
123 ngx_http_uwsgi_store,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
124 NGX_HTTP_LOC_CONF_OFFSET,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
125 0,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
126 NULL },
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
127
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
128 { ngx_string("uwsgi_store_access"),
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
129 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
130 ngx_conf_set_access_slot,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
131 NGX_HTTP_LOC_CONF_OFFSET,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
132 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.store_access),
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
133 NULL },
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
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
9bbfce117cfb uwsgi_bind
Igor Sysoev <igor@sysoev.ru>
parents: 3566
diff changeset
142 { ngx_string("uwsgi_bind"),
9bbfce117cfb uwsgi_bind
Igor Sysoev <igor@sysoev.ru>
parents: 3566
diff changeset
143 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
9bbfce117cfb uwsgi_bind
Igor Sysoev <igor@sysoev.ru>
parents: 3566
diff changeset
144 ngx_http_upstream_bind_set_slot,
9bbfce117cfb uwsgi_bind
Igor Sysoev <igor@sysoev.ru>
parents: 3566
diff changeset
145 NGX_HTTP_LOC_CONF_OFFSET,
9bbfce117cfb uwsgi_bind
Igor Sysoev <igor@sysoev.ru>
parents: 3566
diff changeset
146 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.local),
9bbfce117cfb uwsgi_bind
Igor Sysoev <igor@sysoev.ru>
parents: 3566
diff changeset
147 NULL },
9bbfce117cfb uwsgi_bind
Igor Sysoev <igor@sysoev.ru>
parents: 3566
diff changeset
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
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
212 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
213
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
214 { ngx_string("uwsgi_cache"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
215 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
216 ngx_http_uwsgi_cache,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
217 NGX_HTTP_LOC_CONF_OFFSET,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
218 0,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
219 NULL },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
220
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
221 { ngx_string("uwsgi_cache_key"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
222 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
223 ngx_http_uwsgi_cache_key,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
224 NGX_HTTP_LOC_CONF_OFFSET,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
225 0,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
226 NULL },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
227
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
228 { ngx_string("uwsgi_cache_path"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
229 NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
230 ngx_http_file_cache_set_slot,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
231 0,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
232 0,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
233 &ngx_http_uwsgi_module },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
234
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
235 { ngx_string("uwsgi_no_cache"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
236 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
237 ngx_http_no_cache_set_slot,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
238 NGX_HTTP_LOC_CONF_OFFSET,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
239 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.no_cache),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
240 NULL },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
241
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
242 { ngx_string("uwsgi_cache_valid"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
243 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
244 ngx_http_file_cache_valid_set_slot,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
245 NGX_HTTP_LOC_CONF_OFFSET,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
246 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_valid),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
247 NULL },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
248
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
249 { ngx_string("uwsgi_cache_min_uses"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
250 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
251 ngx_conf_set_num_slot,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
252 NGX_HTTP_LOC_CONF_OFFSET,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
253 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_min_uses),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
254 NULL },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
255
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
256 { ngx_string("uwsgi_cache_use_stale"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
257 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
258 ngx_conf_set_bitmask_slot,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
259 NGX_HTTP_LOC_CONF_OFFSET,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
260 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_use_stale),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
261 &ngx_http_uwsgi_next_upstream_masks },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
262
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
263 { ngx_string("uwsgi_cache_methods"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
264 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
265 ngx_conf_set_bitmask_slot,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
266 NGX_HTTP_LOC_CONF_OFFSET,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
267 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_methods),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
268 &ngx_http_upstream_cache_method_mask },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
269
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
270 #endif
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
271
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
272 { ngx_string("uwsgi_temp_path"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
273 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
274 ngx_conf_set_path_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
275 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
276 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
277 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
278
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
279 { 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
280 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
281 ngx_conf_set_size_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
282 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
283 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
284 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
285
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
286 { 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
287 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
288 ngx_conf_set_size_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
289 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
290 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
291 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
292
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
293 { ngx_string("uwsgi_next_upstream"),
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_1MORE,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
295 ngx_conf_set_bitmask_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.next_upstream),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
298 &ngx_http_uwsgi_next_upstream_masks },
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_param"),
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_TAKE2,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
302 ngx_conf_set_keyval_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, params_source),
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
307 { ngx_string("uwsgi_string"),
3543
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,
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
309 ngx_conf_set_str_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
310 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
311 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
312 NULL },
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_pass_header"),
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_FLAG,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
316 ngx_conf_set_str_array_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.pass_headers),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
319 NULL },
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_hide_header"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
322 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
323 ngx_conf_set_str_array_slot,
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, upstream.hide_headers),
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
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
328 { ngx_string("uwsgi_ignore_headers"),
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_1MORE,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
330 ngx_conf_set_bitmask_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
331 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
332 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.ignore_headers),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
333 &ngx_http_uwsgi_ignore_headers_masks },
3541
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_null_command
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
336 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
337
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
338
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
339 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
340 NULL, /* preconfiguration */
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
341 NULL, /* postconfiguration */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
342
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
343 NULL, /* create main configuration */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
344 NULL, /* init main configuration */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
345
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
346 NULL, /* create server configuration */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
347 NULL, /* merge server configuration */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
348
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
349 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
350 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
351 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
352
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
353
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
354 ngx_module_t ngx_http_uwsgi_module = {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
355 NGX_MODULE_V1,
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
356 &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
357 ngx_http_uwsgi_commands, /* module directives */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
358 NGX_HTTP_MODULE, /* module type */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
359 NULL, /* init master */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
360 NULL, /* init module */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
361 NULL, /* init process */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
362 NULL, /* init thread */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
363 NULL, /* exit thread */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
364 NULL, /* exit process */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
365 NULL, /* exit master */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
366 NGX_MODULE_V1_PADDING
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
367 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
368
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
369
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
370 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
371 ngx_string("X-Accel-Expires"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
372 ngx_string("X-Accel-Redirect"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
373 ngx_string("X-Accel-Limit-Rate"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
374 ngx_string("X-Accel-Buffering"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
375 ngx_string("X-Accel-Charset"),
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
376 ngx_null_string
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
377 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
378
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
379
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
380 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
381
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
382 static ngx_str_t ngx_http_uwsgi_hide_cache_headers[] = {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
383 ngx_string("X-Accel-Expires"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
384 ngx_string("X-Accel-Redirect"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
385 ngx_string("X-Accel-Limit-Rate"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
386 ngx_string("X-Accel-Buffering"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
387 ngx_string("X-Accel-Charset"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
388 ngx_string("Set-Cookie"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
389 ngx_string("P3P"),
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
390 ngx_null_string
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
391 };
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
392
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
393
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
394 static ngx_keyval_t ngx_http_uwsgi_cache_headers[] = {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
395 { ngx_string("HTTP_IF_MODIFIED_SINCE"), ngx_string("") },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
396 { ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
397 { ngx_string("HTTP_IF_NONE_MATCH"), ngx_string("") },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
398 { ngx_string("HTTP_IF_MATCH"), ngx_string("") },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
399 { ngx_string("HTTP_RANGE"), ngx_string("") },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
400 { ngx_string("HTTP_IF_RANGE"), ngx_string("") },
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
401 { ngx_null_string, ngx_null_string }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
402 };
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
403
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
404 #endif
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
405
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
406
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
407 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
408 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
409 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
410
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
411
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
412 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
413 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
414 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
415 ngx_int_t rc;
3629
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
416 ngx_http_status_t *status;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
417 ngx_http_upstream_t *u;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
418 ngx_http_uwsgi_loc_conf_t *uwcf;
3541
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 if (r->subrequest_in_memory) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
421 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
422 "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
423 "subrequests in memory");
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
424 return NGX_HTTP_INTERNAL_SERVER_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
425 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
426
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
427 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
428 return NGX_HTTP_INTERNAL_SERVER_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
429 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
430
3629
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
431 status = ngx_pcalloc(r->pool, sizeof(ngx_http_status_t));
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
432 if (status == NULL) {
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
3629
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
436 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
437
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
438 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
439
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
440 if (uwcf->uwsgi_lengths) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
441 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
442 return NGX_HTTP_INTERNAL_SERVER_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
443 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
444 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
445
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
446 u = r->upstream;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
447
3545
11c4f3a1e439 use ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents: 3544
diff changeset
448 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
449 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
450
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
451 u->conf = &uwcf->upstream;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
452
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
453 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
454 u->create_key = ngx_http_uwsgi_create_key;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
455 #endif
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
456 u->create_request = ngx_http_uwsgi_create_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
457 u->reinit_request = ngx_http_uwsgi_reinit_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
458 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
459 u->abort_request = ngx_http_uwsgi_abort_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
460 u->finalize_request = ngx_http_uwsgi_finalize_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
461
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
462 u->buffering = 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
463
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
464 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
465 if (u->pipe == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
466 return NGX_HTTP_INTERNAL_SERVER_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
467 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
468
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
469 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
470 u->pipe->input_ctx = r;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
471
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
472 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
473
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
474 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
475 return rc;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
476 }
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 return NGX_DONE;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
479 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
480
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
481
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
482 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
483 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
484 {
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
485 ngx_url_t url;
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
486 ngx_http_upstream_t *u;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
487
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
488 ngx_memzero(&url, sizeof(ngx_url_t));
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
489
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
490 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
491 uwcf->uwsgi_values->elts)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
492 == NULL)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
493 {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
494 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
495 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
496
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
497 url.no_resolve = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
498
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
499 if (ngx_parse_url(r->pool, &url) != NGX_OK) {
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
500 if (url.err) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
501 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
502 "%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
503 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
504
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
505 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
506 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
507
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
508 if (url.no_port) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
509 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
510 "no port in upstream \"%V\"", &url.url);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
511 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
512 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
513
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
514 u = r->upstream;
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
515
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
516 u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t));
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
517 if (u->resolved == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
518 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
519 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
520
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
521 if (url.addrs && url.addrs[0].sockaddr) {
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
522 u->resolved->sockaddr = url.addrs[0].sockaddr;
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
523 u->resolved->socklen = url.addrs[0].socklen;
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
524 u->resolved->naddrs = 1;
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
525 u->resolved->host = url.addrs[0].name;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
526
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
527 } else {
3610
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
528 u->resolved->host = url.host;
edcc271f7c4c change variable names
Igor Sysoev <igor@sysoev.ru>
parents: 3608
diff changeset
529 u->resolved->port = url.port;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
530 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
531
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
532 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
533 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
534
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
535
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
536 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
537
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
538 static ngx_int_t
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
539 ngx_http_uwsgi_create_key(ngx_http_request_t *r)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
540 {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
541 ngx_str_t *key;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
542 ngx_http_uwsgi_loc_conf_t *uwcf;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
543
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
544 key = ngx_array_push(&r->cache->keys);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
545 if (key == NULL) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
546 return NGX_ERROR;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
547 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
548
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
549 uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
550
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
551 if (ngx_http_complex_value(r, &uwcf->cache_key, key) != NGX_OK) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
552 return NGX_ERROR;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
553 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
554
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
555 return NGX_OK;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
556 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
557
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
558 #endif
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
559
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
560
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
561 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
562 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
563 {
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
564 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
565 size_t key_len, val_len, len, allocated;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
566 ngx_uint_t i, n, hash, header_params;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
567 ngx_buf_t *b;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
568 ngx_chain_t *cl, *body;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
569 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
570 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
571 ngx_http_script_code_pt code;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
572 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
573 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
574 ngx_http_script_len_code_pt lcode;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
575
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
576 len = 0;
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
577 header_params = 0;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
578 ignored = NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
579
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
580 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
581
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
582 if (uwcf->params_len) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
583 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
584
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
585 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
586 le.flushed = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
587
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
588 le.ip = uwcf->params_len->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
589 le.request = r;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
590
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
591 while (*(uintptr_t *) le.ip) {
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 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
594 key_len = lcode(&le);
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 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
597 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
598 }
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
599 le.ip += sizeof(uintptr_t);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
600
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
601 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
602 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
603 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
604
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
605 if (uwcf->upstream.pass_request_headers) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
606
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
607 allocated = 0;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
608 lowcase_key = NULL;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
609
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
610 if (uwcf->header_params) {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
611 ignored = ngx_palloc(r->pool, uwcf->header_params * sizeof(void *));
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
612 if (ignored == NULL) {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
613 return NGX_ERROR;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
614 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
615 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
616
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
617 part = &r->headers_in.headers.part;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
618 header = part->elts;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
619
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
620 for (i = 0; /* void */ ; i++) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
621
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
622 if (i >= part->nelts) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
623 if (part->next == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
624 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
625 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
626
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
627 part = part->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
628 header = part->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
629 i = 0;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
630 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
631
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
632 if (uwcf->header_params) {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
633 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
634 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
635 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
636 if (lowcase_key == NULL) {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
637 return NGX_ERROR;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
638 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
639 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
640
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
641 hash = 0;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
642
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
643 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
644 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
645
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
646 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
647 ch |= 0x20;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
648
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
649 } else if (ch == '-') {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
650 ch = '_';
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
651 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
652
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
653 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
654 lowcase_key[n] = ch;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
655 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
656
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
657 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
658 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
659 continue;
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 }
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 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
664 + 2 + header[i].value.len;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
665 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
666 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
667
3555
bc734cf061b0 improve uwsgi_string processing
Igor Sysoev <igor@sysoev.ru>
parents: 3554
diff changeset
668 len += uwcf->uwsgi_string.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
669
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
670 #if 0
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
671 /* allow custom uwsgi packet */
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
672 if (len > 0 && len < 2) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
673 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
674 "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
675 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
676 }
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
677 #endif
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
678
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
679 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
680 if (b == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
681 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
682 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
683
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
684 cl = ngx_alloc_chain_link(r->pool);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
685 if (cl == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
686 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
687 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
688
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
689 cl->buf = b;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
690
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
691 *b->last++ = (u_char) uwcf->modifier1;
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
692 *b->last++ = (u_char) (len & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
693 *b->last++ = (u_char) ((len >> 8) & 0xff);
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
694 *b->last++ = (u_char) uwcf->modifier2;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
695
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
696 if (uwcf->params_len) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
697 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
698
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
699 e.ip = uwcf->params->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
700 e.pos = b->last;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
701 e.request = r;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
702 e.flushed = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
703
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
704 le.ip = uwcf->params_len->elts;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
705
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
706 while (*(uintptr_t *) le.ip) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
707
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
708 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
709 key_len = (u_char) lcode (&le);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
710
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
711 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
712 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
713 }
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
714 le.ip += sizeof(uintptr_t);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
715
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
716 *e.pos++ = (u_char) (key_len & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
717 *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
718
3547
c2da61796410 remove useless copy: key name should be just copied before value length
Igor Sysoev <igor@sysoev.ru>
parents: 3546
diff changeset
719 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
720 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
721
c2da61796410 remove useless copy: key name should be just copied before value length
Igor Sysoev <igor@sysoev.ru>
parents: 3546
diff changeset
722 *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
723 *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
724
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
725 while (*(uintptr_t *) e.ip) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
726 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
727 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
728 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
729
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
730 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
731
3da009cc90f3 add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents: 3556
diff changeset
732 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
733 "uwsgi param: \"%*s: %*s\"",
3da009cc90f3 add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents: 3556
diff changeset
734 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
735 val_len, e.pos - val_len);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
736 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
737
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
738 b->last = e.pos;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
739 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
740
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
741 if (uwcf->upstream.pass_request_headers) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
742
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
743 part = &r->headers_in.headers.part;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
744 header = part->elts;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
745
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
746 for (i = 0; /* void */ ; i++) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
747
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
748 if (i >= part->nelts) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
749 if (part->next == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
750 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
751 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
752
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
753 part = part->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
754 header = part->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
755 i = 0;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
756 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
757
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
758 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
759 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
760 goto next;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
761 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
762 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
763
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
764 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
765 *b->last++ = (u_char) (key_len & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
766 *b->last++ = (u_char) ((key_len >> 8) & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
767
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
768 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
769 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
770 ch = header[i].key.data[n];
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
771
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
772 if (ch >= 'a' && ch <= 'z') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
773 ch &= ~0x20;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
774
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
775 } else if (ch == '-') {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
776 ch = '_';
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
777 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
778
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
779 *b->last++ = ch;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
780 }
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
781
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
782 val_len = header[i].value.len;
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
783 *b->last++ = (u_char) (val_len & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
784 *b->last++ = (u_char) ((val_len >> 8) & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
785 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
786
3da009cc90f3 add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents: 3556
diff changeset
787 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
788 "uwsgi param: \"%*s: %*s\"",
3da009cc90f3 add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents: 3556
diff changeset
789 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
790 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
791 next:
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
792
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
793 continue;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
794 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
795 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
796
3555
bc734cf061b0 improve uwsgi_string processing
Igor Sysoev <igor@sysoev.ru>
parents: 3554
diff changeset
797 b->last = ngx_copy(b->last, uwcf->uwsgi_string.data,
bc734cf061b0 improve uwsgi_string processing
Igor Sysoev <igor@sysoev.ru>
parents: 3554
diff changeset
798 uwcf->uwsgi_string.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
799
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
800 if (uwcf->upstream.pass_request_body) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
801 body = r->upstream->request_bufs;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
802 r->upstream->request_bufs = cl;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
803
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
804 while (body) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
805 b = ngx_alloc_buf(r->pool);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
806 if (b == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
807 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
808 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
809
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
810 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
811
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
812 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
813 if (cl->next == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
814 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
815 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
816
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
817 cl = cl->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
818 cl->buf = b;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
819
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
820 body = body->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
821 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
822
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
823 } else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
824 r->upstream->request_bufs = cl;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
825 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
826
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
827 cl->next = NULL;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
828
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
829 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
830 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
831
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 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
834 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
835 {
3629
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
836 ngx_http_status_t *status;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
837
3629
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
838 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
839
3629
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
840 if (status == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
841 return NGX_OK;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
842 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
843
3629
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
844 status->code = 0;
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
845 status->count = 0;
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
846 status->start = NULL;
a2a3378824ba fix r3628
Igor Sysoev <igor@sysoev.ru>
parents: 3628
diff changeset
847 status->end = NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
848
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
849 r->upstream->process_header = ngx_http_uwsgi_process_status_line;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
850
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
851 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
852 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
853
3623
633ef29c9881 style fix
Igor Sysoev <igor@sysoev.ru>
parents: 3611
diff changeset
854
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
855 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
856 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
857 {
3628
cf47471a9eda make code more obviuos
Igor Sysoev <igor@sysoev.ru>
parents: 3627
diff changeset
858 size_t len;
3623
633ef29c9881 style fix
Igor Sysoev <igor@sysoev.ru>
parents: 3611
diff changeset
859 ngx_int_t rc;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
860 ngx_http_upstream_t *u;
3627
9061fdb2ed8c use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents: 3625
diff changeset
861 ngx_http_status_t *status;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
862
3627
9061fdb2ed8c use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents: 3625
diff changeset
863 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
864
3627
9061fdb2ed8c use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents: 3625
diff changeset
865 if (status == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
866 return NGX_ERROR;
3541
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
3627
9061fdb2ed8c use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents: 3625
diff changeset
869 u = r->upstream;
9061fdb2ed8c use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents: 3625
diff changeset
870
9061fdb2ed8c use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents: 3625
diff changeset
871 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
872
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
873 if (rc == NGX_AGAIN) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
874 return rc;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
875 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
876
3627
9061fdb2ed8c use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents: 3625
diff changeset
877 if (rc == NGX_ERROR) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
878 r->http_version = NGX_HTTP_VERSION_9;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
879
3624
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
880 u->process_header = ngx_http_uwsgi_process_header;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
881
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
882 return ngx_http_uwsgi_process_header(r);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
883 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
884
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
885 if (u->state) {
3627
9061fdb2ed8c use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents: 3625
diff changeset
886 u->state->status = status->code;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
887 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
888
3627
9061fdb2ed8c use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents: 3625
diff changeset
889 u->headers_in.status_n = status->code;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
890
3628
cf47471a9eda make code more obviuos
Igor Sysoev <igor@sysoev.ru>
parents: 3627
diff changeset
891 len = status->end - status->start;
cf47471a9eda make code more obviuos
Igor Sysoev <igor@sysoev.ru>
parents: 3627
diff changeset
892 u->headers_in.status_line.len = len;
cf47471a9eda make code more obviuos
Igor Sysoev <igor@sysoev.ru>
parents: 3627
diff changeset
893
cf47471a9eda make code more obviuos
Igor Sysoev <igor@sysoev.ru>
parents: 3627
diff changeset
894 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
895 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
896 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
897 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
898
3628
cf47471a9eda make code more obviuos
Igor Sysoev <igor@sysoev.ru>
parents: 3627
diff changeset
899 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
900
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
901 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
902 "http uwsgi status %ui \"%V\"",
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
903 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
904
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
905 u->process_header = ngx_http_uwsgi_process_header;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
906
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
907 return ngx_http_uwsgi_process_header(r);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
908 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
909
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 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
912 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
913 {
3624
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
914 ngx_str_t *status_line;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
915 ngx_int_t rc, status;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
916 ngx_table_elt_t *h;
3624
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
917 ngx_http_upstream_t *u;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
918 ngx_http_upstream_header_t *hh;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
919 ngx_http_upstream_main_conf_t *umcf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
920
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
921 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
922
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
923 for ( ;; ) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
924
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
925 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
926
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
927 if (rc == NGX_OK) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
928
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
929 /* a header line has been parsed successfully */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
930
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
931 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
932 if (h == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
933 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
934 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
935
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
936 h->hash = r->header_hash;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
937
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
938 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
939 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
940
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
941 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
942 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
943 + h->key.len);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
944 if (h->key.data == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
945 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
946 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
947
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
948 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
949 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
950
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
951 ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
952 ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
953
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
954 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
955 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
956
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
957 } else {
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
958 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
959 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
960
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
961 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
962 h->lowcase_key, h->key.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
963
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
964 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
965 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
966 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
967
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
968 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
969 "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
970
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
971 continue;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
972 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
973
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
974 if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
975
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
976 /* a whole header has been parsed successfully */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
977
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
978 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
979 "http uwsgi header done");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
980
3624
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
981 if (r->http_version > NGX_HTTP_VERSION_9) {
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
982 return NGX_OK;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
983 }
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
984
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
985 u = r->upstream;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
986
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
987 if (u->headers_in.status) {
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
988 status_line = &u->headers_in.status->value;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
989
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
990 status = ngx_atoi(status_line->data, 3);
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
991 if (status == NGX_ERROR) {
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
992 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
993 "upstream sent invalid status \"%V\"",
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
994 status_line);
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
995 return NGX_HTTP_UPSTREAM_INVALID_HEADER;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
996 }
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
997
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
998 r->http_version = NGX_HTTP_VERSION_10;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
999 u->headers_in.status_n = status;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1000 u->headers_in.status_line = *status_line;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1001
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1002 } else if (u->headers_in.location) {
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1003 r->http_version = NGX_HTTP_VERSION_10;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1004 u->headers_in.status_n = 302;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1005 ngx_str_set(&u->headers_in.status_line,
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1006 "302 Moved Temporarily");
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1007
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1008 } else {
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1009 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1010 "upstream sent neither valid HTTP/1.0 header "
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1011 "nor \"Status\" header line");
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1012 u->headers_in.status_n = 200;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1013 ngx_str_set(&u->headers_in.status_line, "200 OK");
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1014 }
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1015
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1016 if (u->state) {
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1017 u->state->status = u->headers_in.status_n;
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1018 }
3b7e8fa31a00 support CGI-style response
Igor Sysoev <igor@sysoev.ru>
parents: 3623
diff changeset
1019
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1020 return NGX_OK;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1021 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1022
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1023 if (rc == NGX_AGAIN) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1024 return NGX_AGAIN;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1025 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1026
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1027 /* 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
1028
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1029 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
1030 "upstream sent invalid header");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1031
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1032 return NGX_HTTP_UPSTREAM_INVALID_HEADER;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1033 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1034 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1035
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1036
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1037 static void
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1038 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
1039 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1040 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
1041 "abort http uwsgi request");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1042
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1043 return;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1044 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1045
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1046
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1047 static void
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1048 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
1049 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1050 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
1051 "finalize http uwsgi request");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1052
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1053 return;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1054 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1055
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1056
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1057 static void *
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1058 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
1059 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1060 ngx_http_uwsgi_loc_conf_t *conf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1061
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1062 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
1063 if (conf == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1064 return NULL;
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
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
1067 conf->modifier1 = NGX_CONF_UNSET_UINT;
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
1068 conf->modifier2 = NGX_CONF_UNSET_UINT;
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
1069
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1070 conf->upstream.store = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1071 conf->upstream.store_access = NGX_CONF_UNSET_UINT;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1072 conf->upstream.buffering = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1073 conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
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 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1076 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1077 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
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 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1080 conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1081
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1082 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
1083 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
1084 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
1085
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1086 conf->upstream.pass_request_headers = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1087 conf->upstream.pass_request_body = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1088
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1089 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1090 conf->upstream.cache = NGX_CONF_UNSET_PTR;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1091 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1092 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1093 #endif
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1094
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1095 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1096 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
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 conf->upstream.intercept_errors = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1099
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1100 /* "uwsgi_cyclic_temp_file" is disabled */
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1101 conf->upstream.cyclic_temp_file = 0;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1102
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1103 return conf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1104 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1105
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 static char *
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1108 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
1109 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1110 ngx_http_uwsgi_loc_conf_t *prev = parent;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1111 ngx_http_uwsgi_loc_conf_t *conf = child;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1112
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1113 u_char *p;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1114 size_t size;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1115 uintptr_t *code;
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1116 ngx_str_t *hide;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1117 ngx_uint_t i;
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1118 ngx_array_t headers_names;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1119 ngx_keyval_t *src;
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1120 ngx_hash_key_t *hk;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1121 ngx_hash_init_t hash;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1122 ngx_http_script_compile_t sc;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1123 ngx_http_script_copy_code_t *copy;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1124
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1125 if (conf->upstream.store != 0) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1126 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
1127
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1128 if (conf->upstream.store_lengths == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1129 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
1130 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
1131 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1132 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1133
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1134 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
1135 prev->upstream.store_access, 0600);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1136
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1137 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
1138 prev->upstream.buffering, 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1139
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1140 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
1141 prev->upstream.ignore_client_abort, 0);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1142
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1143 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
1144 prev->upstream.connect_timeout, 60000);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1145
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1146 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
1147 prev->upstream.send_timeout, 60000);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1148
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1149 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
1150 prev->upstream.read_timeout, 60000);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1151
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1152 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
1153 prev->upstream.send_lowat, 0);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1154
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1155 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
1156 prev->upstream.buffer_size,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1157 (size_t) ngx_pagesize);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1158
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1159
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1160 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
1161 8, ngx_pagesize);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1162
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1163 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
1164 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
1165 "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
1166 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1167 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1168
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1169
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1170 size = conf->upstream.buffer_size;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1171 if (size < conf->upstream.bufs.size) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1172 size = conf->upstream.bufs.size;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1173 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1174
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1175
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1176 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
1177 prev->upstream.busy_buffers_size_conf,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1178 NGX_CONF_UNSET_SIZE);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1179
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1180 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
1181 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
1182 } else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1183 conf->upstream.busy_buffers_size =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1184 conf->upstream.busy_buffers_size_conf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1185 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1186
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1187 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
1188 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
1189 "\"uwsgi_busy_buffers_size\" must be equal or bigger "
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1190 "than maximum of the value of \"uwsgi_buffer_size\" and "
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1191 "one of the \"uwsgi_buffers\"");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1192
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1193 return NGX_CONF_ERROR;
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1196 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
1197 > (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
1198 {
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1199 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
1200 "\"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
1201 "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
1202
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1203 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1204 }
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
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1207 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
1208 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
1209 NGX_CONF_UNSET_SIZE);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1210
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1211 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
1212 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
1213 } else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1214 conf->upstream.temp_file_write_size =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1215 conf->upstream.temp_file_write_size_conf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1216 }
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 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
1219 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
1220 "\"uwsgi_temp_file_write_size\" must be equal or bigger than "
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1221 "maximum of the value of \"uwsgi_buffer_size\" and "
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1222 "one of the \"uwsgi_buffers\"");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1223
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1224 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1225 }
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
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1228 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
1229 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
1230 NGX_CONF_UNSET_SIZE);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1231
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1232 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
1233 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
1234 } else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1235 conf->upstream.max_temp_file_size =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1236 conf->upstream.max_temp_file_size_conf;
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1239 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
1240 && 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
1241 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
1242 "\"uwsgi_max_temp_file_size\" must be equal to zero to disable "
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1243 "the temporary files usage or must be equal or bigger than "
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1244 "maximum of the value of \"uwsgi_buffer_size\" and "
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1245 "one of the \"uwsgi_buffers\"");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1246
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1247 return NGX_CONF_ERROR;
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
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1251 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
1252 prev->upstream.ignore_headers,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1253 NGX_CONF_BITMASK_SET);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1254
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1255
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1256 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
1257 prev->upstream.next_upstream,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1258 (NGX_CONF_BITMASK_SET
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1259 |NGX_HTTP_UPSTREAM_FT_ERROR
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1260 |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1261
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1262 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
1263 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
1264 |NGX_HTTP_UPSTREAM_FT_OFF;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1265 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1266
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1267 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
1268 prev->upstream.temp_path,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1269 &ngx_http_uwsgi_temp_path)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1270 != NGX_OK)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1271 {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1272 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1273 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1274
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1275 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1276
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1277 ngx_conf_merge_ptr_value(conf->upstream.cache,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1278 prev->upstream.cache, NULL);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1279
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1280 if (conf->upstream.cache && conf->upstream.cache->data == NULL) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1281 ngx_shm_zone_t *shm_zone;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1282
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1283 shm_zone = conf->upstream.cache;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1284
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1285 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1286 "\"uwsgi_cache\" zone \"%V\" is unknown",
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1287 &shm_zone->shm.name);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1288
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1289 return NGX_CONF_ERROR;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1290 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1291
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1292 ngx_conf_merge_uint_value(conf->upstream.cache_min_uses,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1293 prev->upstream.cache_min_uses, 1);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1294
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1295 ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1296 prev->upstream.cache_use_stale,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1297 (NGX_CONF_BITMASK_SET
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1298 |NGX_HTTP_UPSTREAM_FT_OFF));
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1299
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1300 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1301 conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1302 |NGX_HTTP_UPSTREAM_FT_OFF;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1303 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1304
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1305 if (conf->upstream.cache_methods == 0) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1306 conf->upstream.cache_methods = prev->upstream.cache_methods;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1307 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1308
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1309 conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1310
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1311 ngx_conf_merge_ptr_value(conf->upstream.no_cache,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1312 prev->upstream.no_cache, NULL);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1313
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1314 ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1315 prev->upstream.cache_valid, NULL);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1316
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1317 if (conf->cache_key.value.data == NULL) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1318 conf->cache_key = prev->cache_key;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1319 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1320
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1321 #endif
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1322
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1323 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
1324 prev->upstream.pass_request_headers, 1);
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1325 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
1326 prev->upstream.pass_request_body, 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1327
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1328 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
1329 prev->upstream.intercept_errors, 0);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1330
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1331 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
1332
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1333 hash.max_size = 512;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1334 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
1335 hash.name = "uwsgi_hide_headers_hash";
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1336
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1337 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1338
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1339 hide = conf->upstream.cache ? ngx_http_uwsgi_hide_cache_headers:
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1340 ngx_http_uwsgi_hide_headers;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1341 #else
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1342
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1343 hide = ngx_http_uwsgi_hide_headers;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1344
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1345 #endif
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1346
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1347 if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1348 &prev->upstream, hide, &hash)
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1349 != NGX_OK)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1350 {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1351 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1352 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1353
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1354 if (conf->upstream.upstream == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1355 conf->upstream.upstream = prev->upstream.upstream;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1356 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1357
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1358 if (conf->uwsgi_lengths == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1359 conf->uwsgi_lengths = prev->uwsgi_lengths;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1360 conf->uwsgi_values = prev->uwsgi_values;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1361 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1362
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
1363 ngx_conf_merge_uint_value(conf->modifier1, prev->modifier1, 0);
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
1364 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
1365
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1366 if (conf->params_source == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1367 conf->flushes = prev->flushes;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1368 conf->params_len = prev->params_len;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1369 conf->params = prev->params;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1370 conf->params_source = prev->params_source;
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1371 conf->headers_hash = prev->headers_hash;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1372
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1373 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1374
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1375 if (conf->params_source == NULL) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1376
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1377 if ((conf->upstream.cache == NULL)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1378 == (prev->upstream.cache == NULL))
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1379 {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1380 return NGX_CONF_OK;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1381 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1382
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1383 /* 6 is a number of ngx_http_uwsgi_cache_headers entries */
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1384 conf->params_source = ngx_array_create(cf->pool, 6,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1385 sizeof(ngx_keyval_t));
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1386 if (conf->params_source == NULL) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1387 return NGX_CONF_ERROR;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1388 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1389 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1390 #else
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1391
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1392 if (conf->params_source == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1393 return NGX_CONF_OK;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1394 }
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1395
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1396 #endif
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1397 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1398
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1399 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
1400 if (conf->params_len == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1401 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1402 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1403
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1404 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
1405 if (conf->params == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1406 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1407 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1408
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1409 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
1410 != NGX_OK)
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1411 {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1412 return NGX_CONF_ERROR;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1413 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1414
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1415 src = conf->params_source->elts;
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1416
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1417 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1418
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1419 if (conf->upstream.cache) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1420 ngx_keyval_t *h, *s;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1421
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1422 for (h = ngx_http_uwsgi_cache_headers; h->key.len; h++) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1423
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1424 for (i = 0; i < conf->params_source->nelts; i++) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1425 if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1426 goto next;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1427 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1428 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1429
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1430 s = ngx_array_push(conf->params_source);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1431 if (s == NULL) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1432 return NGX_CONF_ERROR;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1433 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1434
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1435 *s = *h;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1436
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1437 src = conf->params_source->elts;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1438
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1439 next:
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1440
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1441 h++;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1442 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1443 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1444
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1445 #endif
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1446
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1447 for (i = 0; i < conf->params_source->nelts; i++) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1448
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1449 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
1450 && 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
1451 {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1452 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
1453 if (hk == NULL) {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1454 return NGX_CONF_ERROR;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1455 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1456
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1457 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
1458 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
1459 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
1460 hk->value = (void *) 1;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1461
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1462 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
1463 continue;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1464 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1465 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1466
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1467 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
1468 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
1469 if (copy == NULL) {
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1470 return NGX_CONF_ERROR;
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1471 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1472
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1473 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
1474 copy->len = src[i].key.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1475
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1476
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1477 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
1478 + 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
1479 & ~(sizeof(uintptr_t) - 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1480
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1481 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
1482 if (copy == NULL) {
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1483 return NGX_CONF_ERROR;
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1484 }
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1485
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1486 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
1487 copy->len = src[i].key.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1488
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1489 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
1490 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
1491
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1492
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1493 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
1494
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1495 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
1496 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
1497 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
1498 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
1499 sc.values = &conf->params;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1500
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1501 if (ngx_http_script_compile(&sc) != NGX_OK) {
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1502 return NGX_CONF_ERROR;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1503 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1504
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1505 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
1506 if (code == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1507 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1508 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1509
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1510 *code = (uintptr_t) NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1511
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1512
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1513 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
1514 if (code == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1515 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1516 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1517
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1518 *code = (uintptr_t) NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1519 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1520
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1521 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
1522 if (code == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1523 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1524 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1525
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1526 *code = (uintptr_t) NULL;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1527
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1528 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
1529
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1530 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
1531 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
1532 hash.max_size = 512;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1533 hash.bucket_size = 64;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1534 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
1535 hash.pool = cf->pool;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1536 hash.temp_pool = NULL;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1537
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1538 if (ngx_hash_init(&hash, headers_names.elts, headers_names.nelts) != NGX_OK)
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1539 {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1540 return NGX_CONF_ERROR;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1541 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1542
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1543 return NGX_CONF_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1544 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1545
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1546
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1547 static char *
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1548 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
1549 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1550 ngx_http_uwsgi_loc_conf_t *uwcf = conf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1551
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1552 ngx_url_t u;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1553 ngx_str_t *value, *url;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1554 ngx_uint_t n;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1555 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
1556 ngx_http_script_compile_t sc;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1557
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1558 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
1559 return "is duplicate";
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1560 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1561
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1562 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
1563 clcf->handler = ngx_http_uwsgi_handler;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1564
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1565 value = cf->args->elts;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1566
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1567 url = &value[1];
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1568
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1569 n = ngx_http_script_variables_count(url);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1570
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1571 if (n) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1572
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1573 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
1574
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1575 sc.cf = cf;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1576 sc.source = url;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1577 sc.lengths = &uwcf->uwsgi_lengths;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1578 sc.values = &uwcf->uwsgi_values;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1579 sc.variables = n;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1580 sc.complete_lengths = 1;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1581 sc.complete_values = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1582
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1583 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
1584 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1585 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1586
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1587 return NGX_CONF_OK;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1588 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1589
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1590 ngx_memzero(&u, sizeof(ngx_url_t));
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1591
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1592 u.url = value[1];
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1593 u.no_resolve = 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1594
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1595 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
1596 if (uwcf->upstream.upstream == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1597 return NGX_CONF_ERROR;
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1600 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
1601 clcf->auto_redirect = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1602 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1603
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1604 return NGX_CONF_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1605 }
3565
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1606
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1607
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1608 static char *
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1609 ngx_http_uwsgi_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1610 {
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1611 ngx_http_uwsgi_loc_conf_t *uwcf = conf;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1612
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1613 ngx_str_t *value;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1614 ngx_http_script_compile_t sc;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1615
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1616 if (uwcf->upstream.store != NGX_CONF_UNSET || uwcf->upstream.store_lengths)
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1617 {
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1618 return "is duplicate";
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1619 }
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1620
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1621 value = cf->args->elts;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1622
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1623 if (ngx_strcmp(value[1].data, "off") == 0) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1624 uwcf->upstream.store = 0;
3565
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1625 return NGX_CONF_OK;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1626 }
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1627
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1628 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1629
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1630 if (uwcf->upstream.cache != NGX_CONF_UNSET_PTR
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1631 && uwcf->upstream.cache != NULL)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1632 {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1633 return "is incompatible with \"uwsgi_cache\"";
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1634 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1635
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1636 #endif
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1637
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1638 if (ngx_strcmp(value[1].data, "on") == 0) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1639 uwcf->upstream.store = 1;
3565
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1640 return NGX_CONF_OK;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1641 }
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1642
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1643 /* include the terminating '\0' into script */
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1644 value[1].len++;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1645
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1646 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1647
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1648 sc.cf = cf;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1649 sc.source = &value[1];
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1650 sc.lengths = &uwcf->upstream.store_lengths;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1651 sc.values = &uwcf->upstream.store_values;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1652 sc.variables = ngx_http_script_variables_count(&value[1]);;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1653 sc.complete_lengths = 1;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1654 sc.complete_values = 1;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1655
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1656 if (ngx_http_script_compile(&sc) != NGX_OK) {
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1657 return NGX_CONF_ERROR;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1658 }
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1659
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1660 return NGX_CONF_OK;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1661 }
3568
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1662
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1663
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1664 #if (NGX_HTTP_CACHE)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1665
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1666 static char *
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1667 ngx_http_uwsgi_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1668 {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1669 ngx_http_uwsgi_loc_conf_t *uwcf = conf;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1670
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1671 ngx_str_t *value;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1672
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1673 value = cf->args->elts;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1674
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1675 if (uwcf->upstream.cache != NGX_CONF_UNSET_PTR) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1676 return "is duplicate";
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1677 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1678
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1679 if (ngx_strcmp(value[1].data, "off") == 0) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1680 uwcf->upstream.cache = NULL;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1681 return NGX_CONF_OK;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1682 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1683
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1684 if (uwcf->upstream.store > 0 || uwcf->upstream.store_lengths) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1685 return "is incompatible with \"uwsgi_store\"";
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1686 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1687
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1688 uwcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1689 &ngx_http_uwsgi_module);
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1690 if (uwcf->upstream.cache == NULL) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1691 return NGX_CONF_ERROR;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1692 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1693
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1694 return NGX_CONF_OK;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1695 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1696
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1697
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1698 static char *
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1699 ngx_http_uwsgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1700 {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1701 ngx_http_uwsgi_loc_conf_t *uwcf = conf;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1702
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1703 ngx_str_t *value;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1704 ngx_http_compile_complex_value_t ccv;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1705
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1706 value = cf->args->elts;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1707
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1708 if (uwcf->cache_key.value.len) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1709 return "is duplicate";
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1710 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1711
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1712 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1713
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1714 ccv.cf = cf;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1715 ccv.value = &value[1];
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1716 ccv.complex_value = &uwcf->cache_key;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1717
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1718 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1719 return NGX_CONF_ERROR;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1720 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1721
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1722 return NGX_CONF_OK;
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1723 }
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1724
7cfbc51bac01 uwsgi cache
Igor Sysoev <igor@sysoev.ru>
parents: 3567
diff changeset
1725 #endif