annotate src/http/modules/ngx_http_uwsgi_module.c @ 3543:e132566a942e

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