annotate src/http/modules/ngx_http_uwsgi_module.c @ 3566:b81d44244cb1

allow uwsgi_param to override client headers using HTTP_ parameters
author Igor Sysoev <igor@sysoev.ru>
date Fri, 04 Jun 2010 12:26:27 +0000
parents 1e86f0ac9a44
children 9bbfce117cfb
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
3550
9f715c9e5b82 style fix
Igor Sysoev <igor@sysoev.ru>
parents: 3549
diff changeset
28 ngx_str_t uwsgi_string;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
30 ngx_uint_t modifier1;
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
31 ngx_uint_t modifier2;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
32 } ngx_http_uwsgi_loc_conf_t;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
33
3556
b9415935d95d style fix
Igor Sysoev <igor@sysoev.ru>
parents: 3555
diff changeset
34
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
35 typedef struct {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
36 ngx_uint_t status;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
37 ngx_uint_t status_count;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
38 u_char *status_start;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
39 u_char *status_end;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
40 } ngx_http_uwsgi_ctx_t;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
41
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
42
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
43 #define NGX_HTTP_UWSGI_PARSE_NO_HEADER 20
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
44
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
45
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
46 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
47 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
48 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
49 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
50 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
51 static ngx_int_t ngx_http_uwsgi_parse_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
52 ngx_http_uwsgi_ctx_t *ctx);
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
53 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
54 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
55 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
56 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
57 ngx_int_t rc);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
58
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
59 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
60 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
61 void *child);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
62
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
63 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
64 void *conf);
3565
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
65 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
66 void *conf);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
67
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
68
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
69 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
70 ngx_conf_check_num_bounds, 0, 255
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
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
73
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
74 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
75 { 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
76 { 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
77 { 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
78 { 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
79 { 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
80 { 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
81 { 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
82 { 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
83 { ngx_null_string, 0 }
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
87 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
88 { 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
89 { 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
90 { 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
91 { 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
92 { ngx_null_string, 0 }
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
95
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
96 static ngx_command_t ngx_http_uwsgi_commands[] = {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
97
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
98 { ngx_string("uwsgi_pass"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
99 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
100 ngx_http_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_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
102 0,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
103 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
104
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
105 { ngx_string("uwsgi_modifier1"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
106 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
107 ngx_conf_set_num_slot,
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
108 NGX_HTTP_LOC_CONF_OFFSET,
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
109 offsetof(ngx_http_uwsgi_loc_conf_t, modifier1),
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
110 &ngx_http_uwsgi_modifier_bounds },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
111
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
112 { ngx_string("uwsgi_modifier2"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
113 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
114 ngx_conf_set_num_slot,
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
115 NGX_HTTP_LOC_CONF_OFFSET,
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
116 offsetof(ngx_http_uwsgi_loc_conf_t, modifier2),
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
117 &ngx_http_uwsgi_modifier_bounds },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
118
3565
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
119 { ngx_string("uwsgi_store"),
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
120 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
121 ngx_http_uwsgi_store,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
122 NGX_HTTP_LOC_CONF_OFFSET,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
123 0,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
124 NULL },
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
125
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
126 { ngx_string("uwsgi_store_access"),
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
127 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
128 ngx_conf_set_access_slot,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
129 NGX_HTTP_LOC_CONF_OFFSET,
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
130 offsetof(ngx_http_uwsgi_loc_conf_t, upstream.store_access),
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
131 NULL },
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
132
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
133 { ngx_string("uwsgi_ignore_client_abort"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
134 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
135 ngx_conf_set_flag_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
136 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
137 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
138 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
139
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
140 { ngx_string("uwsgi_connect_timeout"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
141 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
142 ngx_conf_set_msec_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
143 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
144 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
145 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
146
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
147 { ngx_string("uwsgi_send_timeout"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
148 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
149 ngx_conf_set_msec_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
150 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
151 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
152 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
153
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
154 { ngx_string("uwsgi_buffer_size"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
155 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
156 ngx_conf_set_size_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
157 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
158 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
159 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
160
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
161 { ngx_string("uwsgi_pass_request_headers"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
162 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
163 ngx_conf_set_flag_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
164 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
165 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
166 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
167
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
168 { ngx_string("uwsgi_pass_request_body"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
169 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
170 ngx_conf_set_flag_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
171 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
172 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
173 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
174
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
175 { ngx_string("uwsgi_intercept_errors"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
176 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
177 ngx_conf_set_flag_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
178 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
179 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
180 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
181
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
182 { ngx_string("uwsgi_read_timeout"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
183 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
184 ngx_conf_set_msec_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
185 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
186 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
187 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
188
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
189 { ngx_string("uwsgi_buffers"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
190 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
191 ngx_conf_set_bufs_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
192 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
193 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
194 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
195
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
196 { ngx_string("uwsgi_busy_buffers_size"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
197 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
198 ngx_conf_set_size_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
199 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
200 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
201 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
202
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
203 { ngx_string("uwsgi_temp_path"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
204 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
205 ngx_conf_set_path_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
206 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
207 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
208 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
209
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
210 { 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
211 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
212 ngx_conf_set_size_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
213 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
214 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
215 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
216
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
217 { 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
218 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
219 ngx_conf_set_size_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
220 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
221 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
222 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
223
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
224 { ngx_string("uwsgi_next_upstream"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
225 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
226 ngx_conf_set_bitmask_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
227 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
228 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
229 &ngx_http_uwsgi_next_upstream_masks },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
230
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
231 { ngx_string("uwsgi_param"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
232 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
233 ngx_conf_set_keyval_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
234 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
235 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
236 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
237
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
238 { ngx_string("uwsgi_string"),
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
239 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
240 ngx_conf_set_str_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
241 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
242 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
243 NULL },
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
244
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
245 { ngx_string("uwsgi_pass_header"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
246 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
247 ngx_conf_set_str_array_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
248 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
249 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
250 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
251
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
252 { ngx_string("uwsgi_hide_header"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
253 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
254 ngx_conf_set_str_array_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
255 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
256 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
257 NULL },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
258
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
259 { ngx_string("uwsgi_ignore_headers"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
260 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
261 ngx_conf_set_bitmask_slot,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
262 NGX_HTTP_LOC_CONF_OFFSET,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
263 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
264 &ngx_http_uwsgi_ignore_headers_masks },
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
265
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
266 ngx_null_command
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
267 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
268
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
269
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
270 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
271 NULL, /* preconfiguration */
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
272 NULL, /* postconfiguration */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
273
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
274 NULL, /* create main configuration */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
275 NULL, /* init main configuration */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
276
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
277 NULL, /* create server configuration */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
278 NULL, /* merge server configuration */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
279
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
280 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
281 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
282 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
283
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
284
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
285 ngx_module_t ngx_http_uwsgi_module = {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
286 NGX_MODULE_V1,
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
287 &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
288 ngx_http_uwsgi_commands, /* module directives */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
289 NGX_HTTP_MODULE, /* module type */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
290 NULL, /* init master */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
291 NULL, /* init module */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
292 NULL, /* init process */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
293 NULL, /* init thread */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
294 NULL, /* exit thread */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
295 NULL, /* exit process */
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
296 NULL, /* exit master */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
297 NGX_MODULE_V1_PADDING
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
298 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
299
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
300
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
301 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
302 ngx_string("Status"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
303 ngx_string("X-Accel-Expires"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
304 ngx_string("X-Accel-Redirect"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
305 ngx_string("X-Accel-Limit-Rate"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
306 ngx_string("X-Accel-Buffering"),
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
307 ngx_string("X-Accel-Charset"),
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
308 ngx_null_string
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
309 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
310
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
311
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
312 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
313 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
314 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
315
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
316
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
317 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
318 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
319 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
320 ngx_int_t rc;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
321 ngx_http_upstream_t *u;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
322 ngx_http_uwsgi_ctx_t *ctx;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
323 ngx_http_uwsgi_loc_conf_t *uwcf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
324
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
325 if (r->subrequest_in_memory) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
326 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
327 "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
328 "subrequests in memory");
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
329 return NGX_HTTP_INTERNAL_SERVER_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
330 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
331
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
332 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
333 return NGX_HTTP_INTERNAL_SERVER_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
334 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
335
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
336 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_uwsgi_ctx_t));
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
337 if (ctx == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
338 return NGX_HTTP_INTERNAL_SERVER_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
339 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
340
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
341 ngx_http_set_ctx(r, ctx, ngx_http_uwsgi_module);
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 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
344
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
345 if (uwcf->uwsgi_lengths) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
346 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
347 return NGX_HTTP_INTERNAL_SERVER_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
348 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
349 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
350
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
351 u = r->upstream;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
352
3545
11c4f3a1e439 use ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents: 3544
diff changeset
353 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
354 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
355
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
356 u->conf = &uwcf->upstream;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
357
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
358 u->create_request = ngx_http_uwsgi_create_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
359 u->reinit_request = ngx_http_uwsgi_reinit_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
360 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
361 u->abort_request = ngx_http_uwsgi_abort_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
362 u->finalize_request = ngx_http_uwsgi_finalize_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
363
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
364 u->buffering = 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
365
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
366 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
367 if (u->pipe == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
368 return NGX_HTTP_INTERNAL_SERVER_ERROR;
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
371 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
372 u->pipe->input_ctx = r;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
373
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
374 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
375
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
376 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
377 return rc;
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
380 return NGX_DONE;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
381 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
382
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
383
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
384 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
385 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
386 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
387 ngx_url_t u;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
388
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
389 ngx_memzero(&u, sizeof(ngx_url_t));
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
390
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
391 if (ngx_http_script_run(r, &u.url, uwcf->uwsgi_lengths->elts, 0,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
392 uwcf->uwsgi_values->elts)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
393 == NULL)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
394 {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
395 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
396 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
397
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
398 u.no_resolve = 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
399
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
400 if (ngx_parse_url(r->pool, &u) != NGX_OK) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
401 if (u.err) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
402 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
403 "%s in upstream \"%V\"", u.err, &u.url);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
404 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
405
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
406 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
407 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
408
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
409 if (u.no_port) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
410 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
411 "no port in upstream \"%V\"", &u.url);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
412 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
413 }
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 r->upstream->resolved = ngx_pcalloc(r->pool,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
416 sizeof(ngx_http_upstream_resolved_t));
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
417 if (r->upstream->resolved == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
418 return NGX_ERROR;
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
421 if (u.addrs && u.addrs[0].sockaddr) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
422 r->upstream->resolved->sockaddr = u.addrs[0].sockaddr;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
423 r->upstream->resolved->socklen = u.addrs[0].socklen;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
424 r->upstream->resolved->naddrs = 1;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
425 r->upstream->resolved->host = u.addrs[0].name;
3541
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 } else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
428 r->upstream->resolved->host = u.host;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
429 r->upstream->resolved->port = u.port;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
430 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
431
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
432 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
433 }
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
436 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
437 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
438 {
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
439 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
440 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
441 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
442 ngx_buf_t *b;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
443 ngx_chain_t *cl, *body;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
444 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
445 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
446 ngx_http_script_code_pt code;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
447 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
448 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
449 ngx_http_script_len_code_pt lcode;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
450
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
451 len = 0;
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
452 header_params = 0;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
453 ignored = NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
454
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
455 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
456
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
457 if (uwcf->params_len) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
458 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
459
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
460 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
461 le.flushed = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
462
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
463 le.ip = uwcf->params_len->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
464 le.request = r;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
465
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
466 while (*(uintptr_t *) le.ip) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
467
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
468 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
469 key_len = lcode(&le);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
470
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
471 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
472 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
473 }
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
474 le.ip += sizeof(uintptr_t);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
475
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
476 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
477 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
478 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
479
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
480 if (uwcf->upstream.pass_request_headers) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
481
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
482 allocated = 0;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
483 lowcase_key = NULL;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
484
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
485 if (uwcf->header_params) {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
486 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
487 if (ignored == NULL) {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
488 return NGX_ERROR;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
489 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
490 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
491
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
492 part = &r->headers_in.headers.part;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
493 header = part->elts;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
494
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
495 for (i = 0; /* void */ ; i++) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
496
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
497 if (i >= part->nelts) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
498 if (part->next == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
499 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
500 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
501
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
502 part = part->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
503 header = part->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
504 i = 0;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
505 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
506
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
507 if (uwcf->header_params) {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
508 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
509 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
510 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
511 if (lowcase_key == NULL) {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
512 return NGX_ERROR;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
513 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
514 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
515
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
516 hash = 0;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
517
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
518 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
519 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
520
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
521 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
522 ch |= 0x20;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
523
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
524 } else if (ch == '-') {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
525 ch = '_';
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
526 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
527
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
528 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
529 lowcase_key[n] = ch;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
530 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
531
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
532 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
533 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
534 continue;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
535 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
536 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
537
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
538 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
539 + 2 + header[i].value.len;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
540 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
541 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
542
3555
bc734cf061b0 improve uwsgi_string processing
Igor Sysoev <igor@sysoev.ru>
parents: 3554
diff changeset
543 len += uwcf->uwsgi_string.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
544
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
545 #if 0
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
546 /* allow custom uwsgi packet */
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
547 if (len > 0 && len < 2) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
548 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
549 "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
550 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
551 }
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
552 #endif
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
553
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
554 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
555 if (b == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
556 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
557 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
558
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
559 cl = ngx_alloc_chain_link(r->pool);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
560 if (cl == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
561 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
562 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
563
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
564 cl->buf = b;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
565
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
566 *b->last++ = (u_char) uwcf->modifier1;
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
567 *b->last++ = (u_char) (len & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
568 *b->last++ = (u_char) ((len >> 8) & 0xff);
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
569 *b->last++ = (u_char) uwcf->modifier2;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
570
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
571 if (uwcf->params_len) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
572 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
573
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
574 e.ip = uwcf->params->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
575 e.pos = b->last;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
576 e.request = r;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
577 e.flushed = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
578
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
579 le.ip = uwcf->params_len->elts;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
580
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
581 while (*(uintptr_t *) le.ip) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
582
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
583 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
584 key_len = (u_char) lcode (&le);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
585
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
586 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
587 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
588 }
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
589 le.ip += sizeof(uintptr_t);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
590
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
591 *e.pos++ = (u_char) (key_len & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
592 *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
593
3547
c2da61796410 remove useless copy: key name should be just copied before value length
Igor Sysoev <igor@sysoev.ru>
parents: 3546
diff changeset
594 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
595 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
596
c2da61796410 remove useless copy: key name should be just copied before value length
Igor Sysoev <igor@sysoev.ru>
parents: 3546
diff changeset
597 *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
598 *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
599
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
600 while (*(uintptr_t *) e.ip) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
601 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
602 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
603 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
604
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
605 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
606
3da009cc90f3 add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents: 3556
diff changeset
607 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
608 "uwsgi param: \"%*s: %*s\"",
3da009cc90f3 add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents: 3556
diff changeset
609 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
610 val_len, e.pos - val_len);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
611 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
612
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
613 b->last = e.pos;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
614 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
615
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
616 if (uwcf->upstream.pass_request_headers) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
617
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
618 part = &r->headers_in.headers.part;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
619 header = part->elts;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
620
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
621 for (i = 0; /* void */ ; i++) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
622
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
623 if (i >= part->nelts) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
624 if (part->next == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
625 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
626 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
627
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
628 part = part->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
629 header = part->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
630 i = 0;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
631 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
632
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
633 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
634 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
635 goto next;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
636 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
637 }
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 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
640 *b->last++ = (u_char) (key_len & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
641 *b->last++ = (u_char) ((key_len >> 8) & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
642
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
643 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
644 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
645 ch = header[i].key.data[n];
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
646
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
647 if (ch >= 'a' && ch <= 'z') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
648 ch &= ~0x20;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
649
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
650 } else if (ch == '-') {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
651 ch = '_';
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
652 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
653
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
654 *b->last++ = ch;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
655 }
3546
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
656
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
657 val_len = header[i].value.len;
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
658 *b->last++ = (u_char) (val_len & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
659 *b->last++ = (u_char) ((val_len >> 8) & 0xff);
3a9fca8cbdfc simplify binary little endian length processing
Igor Sysoev <igor@sysoev.ru>
parents: 3545
diff changeset
660 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
661
3da009cc90f3 add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents: 3556
diff changeset
662 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
663 "uwsgi param: \"%*s: %*s\"",
3da009cc90f3 add uwsgi_param and client request headers debug logging
Igor Sysoev <igor@sysoev.ru>
parents: 3556
diff changeset
664 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
665 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
666 next:
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
667
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
668 continue;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
669 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
670 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
671
3555
bc734cf061b0 improve uwsgi_string processing
Igor Sysoev <igor@sysoev.ru>
parents: 3554
diff changeset
672 b->last = ngx_copy(b->last, uwcf->uwsgi_string.data,
bc734cf061b0 improve uwsgi_string processing
Igor Sysoev <igor@sysoev.ru>
parents: 3554
diff changeset
673 uwcf->uwsgi_string.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
674
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
675 if (uwcf->upstream.pass_request_body) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
676 body = r->upstream->request_bufs;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
677 r->upstream->request_bufs = cl;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
678
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
679 while (body) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
680 b = ngx_alloc_buf(r->pool);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
681 if (b == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
682 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
683 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
684
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
685 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
686
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
687 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
688 if (cl->next == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
689 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
690 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
691
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
692 cl = cl->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
693 cl->buf = b;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
694
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
695 body = body->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
696 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
697
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
698 b->flush = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
699
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
700 } else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
701 r->upstream->request_bufs = cl;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
702 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
703
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
704 cl->next = NULL;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
705
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
706 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
707 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
708
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
709
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
710 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
711 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
712 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
713 ngx_http_uwsgi_ctx_t *ctx;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
714
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
715 ctx = 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
716
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
717 if (ctx == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
718 return NGX_OK;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
719 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
720
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
721 ctx->status = 0;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
722 ctx->status_count = 0;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
723 ctx->status_start = NULL;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
724 ctx->status_end = NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
725
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
726 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
727
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
728 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
729 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
730
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
731 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
732 ngx_http_uwsgi_parse_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
733 ngx_http_uwsgi_ctx_t *ctx)
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
734 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
735 u_char ch;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
736 u_char *p;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
737 ngx_http_upstream_t *u;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
738 enum {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
739 sw_start = 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
740 sw_H,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
741 sw_HT,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
742 sw_HTT,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
743 sw_HTTP,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
744 sw_first_major_digit,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
745 sw_major_digit,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
746 sw_first_minor_digit,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
747 sw_minor_digit,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
748 sw_status,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
749 sw_space_after_status,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
750 sw_status_text,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
751 sw_almost_done
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
752 } state;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
753
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
754 u = r->upstream;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
755
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
756 state = r->state;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
757
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
758 for (p = u->buffer.pos; p < u->buffer.last; p++) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
759 ch = *p;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
760
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
761 switch (state) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
762
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
763 /* "HTTP/" */
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
764 case sw_start:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
765 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
766 case 'H':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
767 state = sw_H;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
768 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
769 default:
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
770 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
771 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
772 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
773
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
774 case sw_H:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
775 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
776 case 'T':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
777 state = sw_HT;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
778 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
779 default:
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
780 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
781 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
782 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
783
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
784 case sw_HT:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
785 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
786 case 'T':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
787 state = sw_HTT;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
788 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
789 default:
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
790 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
791 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
792 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
793
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
794 case sw_HTT:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
795 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
796 case 'P':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
797 state = sw_HTTP;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
798 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
799 default:
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
800 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
801 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
802 break;
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 case sw_HTTP:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
805 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
806 case '/':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
807 state = sw_first_major_digit;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
808 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
809 default:
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
810 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
811 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
812 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
813
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
814 /* the first digit of major HTTP version */
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
815 case sw_first_major_digit:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
816 if (ch < '1' || ch > '9') {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
817 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
818 }
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 state = sw_major_digit;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
821 break;
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 /* the major HTTP version or dot */
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
824 case sw_major_digit:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
825 if (ch == '.') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
826 state = sw_first_minor_digit;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
827 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
828 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
829
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
830 if (ch < '0' || ch > '9') {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
831 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
832 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
833
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
834 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
835
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
836 /* the first digit of minor HTTP version */
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
837 case sw_first_minor_digit:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
838 if (ch < '0' || ch > '9') {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
839 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
840 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
841
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
842 state = sw_minor_digit;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
843 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
844
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
845 /* the minor HTTP version or the end of the request line */
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
846 case sw_minor_digit:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
847 if (ch == ' ') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
848 state = sw_status;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
849 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
850 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
851
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
852 if (ch < '0' || ch > '9') {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
853 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
854 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
855
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
856 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
857
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
858 /* HTTP status code */
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
859 case sw_status:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
860 if (ch == ' ') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
861 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
862 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
863
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
864 if (ch < '0' || ch > '9') {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
865 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
866 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
867
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
868 ctx->status = ctx->status * 10 + ch - '0';
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
869
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
870 if (++ctx->status_count == 3) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
871 state = sw_space_after_status;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
872 ctx->status_start = p - 2;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
873 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
874
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
875 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
876
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
877 /* space or end of line */
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
878 case sw_space_after_status:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
879 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
880 case ' ':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
881 state = sw_status_text;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
882 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
883 case '.': /* IIS may send 403.1, 403.2, etc */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
884 state = sw_status_text;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
885 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
886 case CR:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
887 state = sw_almost_done;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
888 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
889 case LF:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
890 goto done;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
891 default:
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
892 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
893 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
894 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
895
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
896 /* any text until end of line */
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
897 case sw_status_text:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
898 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
899 case CR:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
900 state = sw_almost_done;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
901
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
902 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
903 case LF:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
904 goto done;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
905 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
906 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
907
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
908 /* end of status line */
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
909 case sw_almost_done:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
910 ctx->status_end = p - 1;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
911 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
912 case LF:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
913 goto done;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
914 default:
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
915 return NGX_HTTP_UWSGI_PARSE_NO_HEADER;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
916 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
917 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
918 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
919
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
920 u->buffer.pos = p;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
921 r->state = state;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
922
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
923 return NGX_AGAIN;
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 done:
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
926
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
927 u->buffer.pos = p + 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
928
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
929 if (ctx->status_end == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
930 ctx->status_end = p;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
931 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
932
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
933 r->state = sw_start;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
934
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
935 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
936 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
937
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
938
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
939 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
940 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
941 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
942 ngx_int_t rc;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
943 ngx_http_upstream_t *u;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
944 ngx_http_uwsgi_ctx_t *ctx;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
945
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
946 ctx = 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
947
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
948 if (ctx == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
949 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
950 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
951
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
952 rc = ngx_http_uwsgi_parse_status_line(r, ctx);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
953
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
954 if (rc == NGX_AGAIN) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
955 return rc;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
956 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
957
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
958 u = r->upstream;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
959
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
960 if (rc == NGX_HTTP_UWSGI_PARSE_NO_HEADER) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
961
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
962 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
963 "upstream sent no valid HTTP/1.0 header");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
964
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
965 r->http_version = NGX_HTTP_VERSION_9;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
966 u->headers_in.status_n = NGX_HTTP_OK;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
967 u->state->status = NGX_HTTP_OK;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
968
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
969 return NGX_OK;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
970 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
971
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
972 if (u->state) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
973 u->state->status = ctx->status;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
974 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
975
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
976 u->headers_in.status_n = ctx->status;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
977
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
978 u->headers_in.status_line.len = ctx->status_end - ctx->status_start;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
979 u->headers_in.status_line.data = ngx_pnalloc(r->pool,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
980 u->headers_in.status_line.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
981 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
982 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
983 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
984
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
985 ngx_memcpy(u->headers_in.status_line.data, ctx->status_start,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
986 u->headers_in.status_line.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
987
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
988 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
989 "http uwsgi status %ui \"%V\"",
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
990 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
991
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
992 u->process_header = ngx_http_uwsgi_process_header;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
993
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
994 return ngx_http_uwsgi_process_header(r);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
995 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
996
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
997
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
998 static ngx_int_t
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
999 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
1000 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1001 ngx_int_t rc;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1002 ngx_table_elt_t *h;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1003 ngx_http_upstream_header_t *hh;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1004 ngx_http_upstream_main_conf_t *umcf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1005
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1006 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
1007
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1008 for ( ;; ) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1009
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1010 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
1011
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1012 if (rc == NGX_OK) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1013
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1014 /* a header line has been parsed successfully */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1015
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1016 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
1017 if (h == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1018 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1019 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1020
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1021 h->hash = r->header_hash;
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 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
1024 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
1025
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1026 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
1027 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
1028 + h->key.len);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1029 if (h->key.data == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1030 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1031 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1032
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1033 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
1034 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
1035
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1036 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
1037 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
1038
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1039 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
1040 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
1041
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1042 } else {
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1043 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
1044 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1045
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1046 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
1047 h->lowcase_key, h->key.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1048
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1049 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
1050 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1051 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1052
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1053 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
1054 "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
1055
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1056 continue;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1057 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1058
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1059 if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1060
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1061 /* a whole header has been parsed successfully */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1062
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1063 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
1064 "http uwsgi header done");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1065
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1066 /*
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1067 * if no "Server" and "Date" in header line,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1068 * then add the special empty headers
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1069 */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1070
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1071 if (r->upstream->headers_in.server == NULL) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1072 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
1073 if (h == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1074 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1075 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1076
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1077 h->hash = ngx_hash(ngx_hash(ngx_hash(ngx_hash(
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1078 ngx_hash ('s', 'e'), 'r'), 'v'), 'e'), 'r');
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1079
3545
11c4f3a1e439 use ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents: 3544
diff changeset
1080 ngx_str_set(&h->key, "Server");
11c4f3a1e439 use ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents: 3544
diff changeset
1081 ngx_str_null(&h->value);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1082 h->lowcase_key = (u_char *) "server";
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1083 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1084
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1085 if (r->upstream->headers_in.date == NULL) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1086 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
1087 if (h == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1088 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1089 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1090
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1091 h->hash = ngx_hash(ngx_hash(ngx_hash('d', 'a'), 't'), 'e');
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1092
3545
11c4f3a1e439 use ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents: 3544
diff changeset
1093 ngx_str_set(&h->key, "Date");
11c4f3a1e439 use ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents: 3544
diff changeset
1094 ngx_str_null(&h->value);
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1095 h->lowcase_key = (u_char *) "date";
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1096 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1097
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1098 return NGX_OK;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1099 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1100
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1101 if (rc == NGX_AGAIN) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1102 return NGX_AGAIN;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1103 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1104
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1105 /* 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
1106
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1107 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
1108 "upstream sent invalid header");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1109
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1110 return NGX_HTTP_UPSTREAM_INVALID_HEADER;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1111 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1112 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1113
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1114
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1115 static void
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1116 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
1117 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1118 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
1119 "abort http uwsgi request");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1120
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1121 return;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1122 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1123
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 static void
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1126 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
1127 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1128 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
1129 "finalize http uwsgi request");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1130
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1131 return;
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1134
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1135 static void *
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1136 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
1137 {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1138 ngx_http_uwsgi_loc_conf_t *conf;
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 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
1141 if (conf == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1142 return NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1143 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1144
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
1145 conf->modifier1 = NGX_CONF_UNSET_UINT;
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
1146 conf->modifier2 = NGX_CONF_UNSET_UINT;
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
1147
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1148 conf->upstream.store = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1149 conf->upstream.store_access = NGX_CONF_UNSET_UINT;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1150 conf->upstream.buffering = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1151 conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1152
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1153 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1154 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1155 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1156
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1157 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1158 conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1159
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1160 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
1161 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
1162 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
1163
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1164 conf->upstream.pass_request_headers = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1165 conf->upstream.pass_request_body = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1166
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1167 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1168 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
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 conf->upstream.intercept_errors = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1171
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1172 /* "uwsgi_cyclic_temp_file" is disabled */
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1173 conf->upstream.cyclic_temp_file = 0;
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 return conf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1176 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1177
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1178
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1179 static char *
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1180 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
1181 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1182 ngx_http_uwsgi_loc_conf_t *prev = parent;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1183 ngx_http_uwsgi_loc_conf_t *conf = child;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1184
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1185 u_char *p;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1186 size_t size;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1187 uintptr_t *code;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1188 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
1189 ngx_array_t headers_names;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1190 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
1191 ngx_hash_key_t *hk;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1192 ngx_hash_init_t hash;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1193 ngx_http_script_compile_t sc;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1194 ngx_http_script_copy_code_t *copy;
3541
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.store != 0) {
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1197 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
1198
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1199 if (conf->upstream.store_lengths == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1200 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
1201 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
1202 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1203 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1204
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1205 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
1206 prev->upstream.store_access, 0600);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1207
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1208 ngx_conf_merge_value(conf->upstream.buffering,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1209 prev->upstream.buffering, 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1210
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1211 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
1212 prev->upstream.ignore_client_abort, 0);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1213
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1214 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
1215 prev->upstream.connect_timeout, 60000);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1216
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1217 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
1218 prev->upstream.send_timeout, 60000);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1219
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1220 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
1221 prev->upstream.read_timeout, 60000);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1222
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1223 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
1224 prev->upstream.send_lowat, 0);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1225
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1226 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
1227 prev->upstream.buffer_size,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1228 (size_t) ngx_pagesize);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1229
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1230
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1231 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
1232 8, ngx_pagesize);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1233
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1234 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
1235 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
1236 "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
1237 return NGX_CONF_ERROR;
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1240
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1241 size = conf->upstream.buffer_size;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1242 if (size < conf->upstream.bufs.size) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1243 size = conf->upstream.bufs.size;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1244 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1245
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1246
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1247 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
1248 prev->upstream.busy_buffers_size_conf,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1249 NGX_CONF_UNSET_SIZE);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1250
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1251 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
1252 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
1253 } else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1254 conf->upstream.busy_buffers_size =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1255 conf->upstream.busy_buffers_size_conf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1256 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1257
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1258 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
1259 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
1260 "\"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
1261 "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
1262 "one of the \"uwsgi_buffers\"");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1263
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1264 return NGX_CONF_ERROR;
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1267 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
1268 > (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
1269 {
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1270 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
1271 "\"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
1272 "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
1273
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1274 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1275 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1276
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1277
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1278 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
1279 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
1280 NGX_CONF_UNSET_SIZE);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1281
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1282 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
1283 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
1284 } else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1285 conf->upstream.temp_file_write_size =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1286 conf->upstream.temp_file_write_size_conf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1287 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1288
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1289 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
1290 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
1291 "\"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
1292 "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
1293 "one of the \"uwsgi_buffers\"");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1294
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1295 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1296 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1297
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1298
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1299 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
1300 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
1301 NGX_CONF_UNSET_SIZE);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1302
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1303 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
1304 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
1305 } else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1306 conf->upstream.max_temp_file_size =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1307 conf->upstream.max_temp_file_size_conf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1308 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1309
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1310 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
1311 && 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
1312 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
1313 "\"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
1314 "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
1315 "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
1316 "one of the \"uwsgi_buffers\"");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1317
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1318 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1319 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1320
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1321
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1322 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
1323 prev->upstream.ignore_headers,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1324 NGX_CONF_BITMASK_SET);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1325
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1326
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1327 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
1328 prev->upstream.next_upstream,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1329 (NGX_CONF_BITMASK_SET
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1330 |NGX_HTTP_UPSTREAM_FT_ERROR
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1331 |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
3541
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 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
1334 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
1335 |NGX_HTTP_UPSTREAM_FT_OFF;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1336 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1337
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1338 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
1339 prev->upstream.temp_path,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1340 &ngx_http_uwsgi_temp_path)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1341 != NGX_OK)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1342 {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1343 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1344 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1345
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1346 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
1347 prev->upstream.pass_request_headers, 1);
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1348 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
1349 prev->upstream.pass_request_body, 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1350
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1351 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
1352 prev->upstream.intercept_errors, 0);
3541
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 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
1355
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1356 hash.max_size = 512;
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1357 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
1358 hash.name = "uwsgi_hide_headers_hash";
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1359
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1360 if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1361 &prev->upstream,
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1362 ngx_http_uwsgi_hide_headers, &hash)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1363 != NGX_OK)
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1364 {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1365 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1366 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1367
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1368 if (conf->upstream.upstream == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1369 conf->upstream.upstream = prev->upstream.upstream;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1370 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1371
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1372 if (conf->uwsgi_lengths == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1373 conf->uwsgi_lengths = prev->uwsgi_lengths;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1374 conf->uwsgi_values = prev->uwsgi_values;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1375 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1376
3552
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
1377 ngx_conf_merge_uint_value(conf->modifier1, prev->modifier1, 0);
40eba0271b1d improve uwsgi_modifierX processing:
Igor Sysoev <igor@sysoev.ru>
parents: 3551
diff changeset
1378 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
1379
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1380 if (conf->params_source == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1381 conf->flushes = prev->flushes;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1382 conf->params_len = prev->params_len;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1383 conf->params = prev->params;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1384 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
1385 conf->headers_hash = prev->headers_hash;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1386
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1387 if (conf->params_source == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1388 return NGX_CONF_OK;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1389 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1390 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1391
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1392 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
1393 if (conf->params_len == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1394 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1395 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1396
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1397 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
1398 if (conf->params == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1399 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1400 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1401
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1402 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
1403 != NGX_OK)
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1404 {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1405 return NGX_CONF_ERROR;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1406 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1407
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1408 src = conf->params_source->elts;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1409 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
1410
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1411 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
1412 && 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
1413 {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1414 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
1415 if (hk == NULL) {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1416 return NGX_CONF_ERROR;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1417 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1418
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1419 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
1420 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
1421 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
1422 hk->value = (void *) 1;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1423
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1424 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
1425 continue;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1426 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1427 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1428
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1429 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
1430 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
1431 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
1432 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
1433 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1434
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1435 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
1436 copy->len = src[i].key.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1437
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1438
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1439 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
1440 + 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
1441 & ~(sizeof(uintptr_t) - 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1442
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1443 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
1444 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
1445 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
1446 }
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1447
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1448 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
1449 copy->len = src[i].key.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1450
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1451 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
1452 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
1453
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1454
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1455 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
1456
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1457 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
1458 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
1459 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
1460 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
1461 sc.values = &conf->params;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1462
3548
fc7541a6959d fix the previous commit when value is static string: remove the special
Igor Sysoev <igor@sysoev.ru>
parents: 3547
diff changeset
1463 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
1464 return NGX_CONF_ERROR;
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1465 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1466
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1467 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
1468 if (code == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1469 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1470 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1471
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1472 *code = (uintptr_t) NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1473
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1474
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1475 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
1476 if (code == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1477 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1478 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1479
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1480 *code = (uintptr_t) NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1481 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1482
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1483 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
1484 if (code == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1485 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1486 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1487
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1488 *code = (uintptr_t) NULL;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1489
3566
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1490 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
1491
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1492 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
1493 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
1494 hash.max_size = 512;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1495 hash.bucket_size = 64;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1496 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
1497 hash.pool = cf->pool;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1498 hash.temp_pool = NULL;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1499
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1500 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
1501 {
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1502 return NGX_CONF_ERROR;
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1503 }
b81d44244cb1 allow uwsgi_param to override client headers using HTTP_ parameters
Igor Sysoev <igor@sysoev.ru>
parents: 3565
diff changeset
1504
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1505 return NGX_CONF_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1506 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1507
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1508
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1509 static char *
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1510 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
1511 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1512 ngx_http_uwsgi_loc_conf_t *uwcf = conf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1513
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1514 ngx_url_t u;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1515 ngx_str_t *value, *url;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1516 ngx_uint_t n;
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1517 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
1518 ngx_http_script_compile_t sc;
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 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
1521 return "is duplicate";
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1522 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1523
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1524 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
1525 clcf->handler = ngx_http_uwsgi_handler;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1526
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1527 value = cf->args->elts;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1528
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1529 url = &value[1];
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1530
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1531 n = ngx_http_script_variables_count(url);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1532
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1533 if (n) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1534
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1535 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
1536
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1537 sc.cf = cf;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1538 sc.source = url;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1539 sc.lengths = &uwcf->uwsgi_lengths;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1540 sc.values = &uwcf->uwsgi_values;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1541 sc.variables = n;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1542 sc.complete_lengths = 1;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1543 sc.complete_values = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1544
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1545 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
1546 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1547 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1548
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1549 return NGX_CONF_OK;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1550 }
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_memzero(&u, sizeof(ngx_url_t));
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1553
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1554 u.url = value[1];
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1555 u.no_resolve = 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1556
3543
e132566a942e fix style, some names, and building by MSVC8
Igor Sysoev <igor@sysoev.ru>
parents: 3542
diff changeset
1557 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
1558 if (uwcf->upstream.upstream == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1559 return NGX_CONF_ERROR;
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 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
1563 clcf->auto_redirect = 1;
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1566 return NGX_CONF_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1567 }
3565
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1568
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1569
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1570 static char *
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1571 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
1572 {
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1573 ngx_http_uwsgi_loc_conf_t *uwcf = conf;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1574
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1575 ngx_str_t *value;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1576 ngx_http_script_compile_t sc;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1577
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1578 if (uwcf->upstream.store != NGX_CONF_UNSET || uwcf->upstream.store_lengths)
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1579 {
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1580 return "is duplicate";
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1581 }
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1582
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1583 value = cf->args->elts;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1584
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1585 if (ngx_strcmp(value[1].data, "on") == 0) {
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1586 uwcf->upstream.store = 1;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1587 return NGX_CONF_OK;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1588 }
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1589
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1590 if (ngx_strcmp(value[1].data, "off") == 0) {
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1591 uwcf->upstream.store = 0;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1592 return NGX_CONF_OK;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1593 }
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1594
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1595 /* include the terminating '\0' into script */
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1596 value[1].len++;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1597
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1598 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1599
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1600 sc.cf = cf;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1601 sc.source = &value[1];
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1602 sc.lengths = &uwcf->upstream.store_lengths;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1603 sc.values = &uwcf->upstream.store_values;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1604 sc.variables = ngx_http_script_variables_count(&value[1]);;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1605 sc.complete_lengths = 1;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1606 sc.complete_values = 1;
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 if (ngx_http_script_compile(&sc) != NGX_OK) {
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1609 return NGX_CONF_ERROR;
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
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1612 return NGX_CONF_OK;
1e86f0ac9a44 uwsgi_store
Igor Sysoev <igor@sysoev.ru>
parents: 3564
diff changeset
1613 }