annotate src/http/modules/ngx_http_uwsgi_module.c @ 3542:9bf51b3fc1c1

style fix: remove tabs and trailing spaces
author Igor Sysoev <igor@sysoev.ru>
date Tue, 01 Jun 2010 15:55:04 +0000
parents 21452748d165
children e132566a942e
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
4 *
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5 *
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8 * are met:
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11 * 2. Redistributions in binary form must reproduce the above copyright
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12 * notice, this list of conditions and the following disclaimer in the
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
13 * documentation and/or other materials provided with the distribution.
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14 *
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
15 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
18 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
25 * SUCH DAMAGE.
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
26
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
27
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
28
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29 * heavily based on Manlio's mod_scgi, mod_fastcgi and mod_proxy of nginx 0.7.x
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
30
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
31 */
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
32
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
33
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
34 #include <ngx_config.h>
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
35 #include <ngx_core.h>
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
36 #include <ngx_http.h>
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
37
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
38 #define NGX_HTTP_UWSGI_TEMP_PATH "uwsgi_temp"
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
39
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
40 typedef struct {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
41 ngx_http_upstream_conf_t upstream;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
42
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
43 ngx_array_t *flushes;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
44 ngx_array_t *params_len;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
45 ngx_array_t *params;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
46 ngx_array_t *params_source;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
47
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
48 ngx_array_t *uwsgi_lengths;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
49 ngx_array_t *uwsgi_values;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
50
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
51 ngx_str_t uwsgi_string ;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
52
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
53 u_char modifier1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
54 u_char modifier2;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
55
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
56 } ngx_http_uwsgi_loc_conf_t;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
57
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
58 typedef struct {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
59 ngx_uint_t status;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
60 ngx_uint_t status_count;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
61 u_char *status_start;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
62 u_char *status_end;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
63 } ngx_http_uwsgi_ctx_t;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
64
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
65 #define NGX_HTTP_XCGI_PARSE_NO_HEADER 20
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
66
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
67 #ifndef NGX_HAVE_LITTLE_ENDIAN
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
68 static uint16_t
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
69 uwsgi_swap16 (uint16_t x)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
70 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
71 return (uint16_t) ((x & 0xff) << 8 | (x & 0xff00) >> 8);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
72 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
73 #endif
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
74
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
75
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
76
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
77 static ngx_int_t ngx_http_uwsgi_eval (ngx_http_request_t * r,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
78 ngx_http_uwsgi_loc_conf_t * uwcf);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
79 static ngx_int_t ngx_http_uwsgi_create_request (ngx_http_request_t * r);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
80 static ngx_int_t ngx_http_uwsgi_reinit_request (ngx_http_request_t * r);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
81 static ngx_int_t ngx_http_uwsgi_process_status_line (ngx_http_request_t * r);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
82 static ngx_int_t ngx_http_uwsgi_parse_status_line (ngx_http_request_t * r,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
83 ngx_http_uwsgi_ctx_t *
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
84 ctx);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
85 static ngx_int_t ngx_http_uwsgi_process_header (ngx_http_request_t * r);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
86 static ngx_int_t ngx_http_uwsgi_process_header (ngx_http_request_t * r);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
87 static void ngx_http_uwsgi_abort_request (ngx_http_request_t * r);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
88 static void ngx_http_uwsgi_finalize_request (ngx_http_request_t * r,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
89 ngx_int_t rc);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
90
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
91 static char *ngx_http_uwsgi_modifier1 (ngx_conf_t * cf, ngx_command_t * cmd,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
92 void *conf);
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 static char *ngx_http_uwsgi_modifier2 (ngx_conf_t * cf, ngx_command_t * cmd,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
95 void *conf);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
96
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
97 static ngx_int_t ngx_http_uwsgi_add_variables (ngx_conf_t * cf);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
98 static void *ngx_http_uwsgi_create_loc_conf (ngx_conf_t * cf);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
99 static char *ngx_http_uwsgi_merge_loc_conf (ngx_conf_t * cf,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
100 void *parent, void *child);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
101
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
102 static char *ngx_http_uwsgi_pass (ngx_conf_t * cf, ngx_command_t * cmd,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
103 void *conf);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
104
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
105
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
106 static ngx_conf_bitmask_t ngx_http_uwsgi_next_upstream_masks[] = {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
107 {ngx_string ("error"), NGX_HTTP_UPSTREAM_FT_ERROR},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
108 {ngx_string ("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
109 {ngx_string ("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
110 {ngx_string ("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
111 {ngx_string ("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
112 {ngx_string ("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
113 {ngx_string ("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
114 {ngx_string ("off"), NGX_HTTP_UPSTREAM_FT_OFF},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
115 {ngx_null_string, 0}
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
116 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
117
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
118
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
119 static ngx_conf_bitmask_t ngx_http_uwsgi_ignore_headers_masks[] = {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
120 {ngx_string ("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
121 {ngx_string ("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
122 {ngx_string ("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
123 {ngx_string ("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
124 {ngx_null_string, 0}
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
125 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
126
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
127
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
128 ngx_module_t ngx_http_uwsgi_module;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
129
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
130
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
131 static ngx_command_t ngx_http_uwsgi_commands[] = {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
132
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
133 {ngx_string ("uwsgi_pass"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
134 NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
135 ngx_http_uwsgi_pass,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
136 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
137 0,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
138 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
139
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
140 {ngx_string ("uwsgi_modifier1"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
141 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
142 NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
143 ngx_http_uwsgi_modifier1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
144 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
145 0,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
146 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
147
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
148 {ngx_string ("uwsgi_modifier2"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
149 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
150 NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
151 ngx_http_uwsgi_modifier2,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
152 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
153 0,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
154 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
155
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
156 {ngx_string ("uwsgi_ignore_client_abort"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
157 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
158 NGX_CONF_FLAG,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
159 ngx_conf_set_flag_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
160 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
161 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.ignore_client_abort),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
162 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
163
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
164 {ngx_string ("uwsgi_connect_timeout"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
165 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
166 NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
167 ngx_conf_set_msec_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
168 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
169 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.connect_timeout),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
170 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
171
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
172 {ngx_string ("uwsgi_send_timeout"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
173 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
174 NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
175 ngx_conf_set_msec_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
176 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
177 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.send_timeout),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
178 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
179
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
180 {ngx_string ("uwsgi_buffer_size"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
181 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
182 NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
183 ngx_conf_set_size_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
184 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
185 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.buffer_size),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
186 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
187
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
188 {ngx_string ("uwsgi_pass_request_headers"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
189 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
190 NGX_CONF_FLAG,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
191 ngx_conf_set_flag_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
192 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
193 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.pass_request_headers),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
194 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
195
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
196 {ngx_string ("uwsgi_pass_request_body"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
197 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
198 NGX_CONF_FLAG,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
199 ngx_conf_set_flag_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
200 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
201 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.pass_request_body),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
202 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
203
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
204 {ngx_string ("uwsgi_intercept_errors"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
205 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
206 NGX_CONF_FLAG,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
207 ngx_conf_set_flag_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
208 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
209 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.intercept_errors),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
210 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
211
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
212 {ngx_string ("uwsgi_read_timeout"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
213 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
214 NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
215 ngx_conf_set_msec_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
216 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
217 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.read_timeout),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
218 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
219
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
220 {ngx_string ("uwsgi_buffers"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
221 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
222 NGX_CONF_TAKE2,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
223 ngx_conf_set_bufs_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
224 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
225 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.bufs),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
226 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
227
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
228 {ngx_string ("uwsgi_busy_buffers_size"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
229 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
230 NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
231 ngx_conf_set_size_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
232 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
233 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.busy_buffers_size_conf),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
234 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
235
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
236 {ngx_string ("uwsgi_temp_path"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
237 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
238 NGX_CONF_TAKE1234,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
239 ngx_conf_set_path_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
240 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
241 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.temp_path),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
242 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
243
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
244 {ngx_string ("uwsgi_max_temp_file_size"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
245 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
246 NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
247 ngx_conf_set_size_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
248 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
249 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.max_temp_file_size_conf),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
250 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
251
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
252 {ngx_string ("uwsgi_temp_file_write_size"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
253 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
254 NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
255 ngx_conf_set_size_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
256 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
257 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.temp_file_write_size_conf),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
258 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
259
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
260 {ngx_string ("uwsgi_next_upstream"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
261 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
262 NGX_CONF_1MORE,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
263 ngx_conf_set_bitmask_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
264 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
265 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.next_upstream),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
266 &ngx_http_uwsgi_next_upstream_masks},
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 {ngx_string ("uwsgi_param"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
269 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
270 NGX_CONF_TAKE2,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
271 ngx_conf_set_keyval_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
272 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
273 offsetof (ngx_http_uwsgi_loc_conf_t, params_source),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
274 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
275
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
276 { ngx_string("uwsgi_string"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
277 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
278 NGX_CONF_TAKE1,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
279 ngx_conf_set_str_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
280 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
281 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
282 NULL },
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 {ngx_string ("uwsgi_pass_header"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
285 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
286 NGX_CONF_FLAG,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
287 ngx_conf_set_str_array_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
288 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
289 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.pass_headers),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
290 NULL},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
291
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
292 {ngx_string ("uwsgi_hide_header"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
293 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
294 NGX_CONF_FLAG,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
295 ngx_conf_set_str_array_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
296 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
297 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.hide_headers),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
298 NULL},
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 {ngx_string ("uwsgi_ignore_headers"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
301 NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF |
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
302 NGX_CONF_1MORE,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
303 ngx_conf_set_bitmask_slot,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
304 NGX_HTTP_LOC_CONF_OFFSET,
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
305 offsetof (ngx_http_uwsgi_loc_conf_t, upstream.ignore_headers),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
306 &ngx_http_uwsgi_ignore_headers_masks},
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
307
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
308 ngx_null_command
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_http_module_t ngx_http_uwsgi_module_ctx = {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
313 ngx_http_uwsgi_add_variables, /* preconfiguration */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
314 NULL, /* postconfiguration */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
315
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
316 NULL, /* create main configuration */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
317 NULL, /* init main configuration */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
318
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
319 NULL, /* create server configuration */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
320 NULL, /* merge server configuration */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
321
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
322 ngx_http_uwsgi_create_loc_conf, /* create location configuration */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
323 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
324 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
325
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
326
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
327 ngx_module_t ngx_http_uwsgi_module = {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
328 NGX_MODULE_V1,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
329 &ngx_http_uwsgi_module_ctx, /* module context */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
330 ngx_http_uwsgi_commands, /* module directives */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
331 NGX_HTTP_MODULE, /* module type */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
332 NULL, /* init master */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
333 NULL, /* init module */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
334 NULL, /* init process */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
335 NULL, /* init thread */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
336 NULL, /* exit thread */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
337 NULL, /* exit process */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
338 NULL, /* exit master */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
339 NGX_MODULE_V1_PADDING
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
340 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
341
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
342
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
343 static ngx_http_variable_t ngx_http_uwsgi_vars[] = {
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 {ngx_null_string, NULL, NULL, 0, 0, 0}
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
346 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
347
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
348
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
349 static ngx_str_t ngx_http_uwsgi_hide_headers[] = {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
350 ngx_string ("Status"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
351 ngx_string ("X-Accel-Expires"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
352 ngx_string ("X-Accel-Redirect"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
353 ngx_string ("X-Accel-Limit-Rate"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
354 ngx_string ("X-Accel-Buffering"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
355 ngx_string ("X-Accel-Charset"),
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
356 ngx_null_string
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
357 };
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
358
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
359
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
360 static ngx_path_init_t ngx_http_uwsgi_temp_path = {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
361 ngx_string (NGX_HTTP_UWSGI_TEMP_PATH), {1, 2, 0}
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
362 };
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
365 static ngx_int_t
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
366 ngx_http_uwsgi_handler (ngx_http_request_t * r)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
367 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
368 ngx_int_t rc;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
369 ngx_http_upstream_t *u;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
370 ngx_http_uwsgi_ctx_t *f;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
371 ngx_http_uwsgi_loc_conf_t *uwcf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
372
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
373 if (r->subrequest_in_memory) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
374 ngx_log_error (NGX_LOG_ALERT, r->connection->log, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
375 "ngx_http_uwsgi_module does not support "
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
376 "subrequest in memory");
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
377 return NGX_HTTP_INTERNAL_SERVER_ERROR;
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 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
381 return NGX_HTTP_INTERNAL_SERVER_ERROR;
3541
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 f = ngx_pcalloc (r->pool, sizeof (ngx_http_uwsgi_ctx_t));
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
385 if (f == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
386 return NGX_HTTP_INTERNAL_SERVER_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
387 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
388
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
389 ngx_http_set_ctx (r, f, ngx_http_uwsgi_module);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
390
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
391 uwcf = ngx_http_get_module_loc_conf (r, ngx_http_uwsgi_module);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
392
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
393 if (uwcf->uwsgi_lengths) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
394 if (ngx_http_uwsgi_eval (r, uwcf) != NGX_OK) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
395 return NGX_HTTP_INTERNAL_SERVER_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
396 }
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
399 u = r->upstream;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
400
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
401 u->schema.len = sizeof ("uwsgi://") - 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
402 u->schema.data = (u_char *) "uwsgi://";
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
403
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
404 u->output.tag = (ngx_buf_tag_t) & ngx_http_uwsgi_module;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
405
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
406 u->conf = &uwcf->upstream;
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 u->create_request = ngx_http_uwsgi_create_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
409 u->reinit_request = ngx_http_uwsgi_reinit_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
410 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
411 u->abort_request = ngx_http_uwsgi_abort_request;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
412 u->finalize_request = ngx_http_uwsgi_finalize_request;
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 u->buffering = 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
415
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
416 u->pipe = ngx_pcalloc (r->pool, sizeof (ngx_event_pipe_t));
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
417 if (u->pipe == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
418 return NGX_HTTP_INTERNAL_SERVER_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 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
422 u->pipe->input_ctx = r;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
423
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
424 rc = ngx_http_read_client_request_body (r, ngx_http_upstream_init);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
425
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
426 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
427 return rc;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
428 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
429
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
430 return NGX_DONE;
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
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 static ngx_int_t
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
435 ngx_http_uwsgi_eval (ngx_http_request_t * r, ngx_http_uwsgi_loc_conf_t * uwcf)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
436 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
437 ngx_url_t u;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
438
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
439 ngx_memzero (&u, sizeof (ngx_url_t));
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
440
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
441 if (ngx_http_script_run (r, &u.url, uwcf->uwsgi_lengths->elts, 0,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
442 uwcf->uwsgi_values->elts) == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
443 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
444 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
445
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
446 u.no_resolve = 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
447
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
448 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
449 if (u.err) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
450 ngx_log_error (NGX_LOG_ERR, r->connection->log, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
451 "%s in upstream \"%V\"", u.err, &u.url);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
452 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
453
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
454 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
455 }
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 (u.no_port) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
458 ngx_log_error (NGX_LOG_ERR, r->connection->log, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
459 "no port in upstream \"%V\"", &u.url);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
460 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
461 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
462
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
463 r->upstream->resolved = ngx_pcalloc (r->pool,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
464 sizeof
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
465 (ngx_http_upstream_resolved_t));
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
466 if (r->upstream->resolved == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
467 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
468 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
469
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
470 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
471 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
472 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
473 r->upstream->resolved->naddrs = 1;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
474 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
475
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
476 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
477 else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
478 r->upstream->resolved->host = u.host;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
479 r->upstream->resolved->port = u.port;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
480 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
481
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
482 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
483 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
484
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
485
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
486 static ngx_int_t
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
487 ngx_http_uwsgi_create_request (ngx_http_request_t * r)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
488 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
489 u_char ch, *pos, tmp[2];
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
490 size_t key_len, val_len;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
491 uint16_t uwsgi_pkt_size, uwsgi_strlen;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
492 ngx_uint_t i, n;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
493 ngx_buf_t *b;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
494 ngx_chain_t *cl, *body;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
495 ngx_list_part_t *part;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
496 ngx_table_elt_t *header;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
497 ngx_http_script_code_pt code;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
498 ngx_http_script_engine_t e, le;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
499 ngx_http_uwsgi_loc_conf_t *uwcf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
500 ngx_http_script_len_code_pt lcode;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
501
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
502 uwsgi_pkt_size = 0;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
503
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
504 uwcf = ngx_http_get_module_loc_conf (r, ngx_http_uwsgi_module);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
505
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
506 if (uwcf->params_len) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
507 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
508
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
509 ngx_http_script_flush_no_cacheable_variables (r, uwcf->flushes);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
510 le.flushed = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
511
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
512 le.ip = uwcf->params_len->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
513 le.request = r;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
514
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
515 while (*(uintptr_t *) le.ip) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
516
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
517 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
518 key_len = lcode (&le);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
519
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
520 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
521 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
522 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
523 le.ip += sizeof (uintptr_t);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
524
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
525 uwsgi_pkt_size += 2 + key_len + 2 + val_len;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
526 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
527 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
528
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
529 if (uwcf->upstream.pass_request_headers) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
530
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
531 part = &r->headers_in.headers.part;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
532 header = part->elts;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
533
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
534 for (i = 0; /* void */ ; i++) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
535
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
536 if (i >= part->nelts) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
537 if (part->next == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
538 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
539 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
540
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
541 part = part->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
542 header = part->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
543 i = 0;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
544 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
545
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
546 uwsgi_pkt_size +=
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
547 2 + 5 + header[i].key.len + 2 + header[i].value.len;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
548 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
549 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
550
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
551 if (uwcf->uwsgi_string.data && uwcf->uwsgi_string.len) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
552 uwsgi_pkt_size += uwcf->uwsgi_string.len ;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
553 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
554
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
555
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
556 /* allow custom uwsgi packet
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
557 if (uwsgi_pkt_size > 0 && uwsgi_pkt_size < 2) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
558 ngx_log_error (NGX_LOG_ALERT, r->connection->log, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
559 "uwsgi request is too little: %uz", uwsgi_pkt_size);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
560 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
561 }
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 b = ngx_create_temp_buf (r->pool, uwsgi_pkt_size + 4);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
565 if (b == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
566 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
567 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
568
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
569 cl = ngx_alloc_chain_link (r->pool);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
570 if (cl == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
571 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
572 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
573
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
574 cl->buf = b;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
575
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
576 *b->pos = uwcf->modifier1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
577 #ifndef NGX_HAVE_LITTLE_ENDIAN
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
578 uwsgi_pkt_size = uwsgi_swap16 (uwsgi_pkt_size);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
579 #endif
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
580 b->last = ngx_cpymem (b->pos + 1, &uwsgi_pkt_size, 2);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
581 *(b->pos + 3) = uwcf->modifier2;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
582 b->last++;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
583
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
584 if (uwcf->params_len) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
585 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
586
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
587 e.ip = uwcf->params->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
588 e.pos = b->last;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
589 e.request = r;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
590 e.flushed = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
591
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
592 le.ip = uwcf->params_len->elts;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
593
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
594 while (*(uintptr_t *) le.ip) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
595
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
596 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
597 key_len = (u_char) lcode (&le);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
598
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
599 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
600 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
601 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
602 le.ip += sizeof (uintptr_t);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
603
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
604 #ifndef NGX_HAVE_LITTLE_ENDIAN
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
605 uwsgi_strlen = uwsgi_swap16 (key_len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
606 #else
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
607 uwsgi_strlen = key_len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
608 #endif
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
609 e.pos = ngx_cpymem (e.pos, &uwsgi_strlen, 2);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
610
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
611 while (*(uintptr_t *) e.ip) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
612 code = *(ngx_http_script_code_pt *) e.ip;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
613 code ((ngx_http_script_engine_t *) & e);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
614 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
615
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
616 pos = e.pos - val_len;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
617 /* move memory */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
618 for (i = 0; i < val_len; i += 2) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
619 e.pos = ngx_cpymem (tmp, pos + (i) + 2, 2);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
620 e.pos = ngx_cpymem (pos + (i) + 2, pos, 2);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
621 e.pos = ngx_cpymem (pos, tmp, 2);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
622 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
623
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
624 e.pos = pos;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
625
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
626 #ifndef NGX_HAVE_LITTLE_ENDIAN
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
627 uwsgi_strlen = uwsgi_swap16 (val_len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
628 #else
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
629 uwsgi_strlen = val_len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
630 #endif
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
631 e.pos = ngx_cpymem (e.pos, &uwsgi_strlen, 2);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
632 e.pos += val_len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
633
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
634 e.ip += sizeof (uintptr_t);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
635
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
636
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
637 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
638
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
639 b->last = e.pos;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
640 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
641
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
642
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
643 if (uwcf->upstream.pass_request_headers) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
644
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
645 part = &r->headers_in.headers.part;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
646 header = part->elts;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
647
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
648 for (i = 0; /* void */ ; i++) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
649
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
650 if (i >= part->nelts) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
651 if (part->next == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
652 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
653 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
654
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
655 part = part->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
656 header = part->elts;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
657 i = 0;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
658 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
659
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
660 #ifndef NGX_HAVE_LITTLE_ENDIAN
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
661 uwsgi_strlen = uwsgi_swap16 (5 + header[i].key.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
662 #else
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
663 uwsgi_strlen = 5 + header[i].key.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
664 #endif
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
665 b->last = ngx_cpymem (b->last, &uwsgi_strlen, 2);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
666 b->last = ngx_cpymem (b->last, "HTTP_", 5);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
667 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
668 ch = header[i].key.data[n];
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
669
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
670 if (ch >= 'a' && ch <= 'z') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
671 ch &= ~0x20;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
672
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
673 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
674 else if (ch == '-') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
675 ch = '_';
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
676 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
677
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
678 *b->last++ = ch;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
679 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
680 #ifndef NGX_HAVE_LITTLE_ENDIAN
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
681 uwsgi_strlen = uwsgi_swap16 (header[i].value.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
682 #else
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
683 uwsgi_strlen = header[i].value.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
684 #endif
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
685 b->last = ngx_cpymem (b->last, &uwsgi_strlen, 2);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
686 b->last =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
687 ngx_copy (b->last, header[i].value.data, header[i].value.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
688
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
689
3542
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 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
692
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
693
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
694
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
695 if (uwcf->uwsgi_string.data && uwcf->uwsgi_string.len) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
696 b->last = ngx_copy(b->last, uwcf->uwsgi_string.data, uwcf->uwsgi_string.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
697 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
698
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
699 if (uwcf->upstream.pass_request_body) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
700 body = r->upstream->request_bufs;
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
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
703 while (body) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
704 b = ngx_alloc_buf (r->pool);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
705 if (b == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
706 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
707 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
708
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
709 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
710
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
711 cl->next = ngx_alloc_chain_link (r->pool);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
712 if (cl->next == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
713 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
714 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
715
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
716 cl = cl->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
717 cl->buf = b;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
718
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
719 body = body->next;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
720 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
721
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
722 b->flush = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
723
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
724 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
725 else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
726 r->upstream->request_bufs = cl;
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
729 cl->next = NULL;
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 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
732 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
733
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
734
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
735 static ngx_int_t
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
736 ngx_http_uwsgi_reinit_request (ngx_http_request_t * r)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
737 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
738
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
739 ngx_http_uwsgi_ctx_t *s;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
740
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
741 s = ngx_http_get_module_ctx (r, ngx_http_uwsgi_module);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
742
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
743 if (s == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
744 return NGX_OK;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
745 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
746
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
747 s->status = 0;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
748 s->status_count = 0;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
749 s->status_start = NULL;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
750 s->status_end = NULL;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
751
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
752 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
753
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
754 return NGX_OK;
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
757 static ngx_int_t
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
758 ngx_http_uwsgi_parse_status_line (ngx_http_request_t * r,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
759 ngx_http_uwsgi_ctx_t * ctx)
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
760 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
761 u_char ch;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
762 u_char *p;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
763 ngx_http_upstream_t *u;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
764 enum {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
765 sw_start = 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
766 sw_H,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
767 sw_HT,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
768 sw_HTT,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
769 sw_HTTP,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
770 sw_first_major_digit,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
771 sw_major_digit,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
772 sw_first_minor_digit,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
773 sw_minor_digit,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
774 sw_status,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
775 sw_space_after_status,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
776 sw_status_text,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
777 sw_almost_done
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
778 } state;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
779
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
780 u = r->upstream;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
781
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
782 state = r->state;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
783
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
784 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
785 ch = *p;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
786
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
787 switch (state) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
788
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
789 /* "HTTP/" */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
790 case sw_start:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
791 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
792 case 'H':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
793 state = sw_H;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
794 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
795 default:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
796 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
797 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
798 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
799
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
800 case sw_H:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
801 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
802 case 'T':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
803 state = sw_HT;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
804 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
805 default:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
806 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
807 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
808 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
809
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
810 case sw_HT:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
811 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
812 case 'T':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
813 state = sw_HTT;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
814 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
815 default:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
816 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
817 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
818 break;
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 case sw_HTT:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
821 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
822 case 'P':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
823 state = sw_HTTP;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
824 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
825 default:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
826 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
827 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
828 break;
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 case sw_HTTP:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
831 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
832 case '/':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
833 state = sw_first_major_digit;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
834 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
835 default:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
836 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
837 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
838 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
839
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
840 /* the first digit of major HTTP version */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
841 case sw_first_major_digit:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
842 if (ch < '1' || ch > '9') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
843 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
844 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
845
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
846 state = sw_major_digit;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
847 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
848
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
849 /* the major HTTP version or dot */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
850 case sw_major_digit:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
851 if (ch == '.') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
852 state = sw_first_minor_digit;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
853 break;
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 if (ch < '0' || ch > '9') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
857 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
858 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
859
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
860 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
861
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
862 /* the first digit of minor HTTP version */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
863 case sw_first_minor_digit:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
864 if (ch < '0' || ch > '9') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
865 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
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 state = sw_minor_digit;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
869 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
870
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
871 /* the minor HTTP version or the end of the request line */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
872 case sw_minor_digit:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
873 if (ch == ' ') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
874 state = sw_status;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
875 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
876 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
877
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
878 if (ch < '0' || ch > '9') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
879 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
880 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
881
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
882 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
883
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
884 /* HTTP status code */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
885 case sw_status:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
886 if (ch == ' ') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
887 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
888 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
889
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
890 if (ch < '0' || ch > '9') {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
891 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
892 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
893
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
894 ctx->status = ctx->status * 10 + ch - '0';
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
895
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
896 if (++ctx->status_count == 3) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
897 state = sw_space_after_status;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
898 ctx->status_start = p - 2;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
899 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
900
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
901 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
902
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
903 /* space or end of line */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
904 case sw_space_after_status:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
905 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
906 case ' ':
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
907 state = sw_status_text;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
908 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
909 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
910 state = sw_status_text;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
911 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
912 case CR:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
913 state = sw_almost_done;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
914 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
915 case LF:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
916 goto done;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
917 default:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
918 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
919 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
920 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
921
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
922 /* any text until end of line */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
923 case sw_status_text:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
924 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
925 case CR:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
926 state = sw_almost_done;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
927
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
928 break;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
929 case LF:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
930 goto done;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
931 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
932 break;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
933
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
934 /* end of status line */
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
935 case sw_almost_done:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
936 ctx->status_end = p - 1;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
937 switch (ch) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
938 case LF:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
939 goto done;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
940 default:
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
941 return NGX_HTTP_XCGI_PARSE_NO_HEADER;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
942 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
943 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
944 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
945
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
946 u->buffer.pos = p;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
947 r->state = state;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
948
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
949 return NGX_AGAIN;
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 done:
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
952
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
953 u->buffer.pos = p + 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
954
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
955 if (ctx->status_end == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
956 ctx->status_end = p;
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
959 r->state = sw_start;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
960
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
961 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
962 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
963
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
964
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
965 static ngx_int_t
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
966 ngx_http_uwsgi_process_status_line (ngx_http_request_t * r)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
967 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
968 ngx_int_t rc;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
969 ngx_http_upstream_t *u;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
970 ngx_http_uwsgi_ctx_t *ctx;
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 ctx = ngx_http_get_module_ctx (r, ngx_http_uwsgi_module);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
973
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
974 if (ctx == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
975 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
976 }
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 rc = ngx_http_uwsgi_parse_status_line (r, ctx);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
979
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
980 if (rc == NGX_AGAIN) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
981 return rc;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
982 }
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 u = r->upstream;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
985
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
986 if (rc == NGX_HTTP_XCGI_PARSE_NO_HEADER) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
987
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
988 ngx_log_error (NGX_LOG_ERR, r->connection->log, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
989 "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
990
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
991 r->http_version = NGX_HTTP_VERSION_9;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
992 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
993 u->state->status = NGX_HTTP_OK;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
994
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
995 return NGX_OK;
3541
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 if (u->state) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
999 u->state->status = ctx->status;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1000 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1001
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1002 u->headers_in.status_n = ctx->status;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1003
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1004 u->headers_in.status_line.len = ctx->status_end - ctx->status_start;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1005 u->headers_in.status_line.data = ngx_pnalloc (r->pool,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1006 u->headers_in.
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1007 status_line.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1008 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
1009 return NGX_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1010 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1011
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1012 ngx_memcpy (u->headers_in.status_line.data, ctx->status_start,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1013 u->headers_in.status_line.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1014
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1015 ngx_log_debug2 (NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1016 "http uwsgi status %ui \"%V\"",
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1017 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
1018
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1019 u->process_header = ngx_http_uwsgi_process_header;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1020
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1021 return ngx_http_uwsgi_process_header (r);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1022 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1023
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1024
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1025 static ngx_int_t
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1026 ngx_http_uwsgi_process_header (ngx_http_request_t * r)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1027 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1028 ngx_int_t rc;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1029 ngx_table_elt_t *h;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1030 ngx_http_upstream_header_t *hh;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1031 ngx_http_upstream_main_conf_t *umcf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1032
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1033 umcf = ngx_http_get_module_main_conf (r, ngx_http_upstream_module);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1034
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1035 for (;;) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1036
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1037 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
1038
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1039 if (rc == NGX_OK) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1040
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1041 /* a header line has been parsed successfully */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1042
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1043 h = ngx_list_push (&r->upstream->headers_in.headers);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1044 if (h == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1045 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1046 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1047
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1048 h->hash = r->header_hash;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1049
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1050 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
1051 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
1052
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1053 h->key.data = ngx_pnalloc (r->pool,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1054 h->key.len + 1 + h->value.len + 1 +
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1055 h->key.len);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1056 if (h->key.data == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1057 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1058 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1059
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1060 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
1061 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
1062
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1063 ngx_cpystrn (h->key.data, r->header_name_start, h->key.len + 1);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1064 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
1065
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1066 if (h->key.len == r->lowcase_index) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1067 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
1068
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1069 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1070 else {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1071 ngx_strlow (h->lowcase_key, h->key.data, h->key.len);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1072 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1073
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1074 hh = ngx_hash_find (&umcf->headers_in_hash, h->hash,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1075 h->lowcase_key, h->key.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1076
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1077 if (hh && hh->handler (r, h, hh->offset) != NGX_OK) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1078 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1079 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1080
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1081 ngx_log_debug2 (NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1082 "http uwsgi header: \"%V: %V\"",
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1083 &h->key, &h->value);
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 continue;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1086 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1087
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1088 if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1089
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1090 /* a whole header has been parsed successfully */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1091
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1092 ngx_log_debug0 (NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1093 "http uwsgi header done");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1094
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1095 /*
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1096 * 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
1097 * then add the special empty headers
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1098 */
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1099
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1100 if (r->upstream->headers_in.server == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1101 h = ngx_list_push (&r->upstream->headers_in.headers);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1102 if (h == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1103 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1104 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1105
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1106 h->hash =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1107 ngx_hash (ngx_hash
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1108 (ngx_hash
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1109 (ngx_hash (ngx_hash ('s', 'e'), 'r'),
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1110 'v'), 'e'), 'r');
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1111
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1112 h->key.len = sizeof ("Server") - 1;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1113 h->key.data = (u_char *) "Server";
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1114 h->value.len = 0;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1115 h->value.data = NULL;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1116 h->lowcase_key = (u_char *) "server";
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1117 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1118
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1119 if (r->upstream->headers_in.date == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1120 h = ngx_list_push (&r->upstream->headers_in.headers);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1121 if (h == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1122 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1123 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1124
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1125 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
1126
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1127 h->key.len = sizeof ("Date") - 1;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1128 h->key.data = (u_char *) "Date";
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1129 h->value.len = 0;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1130 h->value.data = NULL;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1131 h->lowcase_key = (u_char *) "date";
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1132 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1133
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1134 return NGX_OK;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1135 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1136
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1137 if (rc == NGX_AGAIN) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1138 return NGX_AGAIN;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1139 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1140
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1141 /* 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
1142
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1143 ngx_log_error (NGX_LOG_ERR, r->connection->log, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1144 "upstream sent invalid header");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1145
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1146 return NGX_HTTP_UPSTREAM_INVALID_HEADER;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1147 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1148 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1149
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1150
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1151 static void
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1152 ngx_http_uwsgi_abort_request (ngx_http_request_t * r)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1153 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1154 ngx_log_debug0 (NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1155 "abort http uwsgi request");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1156
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1157 return;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1158 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1159
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1160
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1161 static void
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1162 ngx_http_uwsgi_finalize_request (ngx_http_request_t * r, ngx_int_t rc)
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 ngx_log_debug0 (NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1165 "finalize http uwsgi request");
3541
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 return;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1168 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1169
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1170
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1171 static ngx_int_t
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1172 ngx_http_uwsgi_add_variables (ngx_conf_t * cf)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1173 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1174 ngx_http_variable_t *var, *v;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1175
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1176 for (v = ngx_http_uwsgi_vars; v->name.len; v++) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1177 var = ngx_http_add_variable (cf, &v->name, v->flags);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1178 if (var == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1179 return NGX_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1180 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1181
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1182 var->get_handler = v->get_handler;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1183 var->data = v->data;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1184 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1185
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1186 return NGX_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1187 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1188
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1189
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1190 static void *
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1191 ngx_http_uwsgi_create_loc_conf (ngx_conf_t * cf)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1192 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1193 ngx_http_uwsgi_loc_conf_t *conf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1194
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1195 conf = ngx_pcalloc (cf->pool, sizeof (ngx_http_uwsgi_loc_conf_t));
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1196 if (conf == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1197 return NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1198 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1199
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1200 conf->upstream.store = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1201 conf->upstream.store_access = NGX_CONF_UNSET_UINT;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1202 conf->upstream.buffering = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1203 conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1204
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1205 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1206 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1207 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1208
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1209 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1210 conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1211
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1212 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
1213 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
1214 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
1215
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1216 conf->upstream.pass_request_headers = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1217 conf->upstream.pass_request_body = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1218
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1219 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1220 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1221
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1222 conf->upstream.intercept_errors = NGX_CONF_UNSET;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1223
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1224 /* "uwsgi_cyclic_temp_file" is disabled */
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1225 conf->upstream.cyclic_temp_file = 0;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1226
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1227 return conf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1228 }
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1231 static char *
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1232 ngx_http_uwsgi_merge_loc_conf (ngx_conf_t * cf, void *parent, void *child)
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 ngx_http_uwsgi_loc_conf_t *prev = parent;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1235 ngx_http_uwsgi_loc_conf_t *conf = child;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1236
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1237 u_char *p;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1238 size_t size;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1239 uintptr_t *code;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1240 ngx_uint_t i;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1241 ngx_keyval_t *src;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1242 ngx_hash_init_t hash;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1243 ngx_http_script_compile_t sc;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1244 ngx_http_script_copy_code_t *copy;
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 if (conf->upstream.store != 0) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1247 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
1248
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1249 if (conf->upstream.store_lengths == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1250 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
1251 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
1252 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1253 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1254
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1255 ngx_conf_merge_uint_value (conf->upstream.store_access,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1256 prev->upstream.store_access, 0600);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1257
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1258 ngx_conf_merge_value (conf->upstream.buffering,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1259 prev->upstream.buffering, 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1260
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1261 ngx_conf_merge_value (conf->upstream.ignore_client_abort,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1262 prev->upstream.ignore_client_abort, 0);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1263
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1264 ngx_conf_merge_msec_value (conf->upstream.connect_timeout,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1265 prev->upstream.connect_timeout, 60000);
3541
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 ngx_conf_merge_msec_value (conf->upstream.send_timeout,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1268 prev->upstream.send_timeout, 60000);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1269
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1270 ngx_conf_merge_msec_value (conf->upstream.read_timeout,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1271 prev->upstream.read_timeout, 60000);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1272
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1273 ngx_conf_merge_size_value (conf->upstream.send_lowat,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1274 prev->upstream.send_lowat, 0);
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 ngx_conf_merge_size_value (conf->upstream.buffer_size,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1277 prev->upstream.buffer_size,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1278 (size_t) ngx_pagesize);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1279
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1280
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1281 ngx_conf_merge_bufs_value (conf->upstream.bufs, prev->upstream.bufs,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1282 8, ngx_pagesize);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1283
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1284 if (conf->upstream.bufs.num < 2) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1285 ngx_conf_log_error (NGX_LOG_EMERG, cf, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1286 "there must be at least 2 \"uwsgi_buffers\"");
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1287 return NGX_CONF_ERROR;
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1290
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1291 size = conf->upstream.buffer_size;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1292 if (size < conf->upstream.bufs.size) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1293 size = conf->upstream.bufs.size;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1294 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1295
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 ngx_conf_merge_size_value (conf->upstream.busy_buffers_size_conf,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1298 prev->upstream.busy_buffers_size_conf,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1299 NGX_CONF_UNSET_SIZE);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1300
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1301 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
1302 conf->upstream.busy_buffers_size = 2 * size;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1303 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1304 else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1305 conf->upstream.busy_buffers_size =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1306 conf->upstream.busy_buffers_size_conf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1307 }
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 if (conf->upstream.busy_buffers_size < size) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1310 ngx_conf_log_error (NGX_LOG_EMERG, cf, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1311 "\"uwsgi_busy_buffers_size\" must be equal or bigger than "
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1312 "maximum of the value of \"uwsgi_buffer_size\" and "
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1313 "one of the \"uwsgi_buffers\"");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1314
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1315 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1316 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1317
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1318 if (conf->upstream.busy_buffers_size
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1319 > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1320 ngx_conf_log_error (NGX_LOG_EMERG, cf, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1321 "\"uwsgi_busy_buffers_size\" must be less than "
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1322 "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
1323
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1324 return NGX_CONF_ERROR;
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1327
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1328 ngx_conf_merge_size_value (conf->upstream.temp_file_write_size_conf,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1329 prev->upstream.temp_file_write_size_conf,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1330 NGX_CONF_UNSET_SIZE);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1331
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1332 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
1333 conf->upstream.temp_file_write_size = 2 * size;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1334 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1335 else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1336 conf->upstream.temp_file_write_size =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1337 conf->upstream.temp_file_write_size_conf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1338 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1339
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1340 if (conf->upstream.temp_file_write_size < size) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1341 ngx_conf_log_error (NGX_LOG_EMERG, cf, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1342 "\"uwsgi_temp_file_write_size\" must be equal or bigger than "
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1343 "maximum of the value of \"uwsgi_buffer_size\" and "
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1344 "one of the \"uwsgi_buffers\"");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1345
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1346 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1347 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1348
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1349
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1350 ngx_conf_merge_size_value (conf->upstream.max_temp_file_size_conf,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1351 prev->upstream.max_temp_file_size_conf,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1352 NGX_CONF_UNSET_SIZE);
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 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
1355 conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1356 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1357 else {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1358 conf->upstream.max_temp_file_size =
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1359 conf->upstream.max_temp_file_size_conf;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1360 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1361
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1362 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
1363 && conf->upstream.max_temp_file_size < size) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1364 ngx_conf_log_error (NGX_LOG_EMERG, cf, 0,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1365 "\"uwsgi_max_temp_file_size\" must be equal to zero to disable "
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1366 "the temporary files usage or must be equal or bigger than "
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1367 "maximum of the value of \"uwsgi_buffer_size\" and "
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1368 "one of the \"uwsgi_buffers\"");
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1369
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1370 return NGX_CONF_ERROR;
3541
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1373
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1374 ngx_conf_merge_bitmask_value (conf->upstream.ignore_headers,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1375 prev->upstream.ignore_headers,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1376 NGX_CONF_BITMASK_SET);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1377
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1378
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1379 ngx_conf_merge_bitmask_value (conf->upstream.next_upstream,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1380 prev->upstream.next_upstream,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1381 (NGX_CONF_BITMASK_SET
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1382 | NGX_HTTP_UPSTREAM_FT_ERROR
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1383 | NGX_HTTP_UPSTREAM_FT_TIMEOUT));
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1384
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1385 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
1386 conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1387 | NGX_HTTP_UPSTREAM_FT_OFF;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1388 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1389
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1390 if (ngx_conf_merge_path_value (cf, &conf->upstream.temp_path,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1391 prev->upstream.temp_path,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1392 &ngx_http_uwsgi_temp_path) != NGX_OK) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1393 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1394 }
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 ngx_conf_merge_value (conf->upstream.pass_request_headers,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1397 prev->upstream.pass_request_headers, 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1398 ngx_conf_merge_value (conf->upstream.pass_request_body,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1399 prev->upstream.pass_request_body, 1);
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 ngx_conf_merge_value (conf->upstream.intercept_errors,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1402 prev->upstream.intercept_errors, 0);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1403
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1404 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
1405
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1406 hash.max_size = 512;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1407 hash.bucket_size = ngx_align (64, ngx_cacheline_size);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1408 hash.name = "uwsgi_hide_headers_hash";
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1409
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1410 if (ngx_http_upstream_hide_headers_hash (cf, &conf->upstream,
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1411 &prev->upstream,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1412 ngx_http_uwsgi_hide_headers,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1413 &hash) != NGX_OK) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1414 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1415 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1416
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1417 if (conf->upstream.upstream == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1418 conf->upstream.upstream = prev->upstream.upstream;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1419 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1420
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1421 if (conf->uwsgi_lengths == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1422 conf->uwsgi_lengths = prev->uwsgi_lengths;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1423 conf->uwsgi_values = prev->uwsgi_values;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1424 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1425
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1426 if (conf->modifier1 == 0) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1427 conf->modifier1 = prev->modifier1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1428 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1429
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1430 if (conf->modifier2 == 0) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1431 conf->modifier2 = prev->modifier2;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1432 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1433
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1434 if (conf->params_source == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1435 conf->flushes = prev->flushes;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1436 conf->params_len = prev->params_len;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1437 conf->params = prev->params;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1438 conf->params_source = prev->params_source;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1439
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1440 if (conf->params_source == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1441 return NGX_CONF_OK;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1442 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1443 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1444
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1445 conf->params_len = ngx_array_create (cf->pool, 64, 1);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1446 if (conf->params_len == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1447 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1448 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1449
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1450 conf->params = ngx_array_create (cf->pool, 512, 1);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1451 if (conf->params == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1452 return NGX_CONF_ERROR;
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1455 src = conf->params_source->elts;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1456 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
1457
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1458 if (ngx_http_script_variables_count (&src[i].value) == 0) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1459 copy = ngx_array_push_n (conf->params_len,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1460 sizeof (ngx_http_script_copy_code_t));
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1461 if (copy == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1462 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1463 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1464
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1465 copy->code = (ngx_http_script_code_pt)
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1466 ngx_http_script_copy_len_code;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1467 copy->len = src[i].key.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1468
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1469
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1470 copy = ngx_array_push_n (conf->params_len,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1471 sizeof (ngx_http_script_copy_code_t));
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1472 if (copy == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1473 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1474 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1475
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1476 copy->code = (ngx_http_script_code_pt)
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1477 ngx_http_script_copy_len_code;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1478 copy->len = src[i].value.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1479
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1480
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1481 size = (sizeof (ngx_http_script_copy_code_t)
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1482 + src[i].key.len + src[i].value.len
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1483 + sizeof (uintptr_t) - 1) & ~(sizeof (uintptr_t) - 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1484
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1485 copy = ngx_array_push_n (conf->params, size);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1486 if (copy == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1487 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1488 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1489
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1490 copy->code = ngx_http_script_copy_code;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1491 copy->len = src[i].key.len + src[i].value.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1492
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1493 p = (u_char *) copy + sizeof (ngx_http_script_copy_code_t);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1494
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1495 p = ngx_cpymem (p, src[i].key.data, src[i].key.len);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1496 ngx_memcpy (p, src[i].value.data, src[i].value.len);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1497
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1498 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1499 else {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1500 copy = ngx_array_push_n (conf->params_len,
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1501 sizeof (ngx_http_script_copy_code_t));
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1502 if (copy == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1503 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1504 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1505
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1506 copy->code = (ngx_http_script_code_pt)
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1507 ngx_http_script_copy_len_code;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1508 copy->len = src[i].key.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1509
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1510
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1511 size = (sizeof (ngx_http_script_copy_code_t)
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1512 + src[i].key.len + sizeof (uintptr_t) - 1)
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1513 & ~(sizeof (uintptr_t) - 1);
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1514
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1515 copy = ngx_array_push_n (conf->params, size);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1516 if (copy == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1517 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1518 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1519
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1520 copy->code = ngx_http_script_copy_code;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1521 copy->len = src[i].key.len;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1522
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1523 p = (u_char *) copy + sizeof (ngx_http_script_copy_code_t);
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1524 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
1525
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1526
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1527 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
1528
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1529 sc.cf = cf;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1530 sc.source = &src[i].value;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1531 sc.flushes = &conf->flushes;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1532 sc.lengths = &conf->params_len;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1533 sc.values = &conf->params;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1534
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1535 if (ngx_http_script_compile (&sc) != NGX_OK) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1536 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1537 }
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1538 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1539
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1540 code = ngx_array_push_n (conf->params_len, sizeof (uintptr_t));
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1541 if (code == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1542 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1543 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1544
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1545 *code = (uintptr_t) NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1546
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1547
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1548 code = ngx_array_push_n (conf->params, sizeof (uintptr_t));
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1549 if (code == NULL) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1550 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1551 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1552
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1553 *code = (uintptr_t) NULL;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1554 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1555
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1556 code = ngx_array_push_n (conf->params_len, sizeof (uintptr_t));
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1557 if (code == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1558 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1559 }
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 *code = (uintptr_t) NULL;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1562
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1563 return NGX_CONF_OK;
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
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1567 static char *
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1568 ngx_http_uwsgi_pass (ngx_conf_t * cf, ngx_command_t * cmd, void *conf)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1569 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1570 ngx_http_uwsgi_loc_conf_t *uwcf = conf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1571
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1572 ngx_url_t u;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1573 ngx_str_t *value, *url;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1574 ngx_uint_t n;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1575 ngx_http_core_loc_conf_t *clcf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1576 ngx_http_script_compile_t sc;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1577
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1578 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
1579 return "is duplicate";
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1580 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1581
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1582 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
1583 clcf->handler = ngx_http_uwsgi_handler;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1584
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1585 value = cf->args->elts;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1586
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1587 url = &value[1];
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1588
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1589 n = ngx_http_script_variables_count (url);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1590
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1591 if (n) {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1592
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1593 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
1594
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1595 sc.cf = cf;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1596 sc.source = url;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1597 sc.lengths = &uwcf->uwsgi_lengths;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1598 sc.values = &uwcf->uwsgi_values;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1599 sc.variables = n;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1600 sc.complete_lengths = 1;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1601 sc.complete_values = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1602
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1603 if (ngx_http_script_compile (&sc) != NGX_OK) {
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1604 return NGX_CONF_ERROR;
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1605 }
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1606
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1607 return NGX_CONF_OK;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1608 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1609
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1610 ngx_memzero (&u, sizeof (ngx_url_t));
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1611
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1612 u.url = value[1];
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1613 u.no_resolve = 1;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1614
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1615 uwcf->upstream.upstream = ngx_http_upstream_add (cf, &u, 0);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1616 if (uwcf->upstream.upstream == NULL) {
3542
9bf51b3fc1c1 style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3541
diff changeset
1617 return NGX_CONF_ERROR;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1618 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1619
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1620 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
1621 clcf->auto_redirect = 1;
3541
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1622 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1623
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1624 return NGX_CONF_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1625 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1626
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1627 static char *
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1628 ngx_http_uwsgi_modifier1 (ngx_conf_t * cf, ngx_command_t * cmd, void *conf)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1629 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1630 ngx_http_uwsgi_loc_conf_t *uwcf = conf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1631 ngx_str_t *value;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1632
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1633 value = cf->args->elts;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1634
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1635 uwcf->modifier1 = (u_char) ngx_atoi (value[1].data, value[1].len);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1636
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1637 return NGX_CONF_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1638 }
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1639
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1640 static char *
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1641 ngx_http_uwsgi_modifier2 (ngx_conf_t * cf, ngx_command_t * cmd, void *conf)
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1642 {
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1643 ngx_http_uwsgi_loc_conf_t *uwcf = conf;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1644
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1645 ngx_str_t *value;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1646
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1647 value = cf->args->elts;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1648
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1649 uwcf->modifier2 = (u_char) ngx_atoi (value[1].data, value[1].len);
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1650
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1651
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1652 return NGX_CONF_OK;
21452748d165 import original ngx_http_uwsgi_module version
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1653 }