annotate src/http/modules/ngx_http_scgi_module.c @ 7933:2f443cac3f1e

Upstream: fixed logging level of upstream invalid header errors. In b87b7092cedb (nginx 1.21.1), logging level of "upstream sent invalid header" errors was accidentally changed to "info". This change restores the "error" level, which is a proper logging level for upstream-side errors.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 18 Oct 2021 16:46:59 +0300
parents b87b7092cedb
children 75af96daee97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2 /*
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
3 * Copyright (C) Igor Sysoev
4412
d620f497c50f Copyright updated.
Maxim Konovalov <maxim@nginx.com>
parents: 4401
diff changeset
4 * Copyright (C) Nginx, Inc.
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5 * Copyright (C) Manlio Perillo (manlio.perillo@gmail.com)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6 */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 #include <ngx_config.h>
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10 #include <ngx_core.h>
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11 #include <ngx_http.h>
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
13
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14 typedef struct {
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
15 ngx_array_t caches; /* ngx_http_file_cache_t * */
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
16 } ngx_http_scgi_main_conf_t;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
17
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
18
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
19 typedef struct {
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
20 ngx_array_t *flushes;
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
21 ngx_array_t *lengths;
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
22 ngx_array_t *values;
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
23 ngx_uint_t number;
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
24 ngx_hash_t hash;
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
25 } ngx_http_scgi_params_t;
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
26
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
27
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
28 typedef struct {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29 ngx_http_upstream_conf_t upstream;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
30
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
31 ngx_http_scgi_params_t params;
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
32 #if (NGX_HTTP_CACHE)
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
33 ngx_http_scgi_params_t params_cache;
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
34 #endif
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
35 ngx_array_t *params_source;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
36
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
37 ngx_array_t *scgi_lengths;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
38 ngx_array_t *scgi_values;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
39
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
40 #if (NGX_HTTP_CACHE)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
41 ngx_http_complex_value_t cache_key;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
42 #endif
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
43 } ngx_http_scgi_loc_conf_t;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
44
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
45
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
46 static ngx_int_t ngx_http_scgi_eval(ngx_http_request_t *r,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
47 ngx_http_scgi_loc_conf_t *scf);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
48 static ngx_int_t ngx_http_scgi_create_request(ngx_http_request_t *r);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
49 static ngx_int_t ngx_http_scgi_reinit_request(ngx_http_request_t *r);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
50 static ngx_int_t ngx_http_scgi_process_status_line(ngx_http_request_t *r);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
51 static ngx_int_t ngx_http_scgi_process_header(ngx_http_request_t *r);
7678
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
52 static ngx_int_t ngx_http_scgi_input_filter_init(void *data);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
53 static void ngx_http_scgi_abort_request(ngx_http_request_t *r);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
54 static void ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
55
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
56 static void *ngx_http_scgi_create_main_conf(ngx_conf_t *cf);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
57 static void *ngx_http_scgi_create_loc_conf(ngx_conf_t *cf);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
58 static char *ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
59 void *child);
5907
195561ef367f Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents: 5906
diff changeset
60 static ngx_int_t ngx_http_scgi_init_params(ngx_conf_t *cf,
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
61 ngx_http_scgi_loc_conf_t *conf, ngx_http_scgi_params_t *params,
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
62 ngx_keyval_t *default_params);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
63
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
64 static char *ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
65 static char *ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
66 void *conf);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
67
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
68 #if (NGX_HTTP_CACHE)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
69 static ngx_int_t ngx_http_scgi_create_key(ngx_http_request_t *r);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
70 static char *ngx_http_scgi_cache(ngx_conf_t *cf, ngx_command_t *cmd,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
71 void *conf);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
72 static char *ngx_http_scgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
73 void *conf);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
74 #endif
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
75
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
76
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
77 static ngx_conf_bitmask_t ngx_http_scgi_next_upstream_masks[] = {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
78 { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
79 { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
80 { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
6467
91c8d990fb45 Upstream: proxy_next_upstream non_idempotent.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6303
diff changeset
81 { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT },
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
82 { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
83 { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
5231
05c53652e7b4 Upstream: http_403 support in proxy_next_upstream (and friends).
Maxim Dounin <mdounin@mdounin.ru>
parents: 5080
diff changeset
84 { ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 },
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
85 { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 },
6966
fa56ab75cffc Upstream: allow recovery from "429 Too Many Requests" response.
Piotr Sikora <piotrsikora@google.com>
parents: 6906
diff changeset
86 { ngx_string("http_429"), NGX_HTTP_UPSTREAM_FT_HTTP_429 },
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
87 { ngx_string("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
88 { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
89 { ngx_null_string, 0 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
90 };
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
91
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
92
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
93 ngx_module_t ngx_http_scgi_module;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
94
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
95
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
96 static ngx_command_t ngx_http_scgi_commands[] = {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
97
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
98 { ngx_string("scgi_pass"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
99 NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
100 ngx_http_scgi_pass,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
101 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
102 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
103 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
104
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
105 { ngx_string("scgi_store"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
106 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
107 ngx_http_scgi_store,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
108 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
109 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
110 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
111
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
112 { ngx_string("scgi_store_access"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
113 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
114 ngx_conf_set_access_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
115 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
116 offsetof(ngx_http_scgi_loc_conf_t, upstream.store_access),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
117 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
118
4157
9d59a8eda373 Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4015
diff changeset
119 { ngx_string("scgi_buffering"),
9d59a8eda373 Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4015
diff changeset
120 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
9d59a8eda373 Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4015
diff changeset
121 ngx_conf_set_flag_slot,
9d59a8eda373 Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4015
diff changeset
122 NGX_HTTP_LOC_CONF_OFFSET,
9d59a8eda373 Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4015
diff changeset
123 offsetof(ngx_http_scgi_loc_conf_t, upstream.buffering),
9d59a8eda373 Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4015
diff changeset
124 NULL },
9d59a8eda373 Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4015
diff changeset
125
6053
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
126 { ngx_string("scgi_request_buffering"),
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
127 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
128 ngx_conf_set_flag_slot,
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
129 NGX_HTTP_LOC_CONF_OFFSET,
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
130 offsetof(ngx_http_scgi_loc_conf_t, upstream.request_buffering),
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
131 NULL },
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
132
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
133 { ngx_string("scgi_ignore_client_abort"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
134 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
135 ngx_conf_set_flag_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
136 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
137 offsetof(ngx_http_scgi_loc_conf_t, upstream.ignore_client_abort),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
138 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
139
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
140 { ngx_string("scgi_bind"),
6530
1d0e03db9f8e Upstream: the "transparent" parameter of proxy_bind and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6474
diff changeset
141 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12,
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
142 ngx_http_upstream_bind_set_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
143 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
144 offsetof(ngx_http_scgi_loc_conf_t, upstream.local),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
145 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
146
7371
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
147 { ngx_string("scgi_socket_keepalive"),
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
148 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
149 ngx_conf_set_flag_slot,
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
150 NGX_HTTP_LOC_CONF_OFFSET,
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
151 offsetof(ngx_http_scgi_loc_conf_t, upstream.socket_keepalive),
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
152 NULL },
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
153
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
154 { ngx_string("scgi_connect_timeout"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
155 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
156 ngx_conf_set_msec_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
157 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
158 offsetof(ngx_http_scgi_loc_conf_t, upstream.connect_timeout),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
159 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
160
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
161 { ngx_string("scgi_send_timeout"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
162 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
163 ngx_conf_set_msec_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
164 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
165 offsetof(ngx_http_scgi_loc_conf_t, upstream.send_timeout),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
166 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
167
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
168 { ngx_string("scgi_buffer_size"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
169 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
170 ngx_conf_set_size_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
171 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
172 offsetof(ngx_http_scgi_loc_conf_t, upstream.buffer_size),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
173 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
174
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
175 { ngx_string("scgi_pass_request_headers"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
176 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
177 ngx_conf_set_flag_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
178 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
179 offsetof(ngx_http_scgi_loc_conf_t, upstream.pass_request_headers),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
180 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
181
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
182 { ngx_string("scgi_pass_request_body"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
183 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
184 ngx_conf_set_flag_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
185 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
186 offsetof(ngx_http_scgi_loc_conf_t, upstream.pass_request_body),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
187 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
188
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
189 { ngx_string("scgi_intercept_errors"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
190 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
191 ngx_conf_set_flag_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
192 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
193 offsetof(ngx_http_scgi_loc_conf_t, upstream.intercept_errors),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
194 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
195
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
196 { ngx_string("scgi_read_timeout"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
197 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
198 ngx_conf_set_msec_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
199 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
200 offsetof(ngx_http_scgi_loc_conf_t, upstream.read_timeout),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
201 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
202
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
203 { ngx_string("scgi_buffers"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
204 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
205 ngx_conf_set_bufs_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
206 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
207 offsetof(ngx_http_scgi_loc_conf_t, upstream.bufs),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
208 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
209
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
210 { ngx_string("scgi_busy_buffers_size"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
211 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
212 ngx_conf_set_size_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
213 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
214 offsetof(ngx_http_scgi_loc_conf_t, upstream.busy_buffers_size_conf),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
215 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
216
5874
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
217 { ngx_string("scgi_force_ranges"),
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
218 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
219 ngx_conf_set_flag_slot,
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
220 NGX_HTTP_LOC_CONF_OFFSET,
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
221 offsetof(ngx_http_scgi_loc_conf_t, upstream.force_ranges),
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
222 NULL },
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
223
5883
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
224 { ngx_string("scgi_limit_rate"),
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
225 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
226 ngx_conf_set_size_slot,
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
227 NGX_HTTP_LOC_CONF_OFFSET,
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
228 offsetof(ngx_http_scgi_loc_conf_t, upstream.limit_rate),
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
229 NULL },
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
230
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
231 #if (NGX_HTTP_CACHE)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
232
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
233 { ngx_string("scgi_cache"),
3729
4b773fc06336 fix directive type
Igor Sysoev <igor@sysoev.ru>
parents: 3699
diff changeset
234 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
235 ngx_http_scgi_cache,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
236 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
237 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
238 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
239
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
240 { ngx_string("scgi_cache_key"),
3729
4b773fc06336 fix directive type
Igor Sysoev <igor@sysoev.ru>
parents: 3699
diff changeset
241 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
242 ngx_http_scgi_cache_key,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
243 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
244 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
245 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
246
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
247 { ngx_string("scgi_cache_path"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
248 NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
249 ngx_http_file_cache_set_slot,
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
250 NGX_HTTP_MAIN_CONF_OFFSET,
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
251 offsetof(ngx_http_scgi_main_conf_t, caches),
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
252 &ngx_http_scgi_module },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
253
3699
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
254 { ngx_string("scgi_cache_bypass"),
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
255 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
256 ngx_http_set_predicate_slot,
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
257 NGX_HTTP_LOC_CONF_OFFSET,
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
258 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_bypass),
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
259 NULL },
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
260
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
261 { ngx_string("scgi_no_cache"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
262 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
3692
045ea40cbfe8 use ngx_http_test_predicates(), ngx_http_set_predicate_slot()
Igor Sysoev <igor@sysoev.ru>
parents: 3670
diff changeset
263 ngx_http_set_predicate_slot,
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
264 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
265 offsetof(ngx_http_scgi_loc_conf_t, upstream.no_cache),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
266 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
267
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
268 { ngx_string("scgi_cache_valid"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
269 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
270 ngx_http_file_cache_valid_set_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
271 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
272 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_valid),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
273 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
274
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
275 { ngx_string("scgi_cache_min_uses"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
276 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
277 ngx_conf_set_num_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
278 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
279 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_min_uses),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
280 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
281
6793
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
282 { ngx_string("scgi_cache_max_range_offset"),
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
283 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
284 ngx_conf_set_off_slot,
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
285 NGX_HTTP_LOC_CONF_OFFSET,
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
286 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_max_range_offset),
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
287 NULL },
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
288
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
289 { ngx_string("scgi_cache_use_stale"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
290 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
291 ngx_conf_set_bitmask_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
292 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
293 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_use_stale),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
294 &ngx_http_scgi_next_upstream_masks },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
295
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
296 { ngx_string("scgi_cache_methods"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
297 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
298 ngx_conf_set_bitmask_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
299 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
300 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_methods),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
301 &ngx_http_upstream_cache_method_mask },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
302
4386
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
303 { ngx_string("scgi_cache_lock"),
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
304 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
305 ngx_conf_set_flag_slot,
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
306 NGX_HTTP_LOC_CONF_OFFSET,
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
307 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_lock),
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
308 NULL },
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
309
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
310 { ngx_string("scgi_cache_lock_timeout"),
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
311 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
312 ngx_conf_set_msec_slot,
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
313 NGX_HTTP_LOC_CONF_OFFSET,
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
314 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_lock_timeout),
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
315 NULL },
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
316
5905
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
317 { ngx_string("scgi_cache_lock_age"),
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
318 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
319 ngx_conf_set_msec_slot,
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
320 NGX_HTTP_LOC_CONF_OFFSET,
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
321 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_lock_age),
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
322 NULL },
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
323
5441
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
324 { ngx_string("scgi_cache_revalidate"),
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
325 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
326 ngx_conf_set_flag_slot,
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
327 NGX_HTTP_LOC_CONF_OFFSET,
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
328 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_revalidate),
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
329 NULL },
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
330
6906
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
331 { ngx_string("scgi_cache_background_update"),
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
332 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
333 ngx_conf_set_flag_slot,
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
334 NGX_HTTP_LOC_CONF_OFFSET,
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
335 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_background_update),
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
336 NULL },
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
337
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
338 #endif
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
339
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
340 { ngx_string("scgi_temp_path"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
341 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
342 ngx_conf_set_path_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
343 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
344 offsetof(ngx_http_scgi_loc_conf_t, upstream.temp_path),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
345 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
346
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
347 { ngx_string("scgi_max_temp_file_size"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
348 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
349 ngx_conf_set_size_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
350 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
351 offsetof(ngx_http_scgi_loc_conf_t, upstream.max_temp_file_size_conf),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
352 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
353
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
354 { ngx_string("scgi_temp_file_write_size"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
355 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
356 ngx_conf_set_size_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
357 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
358 offsetof(ngx_http_scgi_loc_conf_t, upstream.temp_file_write_size_conf),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
359 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
360
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
361 { ngx_string("scgi_next_upstream"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
362 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
363 ngx_conf_set_bitmask_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
364 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
365 offsetof(ngx_http_scgi_loc_conf_t, upstream.next_upstream),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
366 &ngx_http_scgi_next_upstream_masks },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
367
5832
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
368 { ngx_string("scgi_next_upstream_tries"),
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
369 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
370 ngx_conf_set_num_slot,
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
371 NGX_HTTP_LOC_CONF_OFFSET,
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
372 offsetof(ngx_http_scgi_loc_conf_t, upstream.next_upstream_tries),
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
373 NULL },
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
374
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
375 { ngx_string("scgi_next_upstream_timeout"),
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
376 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
377 ngx_conf_set_msec_slot,
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
378 NGX_HTTP_LOC_CONF_OFFSET,
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
379 offsetof(ngx_http_scgi_loc_conf_t, upstream.next_upstream_timeout),
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
380 NULL },
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
381
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
382 { ngx_string("scgi_param"),
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
383 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE23,
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
384 ngx_http_upstream_param_set_slot,
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
385 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
386 offsetof(ngx_http_scgi_loc_conf_t, params_source),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
387 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
388
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
389 { ngx_string("scgi_pass_header"),
3729
4b773fc06336 fix directive type
Igor Sysoev <igor@sysoev.ru>
parents: 3699
diff changeset
390 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
391 ngx_conf_set_str_array_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
392 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
393 offsetof(ngx_http_scgi_loc_conf_t, upstream.pass_headers),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
394 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
395
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
396 { ngx_string("scgi_hide_header"),
3729
4b773fc06336 fix directive type
Igor Sysoev <igor@sysoev.ru>
parents: 3699
diff changeset
397 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
398 ngx_conf_set_str_array_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
399 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
400 offsetof(ngx_http_scgi_loc_conf_t, upstream.hide_headers),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
401 NULL },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
402
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
403 { ngx_string("scgi_ignore_headers"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
404 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
405 ngx_conf_set_bitmask_slot,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
406 NGX_HTTP_LOC_CONF_OFFSET,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
407 offsetof(ngx_http_scgi_loc_conf_t, upstream.ignore_headers),
3667
12bd9e26fadb use shared ngx_http_upstream_ignore_headers_masks[]
Igor Sysoev <igor@sysoev.ru>
parents: 3637
diff changeset
408 &ngx_http_upstream_ignore_headers_masks },
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
409
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
410 ngx_null_command
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
411 };
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
412
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
413
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
414 static ngx_http_module_t ngx_http_scgi_module_ctx = {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
415 NULL, /* preconfiguration */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
416 NULL, /* postconfiguration */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
417
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
418 ngx_http_scgi_create_main_conf, /* create main configuration */
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
419 NULL, /* init main configuration */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
420
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
421 NULL, /* create server configuration */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
422 NULL, /* merge server configuration */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
423
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
424 ngx_http_scgi_create_loc_conf, /* create location configuration */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
425 ngx_http_scgi_merge_loc_conf /* merge location configuration */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
426 };
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
427
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
428
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
429 ngx_module_t ngx_http_scgi_module = {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
430 NGX_MODULE_V1,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
431 &ngx_http_scgi_module_ctx, /* module context */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
432 ngx_http_scgi_commands, /* module directives */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
433 NGX_HTTP_MODULE, /* module type */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
434 NULL, /* init master */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
435 NULL, /* init module */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
436 NULL, /* init process */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
437 NULL, /* init thread */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
438 NULL, /* exit thread */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
439 NULL, /* exit process */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
440 NULL, /* exit master */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
441 NGX_MODULE_V1_PADDING
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
442 };
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
443
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
444
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
445 static ngx_str_t ngx_http_scgi_hide_headers[] = {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
446 ngx_string("Status"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
447 ngx_string("X-Accel-Expires"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
448 ngx_string("X-Accel-Redirect"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
449 ngx_string("X-Accel-Limit-Rate"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
450 ngx_string("X-Accel-Buffering"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
451 ngx_string("X-Accel-Charset"),
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
452 ngx_null_string
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
453 };
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
454
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
455
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
456 #if (NGX_HTTP_CACHE)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
457
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
458 static ngx_keyval_t ngx_http_scgi_cache_headers[] = {
5441
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
459 { ngx_string("HTTP_IF_MODIFIED_SINCE"),
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
460 ngx_string("$upstream_cache_last_modified") },
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
461 { ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") },
5738
c95d7882dfc9 Upstream: cache revalidation using If-None-Match.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5575
diff changeset
462 { ngx_string("HTTP_IF_NONE_MATCH"), ngx_string("$upstream_cache_etag") },
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
463 { ngx_string("HTTP_IF_MATCH"), ngx_string("") },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
464 { ngx_string("HTTP_RANGE"), ngx_string("") },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
465 { ngx_string("HTTP_IF_RANGE"), ngx_string("") },
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
466 { ngx_null_string, ngx_null_string }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
467 };
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
468
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
469 #endif
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
470
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
471
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
472 static ngx_path_init_t ngx_http_scgi_temp_path = {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
473 ngx_string(NGX_HTTP_SCGI_TEMP_PATH), { 1, 2, 0 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
474 };
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
475
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
476
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
477 static ngx_int_t
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
478 ngx_http_scgi_handler(ngx_http_request_t *r)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
479 {
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
480 ngx_int_t rc;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
481 ngx_http_status_t *status;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
482 ngx_http_upstream_t *u;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
483 ngx_http_scgi_loc_conf_t *scf;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
484 #if (NGX_HTTP_CACHE)
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
485 ngx_http_scgi_main_conf_t *smcf;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
486 #endif
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
487
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
488 if (ngx_http_upstream_create(r) != NGX_OK) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
489 return NGX_HTTP_INTERNAL_SERVER_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
490 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
491
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
492 status = ngx_pcalloc(r->pool, sizeof(ngx_http_status_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
493 if (status == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
494 return NGX_HTTP_INTERNAL_SERVER_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
495 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
496
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
497 ngx_http_set_ctx(r, status, ngx_http_scgi_module);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
498
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
499 scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
500
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
501 if (scf->scgi_lengths) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
502 if (ngx_http_scgi_eval(r, scf) != NGX_OK) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
503 return NGX_HTTP_INTERNAL_SERVER_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
504 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
505 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
506
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
507 u = r->upstream;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
508
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
509 ngx_str_set(&u->schema, "scgi://");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
510 u->output.tag = (ngx_buf_tag_t) &ngx_http_scgi_module;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
511
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
512 u->conf = &scf->upstream;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
513
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
514 #if (NGX_HTTP_CACHE)
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
515 smcf = ngx_http_get_module_main_conf(r, ngx_http_scgi_module);
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
516
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
517 u->caches = &smcf->caches;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
518 u->create_key = ngx_http_scgi_create_key;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
519 #endif
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
520
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
521 u->create_request = ngx_http_scgi_create_request;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
522 u->reinit_request = ngx_http_scgi_reinit_request;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
523 u->process_header = ngx_http_scgi_process_status_line;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
524 u->abort_request = ngx_http_scgi_abort_request;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
525 u->finalize_request = ngx_http_scgi_finalize_request;
4615
adcd60233817 Added r->state reset on fastcgi/scgi/uwsgi request start.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4593
diff changeset
526 r->state = 0;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
527
4157
9d59a8eda373 Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4015
diff changeset
528 u->buffering = scf->upstream.buffering;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
529
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
530 u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
531 if (u->pipe == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
532 return NGX_HTTP_INTERNAL_SERVER_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
533 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
534
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
535 u->pipe->input_filter = ngx_event_pipe_copy_input_filter;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
536 u->pipe->input_ctx = r;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
537
7678
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
538 u->input_filter_init = ngx_http_scgi_input_filter_init;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
539 u->input_filter = ngx_http_upstream_non_buffered_filter;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
540 u->input_filter_ctx = r;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
541
6053
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
542 if (!scf->upstream.request_buffering
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
543 && scf->upstream.pass_request_body
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
544 && !r->headers_in.chunked)
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
545 {
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
546 r->request_body_no_buffering = 1;
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
547 }
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
548
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
549 rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
550
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
551 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
552 return rc;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
553 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
554
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
555 return NGX_DONE;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
556 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
557
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
558
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
559 static ngx_int_t
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
560 ngx_http_scgi_eval(ngx_http_request_t *r, ngx_http_scgi_loc_conf_t * scf)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
561 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
562 ngx_url_t url;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
563 ngx_http_upstream_t *u;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
564
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
565 ngx_memzero(&url, sizeof(ngx_url_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
566
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
567 if (ngx_http_script_run(r, &url.url, scf->scgi_lengths->elts, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
568 scf->scgi_values->elts)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
569 == NULL)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
570 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
571 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
572 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
573
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
574 url.no_resolve = 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
575
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
576 if (ngx_parse_url(r->pool, &url) != NGX_OK) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
577 if (url.err) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
578 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
579 "%s in upstream \"%V\"", url.err, &url.url);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
580 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
581
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
582 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
583 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
584
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
585 u = r->upstream;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
586
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
587 u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
588 if (u->resolved == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
589 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
590 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
591
6784
1af120241cde Upstream: removed unnecessary condition in proxy_eval() and friends.
Ruslan Ermilov <ru@nginx.com>
parents: 6747
diff changeset
592 if (url.addrs) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
593 u->resolved->sockaddr = url.addrs[0].sockaddr;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
594 u->resolved->socklen = url.addrs[0].socklen;
6785
d1d0dd69a419 Upstream: added the ngx_http_upstream_resolved_t.name field.
Ruslan Ermilov <ru@nginx.com>
parents: 6784
diff changeset
595 u->resolved->name = url.addrs[0].name;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
596 u->resolved->naddrs = 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
597 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
598
6785
d1d0dd69a419 Upstream: added the ngx_http_upstream_resolved_t.name field.
Ruslan Ermilov <ru@nginx.com>
parents: 6784
diff changeset
599 u->resolved->host = url.host;
6303
a93345ee8f52 Upstream: fixed "no port" detection in evaluated upstreams.
Ruslan Ermilov <ru@nginx.com>
parents: 6053
diff changeset
600 u->resolved->port = url.port;
a93345ee8f52 Upstream: fixed "no port" detection in evaluated upstreams.
Ruslan Ermilov <ru@nginx.com>
parents: 6053
diff changeset
601 u->resolved->no_port = url.no_port;
a93345ee8f52 Upstream: fixed "no port" detection in evaluated upstreams.
Ruslan Ermilov <ru@nginx.com>
parents: 6053
diff changeset
602
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
603 return NGX_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
604 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
605
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
606
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
607 #if (NGX_HTTP_CACHE)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
608
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
609 static ngx_int_t
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
610 ngx_http_scgi_create_key(ngx_http_request_t *r)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
611 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
612 ngx_str_t *key;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
613 ngx_http_scgi_loc_conf_t *scf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
614
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
615 key = ngx_array_push(&r->cache->keys);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
616 if (key == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
617 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
618 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
619
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
620 scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
621
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
622 if (ngx_http_complex_value(r, &scf->cache_key, key) != NGX_OK) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
623 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
624 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
625
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
626 return NGX_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
627 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
628
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
629 #endif
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
630
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
631
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
632 static ngx_int_t
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
633 ngx_http_scgi_create_request(ngx_http_request_t *r)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
634 {
4929
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
635 off_t content_length_n;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
636 u_char ch, *key, *val, *lowcase_key;
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
637 size_t len, key_len, val_len, allocated;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
638 ngx_buf_t *b;
4929
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
639 ngx_str_t content_length;
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
640 ngx_uint_t i, n, hash, skip_empty, header_params;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
641 ngx_chain_t *cl, *body;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
642 ngx_list_part_t *part;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
643 ngx_table_elt_t *header, **ignored;
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
644 ngx_http_scgi_params_t *params;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
645 ngx_http_script_code_pt code;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
646 ngx_http_script_engine_t e, le;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
647 ngx_http_scgi_loc_conf_t *scf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
648 ngx_http_script_len_code_pt lcode;
4929
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
649 u_char buffer[NGX_OFF_T_LEN];
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
650
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
651 content_length_n = 0;
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
652 body = r->upstream->request_bufs;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
653
4929
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
654 while (body) {
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
655 content_length_n += ngx_buf_size(body->buf);
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
656 body = body->next;
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
657 }
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
658
4929
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
659 content_length.data = buffer;
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
660 content_length.len = ngx_sprintf(buffer, "%O", content_length_n) - buffer;
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
661
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
662 len = sizeof("CONTENT_LENGTH") + content_length.len + 1;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
663
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
664 header_params = 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
665 ignored = NULL;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
666
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
667 scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
668
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
669 #if (NGX_HTTP_CACHE)
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
670 params = r->upstream->cacheable ? &scf->params_cache : &scf->params;
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
671 #else
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
672 params = &scf->params;
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
673 #endif
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
674
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
675 if (params->lengths) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
676 ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
677
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
678 ngx_http_script_flush_no_cacheable_variables(r, params->flushes);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
679 le.flushed = 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
680
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
681 le.ip = params->lengths->elts;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
682 le.request = r;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
683
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
684 while (*(uintptr_t *) le.ip) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
685
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
686 lcode = *(ngx_http_script_len_code_pt *) le.ip;
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
687 key_len = lcode(&le);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
688
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
689 lcode = *(ngx_http_script_len_code_pt *) le.ip;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
690 skip_empty = lcode(&le);
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
691
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
692 for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
693 lcode = *(ngx_http_script_len_code_pt *) le.ip;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
694 }
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
695 le.ip += sizeof(uintptr_t);
4294
56cb2255735a Fixed incorrect counting the length of headers in a SCGI request.
Valentin Bartenev <vbart@nginx.com>
parents: 4278
diff changeset
696
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
697 if (skip_empty && val_len == 0) {
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
698 continue;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
699 }
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
700
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
701 len += key_len + val_len + 1;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
702 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
703 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
704
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
705 if (scf->upstream.pass_request_headers) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
706
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
707 allocated = 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
708 lowcase_key = NULL;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
709
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
710 if (params->number) {
4015
e0a435f5f504 Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3976
diff changeset
711 n = 0;
e0a435f5f504 Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3976
diff changeset
712 part = &r->headers_in.headers.part;
e0a435f5f504 Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3976
diff changeset
713
e0a435f5f504 Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3976
diff changeset
714 while (part) {
e0a435f5f504 Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3976
diff changeset
715 n += part->nelts;
e0a435f5f504 Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3976
diff changeset
716 part = part->next;
e0a435f5f504 Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3976
diff changeset
717 }
e0a435f5f504 Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3976
diff changeset
718
e0a435f5f504 Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 3976
diff changeset
719 ignored = ngx_palloc(r->pool, n * sizeof(void *));
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
720 if (ignored == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
721 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
722 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
723 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
724
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
725 part = &r->headers_in.headers.part;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
726 header = part->elts;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
727
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
728 for (i = 0; /* void */; i++) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
729
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
730 if (i >= part->nelts) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
731 if (part->next == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
732 break;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
733 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
734
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
735 part = part->next;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
736 header = part->elts;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
737 i = 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
738 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
739
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
740 if (params->number) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
741 if (allocated < header[i].key.len) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
742 allocated = header[i].key.len + 16;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
743 lowcase_key = ngx_pnalloc(r->pool, allocated);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
744 if (lowcase_key == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
745 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
746 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
747 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
748
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
749 hash = 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
750
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
751 for (n = 0; n < header[i].key.len; n++) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
752 ch = header[i].key.data[n];
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
753
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
754 if (ch >= 'A' && ch <= 'Z') {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
755 ch |= 0x20;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
756
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
757 } else if (ch == '-') {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
758 ch = '_';
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
759 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
760
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
761 hash = ngx_hash(hash, ch);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
762 lowcase_key[n] = ch;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
763 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
764
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
765 if (ngx_hash_find(&params->hash, hash, lowcase_key, n)) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
766 ignored[header_params++] = &header[i];
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
767 continue;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
768 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
769 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
770
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
771 len += sizeof("HTTP_") - 1 + header[i].key.len + 1
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
772 + header[i].value.len + 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
773 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
774 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
775
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
776 /* netstring: "length:" + packet + "," */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
777
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
778 b = ngx_create_temp_buf(r->pool, NGX_SIZE_T_LEN + 1 + len + 1);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
779 if (b == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
780 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
781 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
782
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
783 cl = ngx_alloc_chain_link(r->pool);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
784 if (cl == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
785 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
786 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
787
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
788 cl->buf = b;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
789
4929
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
790 b->last = ngx_sprintf(b->last, "%ui:CONTENT_LENGTH%Z%V%Z",
5a44d638cd27 Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4615
diff changeset
791 len, &content_length);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
792
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
793 if (params->lengths) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
794 ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
795
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
796 e.ip = params->values->elts;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
797 e.pos = b->last;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
798 e.request = r;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
799 e.flushed = 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
800
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
801 le.ip = params->lengths->elts;
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
802
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
803 while (*(uintptr_t *) le.ip) {
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
804
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
805 lcode = *(ngx_http_script_len_code_pt *) le.ip;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
806 lcode(&le); /* key length */
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
807
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
808 lcode = *(ngx_http_script_len_code_pt *) le.ip;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
809 skip_empty = lcode(&le);
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
810
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
811 for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) {
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
812 lcode = *(ngx_http_script_len_code_pt *) le.ip;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
813 }
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
814 le.ip += sizeof(uintptr_t);
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
815
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
816 if (skip_empty && val_len == 0) {
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
817 e.skip = 1;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
818
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
819 while (*(uintptr_t *) e.ip) {
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
820 code = *(ngx_http_script_code_pt *) e.ip;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
821 code((ngx_http_script_engine_t *) &e);
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
822 }
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
823 e.ip += sizeof(uintptr_t);
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
824
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
825 e.skip = 0;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
826
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
827 continue;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
828 }
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
829
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
830 #if (NGX_DEBUG)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
831 key = e.pos;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
832 #endif
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
833 code = *(ngx_http_script_code_pt *) e.ip;
7088
Maxim Dounin <mdounin@mdounin.ru>
parents: 7001
diff changeset
834 code((ngx_http_script_engine_t *) &e);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
835
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
836 #if (NGX_DEBUG)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
837 val = e.pos;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
838 #endif
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
839 while (*(uintptr_t *) e.ip) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
840 code = *(ngx_http_script_code_pt *) e.ip;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
841 code((ngx_http_script_engine_t *) &e);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
842 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
843 *e.pos++ = '\0';
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
844 e.ip += sizeof(uintptr_t);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
845
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
846 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
847 "scgi param: \"%s: %s\"", key, val);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
848 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
849
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
850 b->last = e.pos;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
851 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
852
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
853 if (scf->upstream.pass_request_headers) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
854
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
855 part = &r->headers_in.headers.part;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
856 header = part->elts;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
857
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
858 for (i = 0; /* void */; i++) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
859
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
860 if (i >= part->nelts) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
861 if (part->next == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
862 break;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
863 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
864
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
865 part = part->next;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
866 header = part->elts;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
867 i = 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
868 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
869
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
870 for (n = 0; n < header_params; n++) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
871 if (&header[i] == ignored[n]) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
872 goto next;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
873 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
874 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
875
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
876 key = b->last;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
877 b->last = ngx_cpymem(key, "HTTP_", sizeof("HTTP_") - 1);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
878
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
879 for (n = 0; n < header[i].key.len; n++) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
880 ch = header[i].key.data[n];
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
881
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
882 if (ch >= 'a' && ch <= 'z') {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
883 ch &= ~0x20;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
884
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
885 } else if (ch == '-') {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
886 ch = '_';
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
887 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
888
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
889 *b->last++ = ch;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
890 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
891
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
892 *b->last++ = (u_char) 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
893
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
894 val = b->last;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
895 b->last = ngx_copy(val, header[i].value.data, header[i].value.len);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
896 *b->last++ = (u_char) 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
897
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
898 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
899 "scgi param: \"%s: %s\"", key, val);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
900
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
901 next:
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
902
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
903 continue;
6474
Ruslan Ermilov <ru@nginx.com>
parents: 6467
diff changeset
904 }
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
905 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
906
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
907 *b->last++ = (u_char) ',';
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
908
6053
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
909 if (r->request_body_no_buffering) {
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
910 r->upstream->request_bufs = cl;
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
911
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
912 } else if (scf->upstream.pass_request_body) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
913 body = r->upstream->request_bufs;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
914 r->upstream->request_bufs = cl;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
915
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
916 while (body) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
917 b = ngx_alloc_buf(r->pool);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
918 if (b == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
919 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
920 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
921
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
922 ngx_memcpy(b, body->buf, sizeof(ngx_buf_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
923
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
924 cl->next = ngx_alloc_chain_link(r->pool);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
925 if (cl->next == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
926 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
927 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
928
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
929 cl = cl->next;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
930 cl->buf = b;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
931
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
932 body = body->next;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
933 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
934
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
935 } else {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
936 r->upstream->request_bufs = cl;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
937 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
938
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
939 cl->next = NULL;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
940
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
941 return NGX_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
942 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
943
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
944
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
945 static ngx_int_t
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
946 ngx_http_scgi_reinit_request(ngx_http_request_t *r)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
947 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
948 ngx_http_status_t *status;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
949
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
950 status = ngx_http_get_module_ctx(r, ngx_http_scgi_module);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
951
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
952 if (status == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
953 return NGX_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
954 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
955
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
956 status->code = 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
957 status->count = 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
958 status->start = NULL;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
959 status->end = NULL;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
960
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
961 r->upstream->process_header = ngx_http_scgi_process_status_line;
4615
adcd60233817 Added r->state reset on fastcgi/scgi/uwsgi request start.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4593
diff changeset
962 r->state = 0;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
963
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
964 return NGX_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
965 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
966
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
967
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
968 static ngx_int_t
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
969 ngx_http_scgi_process_status_line(ngx_http_request_t *r)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
970 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
971 size_t len;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
972 ngx_int_t rc;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
973 ngx_http_status_t *status;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
974 ngx_http_upstream_t *u;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
975
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
976 status = ngx_http_get_module_ctx(r, ngx_http_scgi_module);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
977
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
978 if (status == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
979 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
980 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
981
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
982 u = r->upstream;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
983
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
984 rc = ngx_http_parse_status_line(r, &u->buffer, status);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
985
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
986 if (rc == NGX_AGAIN) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
987 return rc;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
988 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
989
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
990 if (rc == NGX_ERROR) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
991 u->process_header = ngx_http_scgi_process_header;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
992 return ngx_http_scgi_process_header(r);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
993 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
994
5575
d15822784cf9 Upstream: fix $upstream_status variable.
Piotr Sikora <piotr@cloudflare.com>
parents: 5496
diff changeset
995 if (u->state && u->state->status == 0) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
996 u->state->status = status->code;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
997 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
998
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
999 u->headers_in.status_n = status->code;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1000
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1001 len = status->end - status->start;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1002 u->headers_in.status_line.len = len;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1003
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1004 u->headers_in.status_line.data = ngx_pnalloc(r->pool, len);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1005 if (u->headers_in.status_line.data == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1006 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1007 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1008
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1009 ngx_memcpy(u->headers_in.status_line.data, status->start, len);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1010
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1011 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1012 "http scgi status %ui \"%V\"",
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1013 u->headers_in.status_n, &u->headers_in.status_line);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1014
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1015 u->process_header = ngx_http_scgi_process_header;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1016
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1017 return ngx_http_scgi_process_header(r);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1018 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1019
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1020
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1021 static ngx_int_t
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1022 ngx_http_scgi_process_header(ngx_http_request_t *r)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1023 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1024 ngx_str_t *status_line;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1025 ngx_int_t rc, status;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1026 ngx_table_elt_t *h;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1027 ngx_http_upstream_t *u;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1028 ngx_http_upstream_header_t *hh;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1029 ngx_http_upstream_main_conf_t *umcf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1030
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1031 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1032
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1033 for ( ;; ) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1034
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1035 rc = ngx_http_parse_header_line(r, &r->upstream->buffer, 1);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1036
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1037 if (rc == NGX_OK) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1038
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1039 /* a header line has been parsed successfully */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1040
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1041 h = ngx_list_push(&r->upstream->headers_in.headers);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1042 if (h == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1043 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1044 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1045
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1046 h->hash = r->header_hash;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1047
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1048 h->key.len = r->header_name_end - r->header_name_start;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1049 h->value.len = r->header_end - r->header_start;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1050
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1051 h->key.data = ngx_pnalloc(r->pool,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1052 h->key.len + 1 + h->value.len + 1
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1053 + h->key.len);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1054 if (h->key.data == NULL) {
7001
08537eab4f23 Upstream: fixed u->headers_in.headers allocation error handling.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6966
diff changeset
1055 h->hash = 0;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1056 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1057 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1058
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1059 h->value.data = h->key.data + h->key.len + 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1060 h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1061
4529
1ebec1d15a25 Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents: 4522
diff changeset
1062 ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
1ebec1d15a25 Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents: 4522
diff changeset
1063 h->key.data[h->key.len] = '\0';
1ebec1d15a25 Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents: 4522
diff changeset
1064 ngx_memcpy(h->value.data, r->header_start, h->value.len);
1ebec1d15a25 Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents: 4522
diff changeset
1065 h->value.data[h->value.len] = '\0';
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1066
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1067 if (h->key.len == r->lowcase_index) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1068 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1069
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1070 } else {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1071 ngx_strlow(h->lowcase_key, h->key.data, h->key.len);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1072 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1073
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1074 hh = ngx_hash_find(&umcf->headers_in_hash, h->hash,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1075 h->lowcase_key, h->key.len);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1076
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1077 if (hh && hh->handler(r, h, hh->offset) != NGX_OK) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1078 return NGX_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1079 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1080
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1081 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1082 "http scgi header: \"%V: %V\"", &h->key, &h->value);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1083
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1084 continue;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1085 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1086
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1087 if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1088
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1089 /* a whole header has been parsed successfully */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1090
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1091 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1092 "http scgi header done");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1093
4371
16ebad9447ee Fixed incorrect use of r->http_version in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4331
diff changeset
1094 u = r->upstream;
16ebad9447ee Fixed incorrect use of r->http_version in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4331
diff changeset
1095
16ebad9447ee Fixed incorrect use of r->http_version in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4331
diff changeset
1096 if (u->headers_in.status_n) {
5078
10c74d3b15d1 Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5008
diff changeset
1097 goto done;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1098 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1099
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1100 if (u->headers_in.status) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1101 status_line = &u->headers_in.status->value;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1102
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1103 status = ngx_atoi(status_line->data, 3);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1104 if (status == NGX_ERROR) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1105 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1106 "upstream sent invalid status \"%V\"",
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1107 status_line);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1108 return NGX_HTTP_UPSTREAM_INVALID_HEADER;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1109 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1110
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1111 u->headers_in.status_n = status;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1112 u->headers_in.status_line = *status_line;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1113
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1114 } else if (u->headers_in.location) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1115 u->headers_in.status_n = 302;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1116 ngx_str_set(&u->headers_in.status_line,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1117 "302 Moved Temporarily");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1118
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1119 } else {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1120 u->headers_in.status_n = 200;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1121 ngx_str_set(&u->headers_in.status_line, "200 OK");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1122 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1123
5575
d15822784cf9 Upstream: fix $upstream_status variable.
Piotr Sikora <piotr@cloudflare.com>
parents: 5496
diff changeset
1124 if (u->state && u->state->status == 0) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1125 u->state->status = u->headers_in.status_n;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1126 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1127
5078
10c74d3b15d1 Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5008
diff changeset
1128 done:
10c74d3b15d1 Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5008
diff changeset
1129
10c74d3b15d1 Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5008
diff changeset
1130 if (u->headers_in.status_n == NGX_HTTP_SWITCHING_PROTOCOLS
5080
8da37c1b22a4 Trailing whitespace fix.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5078
diff changeset
1131 && r->headers_in.upgrade)
5078
10c74d3b15d1 Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5008
diff changeset
1132 {
10c74d3b15d1 Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5008
diff changeset
1133 u->upgrade = 1;
10c74d3b15d1 Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5008
diff changeset
1134 }
10c74d3b15d1 Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5008
diff changeset
1135
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1136 return NGX_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1137 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1138
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1139 if (rc == NGX_AGAIN) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1140 return NGX_AGAIN;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1141 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1142
7884
b87b7092cedb Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7678
diff changeset
1143 /* rc == NGX_HTTP_PARSE_INVALID_HEADER */
b87b7092cedb Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7678
diff changeset
1144
7933
2f443cac3f1e Upstream: fixed logging level of upstream invalid header errors.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7884
diff changeset
1145 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
7884
b87b7092cedb Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7678
diff changeset
1146 "upstream sent invalid header: \"%*s\\x%02xd...\"",
b87b7092cedb Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7678
diff changeset
1147 r->header_end - r->header_name_start,
b87b7092cedb Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7678
diff changeset
1148 r->header_name_start, *r->header_end);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1149
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1150 return NGX_HTTP_UPSTREAM_INVALID_HEADER;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1151 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1152 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1153
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1154
7678
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1155 static ngx_int_t
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1156 ngx_http_scgi_input_filter_init(void *data)
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1157 {
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1158 ngx_http_request_t *r = data;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1159 ngx_http_upstream_t *u;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1160
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1161 u = r->upstream;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1162
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1163 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1164 "http scgi filter init s:%ui l:%O",
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1165 u->headers_in.status_n, u->headers_in.content_length_n);
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1166
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1167 if (u->headers_in.status_n == NGX_HTTP_NO_CONTENT
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1168 || u->headers_in.status_n == NGX_HTTP_NOT_MODIFIED)
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1169 {
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1170 u->pipe->length = 0;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1171 u->length = 0;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1172
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1173 } else if (r->method == NGX_HTTP_HEAD) {
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1174 u->pipe->length = -1;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1175 u->length = -1;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1176
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1177 } else {
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1178 u->pipe->length = u->headers_in.content_length_n;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1179 u->length = u->headers_in.content_length_n;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1180 }
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1181
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1182 return NGX_OK;
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1183 }
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1184
bffcc5af1d72 Upstream: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7371
diff changeset
1185
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1186 static void
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1187 ngx_http_scgi_abort_request(ngx_http_request_t *r)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1188 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1189 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1190 "abort http scgi request");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1191
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1192 return;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1193 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1194
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1195
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1196 static void
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1197 ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1198 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1199 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1200 "finalize http scgi request");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1201
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1202 return;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1203 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1204
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1205
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1206 static void *
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1207 ngx_http_scgi_create_main_conf(ngx_conf_t *cf)
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1208 {
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1209 ngx_http_scgi_main_conf_t *conf;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1210
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1211 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_scgi_main_conf_t));
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1212 if (conf == NULL) {
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1213 return NULL;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1214 }
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1215
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1216 #if (NGX_HTTP_CACHE)
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1217 if (ngx_array_init(&conf->caches, cf->pool, 4,
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1218 sizeof(ngx_http_file_cache_t *))
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1219 != NGX_OK)
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1220 {
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1221 return NULL;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1222 }
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1223 #endif
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1224
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1225 return conf;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1226 }
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1227
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1228
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1229 static void *
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1230 ngx_http_scgi_create_loc_conf(ngx_conf_t *cf)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1231 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1232 ngx_http_scgi_loc_conf_t *conf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1233
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1234 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_scgi_loc_conf_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1235 if (conf == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1236 return NULL;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1237 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1238
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1239 conf->upstream.store = NGX_CONF_UNSET;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1240 conf->upstream.store_access = NGX_CONF_UNSET_UINT;
5832
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
1241 conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1242 conf->upstream.buffering = NGX_CONF_UNSET;
6053
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
1243 conf->upstream.request_buffering = NGX_CONF_UNSET;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1244 conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
5874
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
1245 conf->upstream.force_ranges = NGX_CONF_UNSET;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1246
5008
fd84344f1df7 Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents: 4947
diff changeset
1247 conf->upstream.local = NGX_CONF_UNSET_PTR;
7371
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
1248 conf->upstream.socket_keepalive = NGX_CONF_UNSET;
5008
fd84344f1df7 Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents: 4947
diff changeset
1249
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1250 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1251 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1252 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
5832
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
1253 conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1254
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1255 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1256 conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
5883
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
1257 conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1258
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1259 conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1260 conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1261 conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1262
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1263 conf->upstream.pass_request_headers = NGX_CONF_UNSET;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1264 conf->upstream.pass_request_body = NGX_CONF_UNSET;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1265
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1266 #if (NGX_HTTP_CACHE)
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1267 conf->upstream.cache = NGX_CONF_UNSET;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1268 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
6793
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
1269 conf->upstream.cache_max_range_offset = NGX_CONF_UNSET;
3699
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
1270 conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR;
3693
e3bcc2f4c418 fix scgi_no_cache and uwsgi_no_cache initialization
Igor Sysoev <igor@sysoev.ru>
parents: 3692
diff changeset
1271 conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1272 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
4386
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
1273 conf->upstream.cache_lock = NGX_CONF_UNSET;
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
1274 conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
5905
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
1275 conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC;
5441
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
1276 conf->upstream.cache_revalidate = NGX_CONF_UNSET;
6906
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
1277 conf->upstream.cache_background_update = NGX_CONF_UNSET;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1278 #endif
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1279
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1280 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1281 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1282
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1283 conf->upstream.intercept_errors = NGX_CONF_UNSET;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1284
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1285 /* "scgi_cyclic_temp_file" is disabled */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1286 conf->upstream.cyclic_temp_file = 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1287
4157
9d59a8eda373 Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4015
diff changeset
1288 conf->upstream.change_buffering = 1;
9d59a8eda373 Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4015
diff changeset
1289
3976
215fe9223419 update r3945 with more descriptive error message
Igor Sysoev <igor@sysoev.ru>
parents: 3879
diff changeset
1290 ngx_str_set(&conf->upstream.module, "scgi");
215fe9223419 update r3945 with more descriptive error message
Igor Sysoev <igor@sysoev.ru>
parents: 3879
diff changeset
1291
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1292 return conf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1293 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1294
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1295
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1296 static char *
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1297 ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1298 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1299 ngx_http_scgi_loc_conf_t *prev = parent;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1300 ngx_http_scgi_loc_conf_t *conf = child;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1301
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1302 size_t size;
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1303 ngx_int_t rc;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1304 ngx_hash_init_t hash;
3731
72cc5b789021 inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents: 3729
diff changeset
1305 ngx_http_core_loc_conf_t *clcf;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1306
5948
f2ff0aa89126 Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents: 5947
diff changeset
1307 #if (NGX_HTTP_CACHE)
f2ff0aa89126 Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents: 5947
diff changeset
1308
f2ff0aa89126 Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents: 5947
diff changeset
1309 if (conf->upstream.store > 0) {
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1310 conf->upstream.cache = 0;
5948
f2ff0aa89126 Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents: 5947
diff changeset
1311 }
f2ff0aa89126 Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents: 5947
diff changeset
1312
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1313 if (conf->upstream.cache > 0) {
5948
f2ff0aa89126 Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents: 5947
diff changeset
1314 conf->upstream.store = 0;
f2ff0aa89126 Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents: 5947
diff changeset
1315 }
f2ff0aa89126 Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents: 5947
diff changeset
1316
f2ff0aa89126 Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents: 5947
diff changeset
1317 #endif
f2ff0aa89126 Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents: 5947
diff changeset
1318
5940
e3b3b89d74e8 Upstream: fixed inheritance of proxy_store and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5938
diff changeset
1319 if (conf->upstream.store == NGX_CONF_UNSET) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1320 ngx_conf_merge_value(conf->upstream.store, prev->upstream.store, 0);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1321
5947
d9025ea1f5a5 Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents: 5940
diff changeset
1322 conf->upstream.store_lengths = prev->upstream.store_lengths;
d9025ea1f5a5 Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents: 5940
diff changeset
1323 conf->upstream.store_values = prev->upstream.store_values;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1324 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1325
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1326 ngx_conf_merge_uint_value(conf->upstream.store_access,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1327 prev->upstream.store_access, 0600);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1328
5832
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
1329 ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries,
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
1330 prev->upstream.next_upstream_tries, 0);
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
1331
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1332 ngx_conf_merge_value(conf->upstream.buffering,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1333 prev->upstream.buffering, 1);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1334
6053
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
1335 ngx_conf_merge_value(conf->upstream.request_buffering,
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
1336 prev->upstream.request_buffering, 1);
b6eb6ec4fbd9 Upstream: uwsgi_request_buffering, scgi_request_buffering.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5951
diff changeset
1337
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1338 ngx_conf_merge_value(conf->upstream.ignore_client_abort,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1339 prev->upstream.ignore_client_abort, 0);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1340
5874
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
1341 ngx_conf_merge_value(conf->upstream.force_ranges,
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
1342 prev->upstream.force_ranges, 0);
2aff40b3dea2 Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5832
diff changeset
1343
5008
fd84344f1df7 Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents: 4947
diff changeset
1344 ngx_conf_merge_ptr_value(conf->upstream.local,
fd84344f1df7 Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents: 4947
diff changeset
1345 prev->upstream.local, NULL);
fd84344f1df7 Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents: 4947
diff changeset
1346
7371
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
1347 ngx_conf_merge_value(conf->upstream.socket_keepalive,
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
1348 prev->upstream.socket_keepalive, 0);
8b68d50090e4 Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents: 7321
diff changeset
1349
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1350 ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1351 prev->upstream.connect_timeout, 60000);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1352
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1353 ngx_conf_merge_msec_value(conf->upstream.send_timeout,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1354 prev->upstream.send_timeout, 60000);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1355
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1356 ngx_conf_merge_msec_value(conf->upstream.read_timeout,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1357 prev->upstream.read_timeout, 60000);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1358
5832
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
1359 ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout,
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
1360 prev->upstream.next_upstream_timeout, 0);
d09b689911ac Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents: 5829
diff changeset
1361
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1362 ngx_conf_merge_size_value(conf->upstream.send_lowat,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1363 prev->upstream.send_lowat, 0);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1364
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1365 ngx_conf_merge_size_value(conf->upstream.buffer_size,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1366 prev->upstream.buffer_size,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1367 (size_t) ngx_pagesize);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1368
5883
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
1369 ngx_conf_merge_size_value(conf->upstream.limit_rate,
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
1370 prev->upstream.limit_rate, 0);
973ee2276300 Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5874
diff changeset
1371
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1372
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1373 ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1374 8, ngx_pagesize);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1375
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1376 if (conf->upstream.bufs.num < 2) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1377 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1378 "there must be at least 2 \"scgi_buffers\"");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1379 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1380 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1381
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1382
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1383 size = conf->upstream.buffer_size;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1384 if (size < conf->upstream.bufs.size) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1385 size = conf->upstream.bufs.size;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1386 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1387
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1388
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1389 ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1390 prev->upstream.busy_buffers_size_conf,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1391 NGX_CONF_UNSET_SIZE);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1392
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1393 if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1394 conf->upstream.busy_buffers_size = 2 * size;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1395 } else {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1396 conf->upstream.busy_buffers_size =
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1397 conf->upstream.busy_buffers_size_conf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1398 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1399
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1400 if (conf->upstream.busy_buffers_size < size) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1401 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
4593
834049edae24 Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents: 4529
diff changeset
1402 "\"scgi_busy_buffers_size\" must be equal to or greater "
834049edae24 Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents: 4529
diff changeset
1403 "than the maximum of the value of \"scgi_buffer_size\" and "
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1404 "one of the \"scgi_buffers\"");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1405
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1406 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1407 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1408
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1409 if (conf->upstream.busy_buffers_size
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1410 > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1411 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1412 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1413 "\"scgi_busy_buffers_size\" must be less than "
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1414 "the size of all \"scgi_buffers\" minus one buffer");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1415
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1416 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1417 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1418
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1419
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1420 ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1421 prev->upstream.temp_file_write_size_conf,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1422 NGX_CONF_UNSET_SIZE);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1423
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1424 if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1425 conf->upstream.temp_file_write_size = 2 * size;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1426 } else {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1427 conf->upstream.temp_file_write_size =
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1428 conf->upstream.temp_file_write_size_conf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1429 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1430
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1431 if (conf->upstream.temp_file_write_size < size) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1432 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
4593
834049edae24 Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents: 4529
diff changeset
1433 "\"scgi_temp_file_write_size\" must be equal to or greater than "
834049edae24 Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents: 4529
diff changeset
1434 "the maximum of the value of \"scgi_buffer_size\" and "
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1435 "one of the \"scgi_buffers\"");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1436
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1437 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1438 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1439
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1440
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1441 ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1442 prev->upstream.max_temp_file_size_conf,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1443 NGX_CONF_UNSET_SIZE);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1444
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1445 if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1446 conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1447 } else {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1448 conf->upstream.max_temp_file_size =
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1449 conf->upstream.max_temp_file_size_conf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1450 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1451
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1452 if (conf->upstream.max_temp_file_size != 0
5828
Maxim Dounin <mdounin@mdounin.ru>
parents: 5758
diff changeset
1453 && conf->upstream.max_temp_file_size < size)
Maxim Dounin <mdounin@mdounin.ru>
parents: 5758
diff changeset
1454 {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1455 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1456 "\"scgi_max_temp_file_size\" must be equal to zero to disable "
4593
834049edae24 Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents: 4529
diff changeset
1457 "temporary files usage or must be equal to or greater than "
834049edae24 Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents: 4529
diff changeset
1458 "the maximum of the value of \"scgi_buffer_size\" and "
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1459 "one of the \"scgi_buffers\"");
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1460
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1461 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1462 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1463
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1464
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1465 ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1466 prev->upstream.ignore_headers,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1467 NGX_CONF_BITMASK_SET);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1468
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1469
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1470 ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1471 prev->upstream.next_upstream,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1472 (NGX_CONF_BITMASK_SET
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1473 |NGX_HTTP_UPSTREAM_FT_ERROR
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1474 |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1475
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1476 if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1477 conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1478 |NGX_HTTP_UPSTREAM_FT_OFF;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1479 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1480
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1481 if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1482 prev->upstream.temp_path,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1483 &ngx_http_scgi_temp_path)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1484 != NGX_OK)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1485 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1486 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1487 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1488
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1489 #if (NGX_HTTP_CACHE)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1490
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1491 if (conf->upstream.cache == NGX_CONF_UNSET) {
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1492 ngx_conf_merge_value(conf->upstream.cache,
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1493 prev->upstream.cache, 0);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1494
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1495 conf->upstream.cache_zone = prev->upstream.cache_zone;
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1496 conf->upstream.cache_value = prev->upstream.cache_value;
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1497 }
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1498
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1499 if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1500 ngx_shm_zone_t *shm_zone;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1501
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1502 shm_zone = conf->upstream.cache_zone;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1503
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1504 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1505 "\"scgi_cache\" zone \"%V\" is unknown",
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1506 &shm_zone->shm.name);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1507
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1508 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1509 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1510
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1511 ngx_conf_merge_uint_value(conf->upstream.cache_min_uses,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1512 prev->upstream.cache_min_uses, 1);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1513
6793
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
1514 ngx_conf_merge_off_value(conf->upstream.cache_max_range_offset,
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
1515 prev->upstream.cache_max_range_offset,
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
1516 NGX_MAX_OFF_T_VALUE);
0fba3ed4e7eb Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 6785
diff changeset
1517
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1518 ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1519 prev->upstream.cache_use_stale,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1520 (NGX_CONF_BITMASK_SET
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1521 |NGX_HTTP_UPSTREAM_FT_OFF));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1522
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1523 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1524 conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1525 |NGX_HTTP_UPSTREAM_FT_OFF;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1526 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1527
4401
d45742815c90 Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4386
diff changeset
1528 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_ERROR) {
d45742815c90 Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4386
diff changeset
1529 conf->upstream.cache_use_stale |= NGX_HTTP_UPSTREAM_FT_NOLIVE;
d45742815c90 Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4386
diff changeset
1530 }
d45742815c90 Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4386
diff changeset
1531
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1532 if (conf->upstream.cache_methods == 0) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1533 conf->upstream.cache_methods = prev->upstream.cache_methods;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1534 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1535
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1536 conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1537
3699
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
1538 ngx_conf_merge_ptr_value(conf->upstream.cache_bypass,
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
1539 prev->upstream.cache_bypass, NULL);
b0a0686a85bb proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents: 3693
diff changeset
1540
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1541 ngx_conf_merge_ptr_value(conf->upstream.no_cache,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1542 prev->upstream.no_cache, NULL);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1543
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1544 ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1545 prev->upstream.cache_valid, NULL);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1546
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1547 if (conf->cache_key.value.data == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1548 conf->cache_key = prev->cache_key;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1549 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1550
5829
906530c9ffd2 Added warning about unset cache keys.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5828
diff changeset
1551 if (conf->upstream.cache && conf->cache_key.value.data == NULL) {
906530c9ffd2 Added warning about unset cache keys.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5828
diff changeset
1552 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
906530c9ffd2 Added warning about unset cache keys.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5828
diff changeset
1553 "no \"scgi_cache_key\" for \"scgi_cache\"");
906530c9ffd2 Added warning about unset cache keys.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5828
diff changeset
1554 }
906530c9ffd2 Added warning about unset cache keys.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5828
diff changeset
1555
4386
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
1556 ngx_conf_merge_value(conf->upstream.cache_lock,
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
1557 prev->upstream.cache_lock, 0);
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
1558
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
1559 ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout,
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
1560 prev->upstream.cache_lock_timeout, 5000);
92deb73393f7 Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4373
diff changeset
1561
5905
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
1562 ngx_conf_merge_msec_value(conf->upstream.cache_lock_age,
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
1563 prev->upstream.cache_lock_age, 5000);
2f7e557eab5b Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 5883
diff changeset
1564
5441
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
1565 ngx_conf_merge_value(conf->upstream.cache_revalidate,
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
1566 prev->upstream.cache_revalidate, 0);
43ccaf8e8728 Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5393
diff changeset
1567
6906
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
1568 ngx_conf_merge_value(conf->upstream.cache_background_update,
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
1569 prev->upstream.cache_background_update, 0);
1aeaae6e9446 Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents: 6793
diff changeset
1570
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1571 #endif
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1572
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1573 ngx_conf_merge_value(conf->upstream.pass_request_headers,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1574 prev->upstream.pass_request_headers, 1);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1575 ngx_conf_merge_value(conf->upstream.pass_request_body,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1576 prev->upstream.pass_request_body, 1);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1577
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1578 ngx_conf_merge_value(conf->upstream.intercept_errors,
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1579 prev->upstream.intercept_errors, 0);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1580
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1581 hash.max_size = 512;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1582 hash.bucket_size = ngx_align(64, ngx_cacheline_size);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1583 hash.name = "scgi_hide_headers_hash";
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1584
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1585 if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
3670
2728c4e4a9ae do not use a cache headers set to hide
Igor Sysoev <igor@sysoev.ru>
parents: 3668
diff changeset
1586 &prev->upstream, ngx_http_scgi_hide_headers, &hash)
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1587 != NGX_OK)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1588 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1589 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1590 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1591
5938
cd2abf7e7740 Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5937
diff changeset
1592 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
cd2abf7e7740 Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5937
diff changeset
1593
cd2abf7e7740 Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5937
diff changeset
1594 if (clcf->noname
cd2abf7e7740 Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5937
diff changeset
1595 && conf->upstream.upstream == NULL && conf->scgi_lengths == NULL)
cd2abf7e7740 Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5937
diff changeset
1596 {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1597 conf->upstream.upstream = prev->upstream.upstream;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1598 conf->scgi_lengths = prev->scgi_lengths;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1599 conf->scgi_values = prev->scgi_values;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1600 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1601
5938
cd2abf7e7740 Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5937
diff changeset
1602 if (clcf->lmt_excpt && clcf->handler == NULL
cd2abf7e7740 Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5937
diff changeset
1603 && (conf->upstream.upstream || conf->scgi_lengths))
cd2abf7e7740 Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5937
diff changeset
1604 {
cd2abf7e7740 Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5937
diff changeset
1605 clcf->handler = ngx_http_scgi_handler;
3731
72cc5b789021 inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents: 3729
diff changeset
1606 }
72cc5b789021 inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents: 3729
diff changeset
1607
5907
195561ef367f Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents: 5906
diff changeset
1608 if (conf->params_source == NULL) {
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1609 conf->params = prev->params;
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1610 #if (NGX_HTTP_CACHE)
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1611 conf->params_cache = prev->params_cache;
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1612 #endif
5907
195561ef367f Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents: 5906
diff changeset
1613 conf->params_source = prev->params_source;
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1614 }
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1615
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1616 rc = ngx_http_scgi_init_params(cf, conf, &conf->params, NULL);
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1617 if (rc != NGX_OK) {
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1618 return NGX_CONF_ERROR;
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1619 }
5907
195561ef367f Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents: 5906
diff changeset
1620
195561ef367f Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents: 5906
diff changeset
1621 #if (NGX_HTTP_CACHE)
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1622
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1623 if (conf->upstream.cache) {
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1624 rc = ngx_http_scgi_init_params(cf, conf, &conf->params_cache,
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1625 ngx_http_scgi_cache_headers);
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1626 if (rc != NGX_OK) {
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1627 return NGX_CONF_ERROR;
5907
195561ef367f Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents: 5906
diff changeset
1628 }
195561ef367f Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents: 5906
diff changeset
1629 }
195561ef367f Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents: 5906
diff changeset
1630
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1631 #endif
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1632
6747
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1633 /*
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1634 * special handling to preserve conf->params in the "http" section
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1635 * to inherit it to all servers
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1636 */
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1637
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1638 if (prev->params.hash.buckets == NULL
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1639 && conf->params_source == prev->params_source)
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1640 {
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1641 prev->params = conf->params;
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1642 #if (NGX_HTTP_CACHE)
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1643 prev->params_cache = conf->params_cache;
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1644 #endif
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1645 }
20eb4587225b Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents: 6530
diff changeset
1646
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1647 return NGX_CONF_OK;
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1648 }
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1649
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1650
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1651 static ngx_int_t
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1652 ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf,
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1653 ngx_http_scgi_params_t *params, ngx_keyval_t *default_params)
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1654 {
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1655 u_char *p;
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1656 size_t size;
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1657 uintptr_t *code;
4278
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1658 ngx_uint_t i, nsrc;
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1659 ngx_array_t headers_names, params_merged;
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1660 ngx_keyval_t *h;
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1661 ngx_hash_key_t *hk;
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1662 ngx_hash_init_t hash;
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1663 ngx_http_upstream_param_t *src, *s;
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1664 ngx_http_script_compile_t sc;
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1665 ngx_http_script_copy_code_t *copy;
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1666
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1667 if (params->hash.buckets) {
5907
195561ef367f Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents: 5906
diff changeset
1668 return NGX_OK;
4278
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1669 }
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1670
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1671 if (conf->params_source == NULL && default_params == NULL) {
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1672 params->hash.buckets = (void *) 1;
4278
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1673 return NGX_OK;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1674 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1675
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1676 params->lengths = ngx_array_create(cf->pool, 64, 1);
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1677 if (params->lengths == NULL) {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1678 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1679 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1680
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1681 params->values = ngx_array_create(cf->pool, 512, 1);
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1682 if (params->values == NULL) {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1683 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1684 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1685
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1686 if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1687 != NGX_OK)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1688 {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1689 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1690 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1691
4278
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1692 if (conf->params_source) {
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1693 src = conf->params_source->elts;
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1694 nsrc = conf->params_source->nelts;
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1695
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1696 } else {
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1697 src = NULL;
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1698 nsrc = 0;
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1699 }
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1700
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1701 if (default_params) {
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1702 if (ngx_array_init(&params_merged, cf->temp_pool, 4,
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1703 sizeof(ngx_http_upstream_param_t))
4278
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1704 != NGX_OK)
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1705 {
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1706 return NGX_ERROR;
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1707 }
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1708
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1709 for (i = 0; i < nsrc; i++) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1710
4278
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1711 s = ngx_array_push(&params_merged);
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1712 if (s == NULL) {
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1713 return NGX_ERROR;
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1714 }
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1715
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1716 *s = src[i];
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1717 }
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1718
5909
8d0cf26ce071 Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents: 5908
diff changeset
1719 h = default_params;
4278
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1720
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1721 while (h->key.len) {
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1722
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1723 src = params_merged.elts;
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1724 nsrc = params_merged.nelts;
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1725
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1726 for (i = 0; i < nsrc; i++) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1727 if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1728 goto next;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1729 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1730 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1731
4278
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1732 s = ngx_array_push(&params_merged);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1733 if (s == NULL) {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1734 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1735 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1736
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1737 s->key = h->key;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1738 s->value = h->value;
5451
e68af4e3396f Upstream: skip empty cache headers.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5441
diff changeset
1739 s->skip_empty = 1;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1740
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1741 next:
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1742
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1743 h++;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1744 }
4278
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1745
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1746 src = params_merged.elts;
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1747 nsrc = params_merged.nelts;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1748 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1749
4278
f57229cba7ad Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4277
diff changeset
1750 for (i = 0; i < nsrc; i++) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1751
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1752 if (src[i].key.len > sizeof("HTTP_") - 1
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1753 && ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1754 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1755 hk = ngx_array_push(&headers_names);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1756 if (hk == NULL) {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1757 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1758 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1759
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1760 hk->key.len = src[i].key.len - 5;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1761 hk->key.data = src[i].key.data + 5;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1762 hk->key_hash = ngx_hash_key_lc(hk->key.data, hk->key.len);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1763 hk->value = (void *) 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1764
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1765 if (src[i].value.len == 0) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1766 continue;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1767 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1768 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1769
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1770 copy = ngx_array_push_n(params->lengths,
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1771 sizeof(ngx_http_script_copy_code_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1772 if (copy == NULL) {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1773 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1774 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1775
7271
9e25a5380a21 Silenced -Wcast-function-type warnings (closes #1546).
Sergey Kandaurov <pluknet@nginx.com>
parents: 7088
diff changeset
1776 copy->code = (ngx_http_script_code_pt) (void *)
9e25a5380a21 Silenced -Wcast-function-type warnings (closes #1546).
Sergey Kandaurov <pluknet@nginx.com>
parents: 7088
diff changeset
1777 ngx_http_script_copy_len_code;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1778 copy->len = src[i].key.len + 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1779
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1780 copy = ngx_array_push_n(params->lengths,
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1781 sizeof(ngx_http_script_copy_code_t));
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1782 if (copy == NULL) {
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1783 return NGX_ERROR;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1784 }
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1785
7271
9e25a5380a21 Silenced -Wcast-function-type warnings (closes #1546).
Sergey Kandaurov <pluknet@nginx.com>
parents: 7088
diff changeset
1786 copy->code = (ngx_http_script_code_pt) (void *)
9e25a5380a21 Silenced -Wcast-function-type warnings (closes #1546).
Sergey Kandaurov <pluknet@nginx.com>
parents: 7088
diff changeset
1787 ngx_http_script_copy_len_code;
4331
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1788 copy->len = src[i].skip_empty;
059260de158d SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents: 4294
diff changeset
1789
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1790
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1791 size = (sizeof(ngx_http_script_copy_code_t)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1792 + src[i].key.len + 1 + sizeof(uintptr_t) - 1)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1793 & ~(sizeof(uintptr_t) - 1);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1794
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1795 copy = ngx_array_push_n(params->values, size);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1796 if (copy == NULL) {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1797 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1798 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1799
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1800 copy->code = ngx_http_script_copy_code;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1801 copy->len = src[i].key.len + 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1802
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1803 p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1804 (void) ngx_cpystrn(p, src[i].key.data, src[i].key.len + 1);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1805
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1806
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1807 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1808
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1809 sc.cf = cf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1810 sc.source = &src[i].value;
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1811 sc.flushes = &params->flushes;
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1812 sc.lengths = &params->lengths;
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1813 sc.values = &params->values;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1814
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1815 if (ngx_http_script_compile(&sc) != NGX_OK) {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1816 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1817 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1818
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1819 code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1820 if (code == NULL) {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1821 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1822 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1823
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1824 *code = (uintptr_t) NULL;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1825
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1826
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1827 code = ngx_array_push_n(params->values, sizeof(uintptr_t));
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1828 if (code == NULL) {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1829 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1830 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1831
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1832 *code = (uintptr_t) NULL;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1833 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1834
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1835 code = ngx_array_push_n(params->lengths, sizeof(uintptr_t));
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1836 if (code == NULL) {
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1837 return NGX_ERROR;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1838 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1839
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1840 *code = (uintptr_t) NULL;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1841
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1842 params->number = headers_names.nelts;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1843
5908
f8e80f8c7fc7 Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents: 5907
diff changeset
1844 hash.hash = &params->hash;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1845 hash.key = ngx_hash_key_lc;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1846 hash.max_size = 512;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1847 hash.bucket_size = 64;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1848 hash.name = "scgi_params_hash";
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1849 hash.pool = cf->pool;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1850 hash.temp_pool = NULL;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1851
4277
e4b8255e44c3 Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4157
diff changeset
1852 return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1853 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1854
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1855
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1856 static char *
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1857 ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1858 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1859 ngx_http_scgi_loc_conf_t *scf = conf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1860
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1861 ngx_url_t u;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1862 ngx_str_t *value, *url;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1863 ngx_uint_t n;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1864 ngx_http_core_loc_conf_t *clcf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1865 ngx_http_script_compile_t sc;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1866
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1867 if (scf->upstream.upstream || scf->scgi_lengths) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1868 return "is duplicate";
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1869 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1870
5758
f3df4e420ae7 Style: remove whitespace between function name and parentheses.
Piotr Sikora <piotr@cloudflare.com>
parents: 5738
diff changeset
1871 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1872 clcf->handler = ngx_http_scgi_handler;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1873
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1874 value = cf->args->elts;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1875
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1876 url = &value[1];
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1877
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1878 n = ngx_http_script_variables_count(url);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1879
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1880 if (n) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1881
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1882 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1883
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1884 sc.cf = cf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1885 sc.source = url;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1886 sc.lengths = &scf->scgi_lengths;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1887 sc.values = &scf->scgi_values;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1888 sc.variables = n;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1889 sc.complete_lengths = 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1890 sc.complete_values = 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1891
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1892 if (ngx_http_script_compile(&sc) != NGX_OK) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1893 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1894 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1895
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1896 return NGX_CONF_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1897 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1898
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1899 ngx_memzero(&u, sizeof(ngx_url_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1900
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1901 u.url = value[1];
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1902 u.no_resolve = 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1903
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1904 scf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1905 if (scf->upstream.upstream == NULL) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1906 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1907 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1908
7321
45e513c3540d Fixed invalid access to location defined as an empty string.
Ruslan Ermilov <ru@nginx.com>
parents: 7271
diff changeset
1909 if (clcf->name.len && clcf->name.data[clcf->name.len - 1] == '/') {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1910 clcf->auto_redirect = 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1911 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1912
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1913 return NGX_CONF_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1914 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1915
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1916
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1917 static char *
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1918 ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1919 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1920 ngx_http_scgi_loc_conf_t *scf = conf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1921
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1922 ngx_str_t *value;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1923 ngx_http_script_compile_t sc;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1924
5947
d9025ea1f5a5 Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents: 5940
diff changeset
1925 if (scf->upstream.store != NGX_CONF_UNSET) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1926 return "is duplicate";
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1927 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1928
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1929 value = cf->args->elts;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1930
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1931 if (ngx_strcmp(value[1].data, "off") == 0) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1932 scf->upstream.store = 0;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1933 return NGX_CONF_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1934 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1935
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1936 #if (NGX_HTTP_CACHE)
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1937 if (scf->upstream.cache > 0) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1938 return "is incompatible with \"scgi_cache\"";
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1939 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1940 #endif
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1941
5947
d9025ea1f5a5 Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents: 5940
diff changeset
1942 scf->upstream.store = 1;
d9025ea1f5a5 Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents: 5940
diff changeset
1943
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1944 if (ngx_strcmp(value[1].data, "on") == 0) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1945 return NGX_CONF_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1946 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1947
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1948 /* include the terminating '\0' into script */
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1949 value[1].len++;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1950
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1951 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1952
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1953 sc.cf = cf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1954 sc.source = &value[1];
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1955 sc.lengths = &scf->upstream.store_lengths;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1956 sc.values = &scf->upstream.store_values;
5496
9d056f10fb99 Style: removed surplus semicolons.
Valentin Bartenev <vbart@nginx.com>
parents: 5451
diff changeset
1957 sc.variables = ngx_http_script_variables_count(&value[1]);
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1958 sc.complete_lengths = 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1959 sc.complete_values = 1;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1960
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1961 if (ngx_http_script_compile(&sc) != NGX_OK) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1962 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1963 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1964
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1965 return NGX_CONF_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1966 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1967
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1968
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1969 #if (NGX_HTTP_CACHE)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1970
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1971 static char *
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1972 ngx_http_scgi_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1973 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1974 ngx_http_scgi_loc_conf_t *scf = conf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1975
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1976 ngx_str_t *value;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1977 ngx_http_complex_value_t cv;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1978 ngx_http_compile_complex_value_t ccv;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1979
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1980 value = cf->args->elts;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1981
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1982 if (scf->upstream.cache != NGX_CONF_UNSET) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1983 return "is duplicate";
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1984 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1985
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1986 if (ngx_strcmp(value[1].data, "off") == 0) {
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1987 scf->upstream.cache = 0;
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1988 return NGX_CONF_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1989 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1990
5947
d9025ea1f5a5 Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents: 5940
diff changeset
1991 if (scf->upstream.store > 0) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1992 return "is incompatible with \"scgi_store\"";
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1993 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1994
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1995 scf->upstream.cache = 1;
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
1996
5951
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1997 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1998
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
1999 ccv.cf = cf;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2000 ccv.value = &value[1];
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2001 ccv.complex_value = &cv;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2002
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2003 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2004 return NGX_CONF_ERROR;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2005 }
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2006
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2007 if (cv.lengths != NULL) {
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2008
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2009 scf->upstream.cache_value = ngx_palloc(cf->pool,
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2010 sizeof(ngx_http_complex_value_t));
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2011 if (scf->upstream.cache_value == NULL) {
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2012 return NGX_CONF_ERROR;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2013 }
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2014
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2015 *scf->upstream.cache_value = cv;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2016
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2017 return NGX_CONF_OK;
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2018 }
610832763648 Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5949
diff changeset
2019
5949
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
2020 scf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0,
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
2021 &ngx_http_scgi_module);
634da79665d3 Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents: 5948
diff changeset
2022 if (scf->upstream.cache_zone == NULL) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2023 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2024 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2025
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2026 return NGX_CONF_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2027 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2028
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2029
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2030 static char *
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2031 ngx_http_scgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2032 {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2033 ngx_http_scgi_loc_conf_t *scf = conf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2034
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2035 ngx_str_t *value;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2036 ngx_http_compile_complex_value_t ccv;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2037
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2038 value = cf->args->elts;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2039
4947
4251e72b8bb4 Allow the complex value to be defined as an empty string.
Ruslan Ermilov <ru@nginx.com>
parents: 4929
diff changeset
2040 if (scf->cache_key.value.data) {
3637
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2041 return "is duplicate";
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2042 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2043
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2044 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2045
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2046 ccv.cf = cf;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2047 ccv.value = &value[1];
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2048 ccv.complex_value = &scf->cache_key;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2049
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2050 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2051 return NGX_CONF_ERROR;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2052 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2053
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2054 return NGX_CONF_OK;
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2055 }
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2056
d656caa72ec9 ngx_http_scgi_module
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2057 #endif