Mercurial > hg > nginx-quic
annotate src/http/ngx_http_upstream.h @ 2260:4f1616b32744
ngx_http_secure_link_module
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 27 Sep 2008 13:22:10 +0000 |
parents | 274c0f3ea600 |
children | 33556140681a |
rev | line source |
---|---|
479 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #ifndef _NGX_HTTP_UPSTREAM_H_INCLUDED_ | |
8 #define _NGX_HTTP_UPSTREAM_H_INCLUDED_ | |
9 | |
10 | |
11 #include <ngx_config.h> | |
12 #include <ngx_core.h> | |
13 #include <ngx_event.h> | |
14 #include <ngx_event_connect.h> | |
15 #include <ngx_event_pipe.h> | |
16 #include <ngx_http.h> | |
17 | |
18 | |
665 | 19 #define NGX_HTTP_UPSTREAM_FT_ERROR 0x00000002 |
20 #define NGX_HTTP_UPSTREAM_FT_TIMEOUT 0x00000004 | |
21 #define NGX_HTTP_UPSTREAM_FT_INVALID_HEADER 0x00000008 | |
22 #define NGX_HTTP_UPSTREAM_FT_HTTP_500 0x00000010 | |
23 #define NGX_HTTP_UPSTREAM_FT_HTTP_503 0x00000020 | |
24 #define NGX_HTTP_UPSTREAM_FT_HTTP_404 0x00000040 | |
25 #define NGX_HTTP_UPSTREAM_FT_BUSY_LOCK 0x00000080 | |
26 #define NGX_HTTP_UPSTREAM_FT_MAX_WAITING 0x00000100 | |
1378 | 27 #define NGX_HTTP_UPSTREAM_FT_NOLIVE 0x40000000 |
665 | 28 #define NGX_HTTP_UPSTREAM_FT_OFF 0x80000000 |
479 | 29 |
30 | |
31 #define NGX_HTTP_UPSTREAM_INVALID_HEADER 40 | |
32 | |
33 | |
34 typedef struct { | |
563 | 35 ngx_msec_t bl_time; |
509 | 36 ngx_uint_t bl_state; |
479 | 37 |
509 | 38 ngx_uint_t status; |
889
a9a7e4b1a72b
the previous fix does not actually fix overflow
Igor Sysoev <igor@sysoev.ru>
parents:
884
diff
changeset
|
39 time_t response_sec; |
a9a7e4b1a72b
the previous fix does not actually fix overflow
Igor Sysoev <igor@sysoev.ru>
parents:
884
diff
changeset
|
40 ngx_uint_t response_msec; |
563 | 41 |
509 | 42 ngx_str_t *peer; |
479 | 43 } ngx_http_upstream_state_t; |
44 | |
45 | |
46 typedef struct { | |
649 | 47 ngx_hash_t headers_in_hash; |
651 | 48 ngx_array_t upstreams; |
884 | 49 /* ngx_http_upstream_srv_conf_t */ |
509 | 50 } ngx_http_upstream_main_conf_t; |
51 | |
884 | 52 typedef struct ngx_http_upstream_srv_conf_s ngx_http_upstream_srv_conf_t; |
53 | |
54 typedef ngx_int_t (*ngx_http_upstream_init_pt)(ngx_conf_t *cf, | |
55 ngx_http_upstream_srv_conf_t *us); | |
56 typedef ngx_int_t (*ngx_http_upstream_init_peer_pt)(ngx_http_request_t *r, | |
57 ngx_http_upstream_srv_conf_t *us); | |
58 | |
59 | |
60 typedef struct { | |
61 ngx_http_upstream_init_pt init_upstream; | |
62 ngx_http_upstream_init_peer_pt init; | |
63 void *data; | |
64 } ngx_http_upstream_peer_t; | |
65 | |
509 | 66 |
67 typedef struct { | |
884 | 68 ngx_peer_addr_t *addrs; |
69 ngx_uint_t naddrs; | |
70 ngx_uint_t weight; | |
71 ngx_uint_t max_fails; | |
72 time_t fail_timeout; | |
73 | |
74 unsigned down:1; | |
75 unsigned backup:1; | |
76 } ngx_http_upstream_server_t; | |
77 | |
651 | 78 |
884 | 79 #define NGX_HTTP_UPSTREAM_CREATE 0x0001 |
80 #define NGX_HTTP_UPSTREAM_WEIGHT 0x0002 | |
81 #define NGX_HTTP_UPSTREAM_MAX_FAILS 0x0004 | |
82 #define NGX_HTTP_UPSTREAM_FAIL_TIMEOUT 0x0008 | |
83 #define NGX_HTTP_UPSTREAM_DOWN 0x0010 | |
84 #define NGX_HTTP_UPSTREAM_BACKUP 0x0020 | |
85 | |
651 | 86 |
884 | 87 struct ngx_http_upstream_srv_conf_s { |
88 ngx_http_upstream_peer_t peer; | |
89 void **srv_conf; | |
90 | |
91 ngx_array_t *servers; /* ngx_http_upstream_server_t */ | |
92 | |
93 ngx_uint_t flags; | |
651 | 94 ngx_str_t host; |
1489
56f1ea5baabb
u_char* is enough to keep file name
Igor Sysoev <igor@sysoev.ru>
parents:
1378
diff
changeset
|
95 u_char *file_name; |
651 | 96 ngx_uint_t line; |
97 in_port_t port; | |
906 | 98 in_port_t default_port; |
884 | 99 }; |
651 | 100 |
101 | |
102 typedef struct { | |
884 | 103 ngx_http_upstream_srv_conf_t *upstream; |
104 | |
509 | 105 ngx_msec_t connect_timeout; |
106 ngx_msec_t send_timeout; | |
107 ngx_msec_t read_timeout; | |
527 | 108 ngx_msec_t timeout; |
479 | 109 |
509 | 110 size_t send_lowat; |
581 | 111 size_t buffer_size; |
529 | 112 |
509 | 113 size_t busy_buffers_size; |
114 size_t max_temp_file_size; | |
115 size_t temp_file_write_size; | |
116 | |
529 | 117 size_t busy_buffers_size_conf; |
118 size_t max_temp_file_size_conf; | |
119 size_t temp_file_write_size_conf; | |
120 | |
509 | 121 ngx_uint_t next_upstream; |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
122 ngx_uint_t store_access; |
479 | 123 |
509 | 124 ngx_bufs_t bufs; |
479 | 125 |
581 | 126 ngx_flag_t buffering; |
509 | 127 ngx_flag_t pass_request_headers; |
128 ngx_flag_t pass_request_body; | |
129 | |
629 | 130 ngx_flag_t ignore_client_abort; |
657 | 131 ngx_flag_t intercept_errors; |
509 | 132 ngx_flag_t cyclic_temp_file; |
479 | 133 |
649 | 134 ngx_path_t *temp_path; |
479 | 135 |
649 | 136 ngx_hash_t hide_headers_hash; |
137 ngx_array_t *hide_headers; | |
138 ngx_array_t *pass_headers; | |
509 | 139 |
140 ngx_str_t schema; | |
577 | 141 |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
142 ngx_array_t *store_lengths; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
143 ngx_array_t *store_values; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
144 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
145 signed store:2; |
675 | 146 unsigned intercept_404:1; |
649 | 147 unsigned change_buffering:1; |
581 | 148 |
577 | 149 #if (NGX_HTTP_SSL) |
150 ngx_ssl_t *ssl; | |
2184 | 151 ngx_flag_t ssl_session_reuse; |
577 | 152 #endif |
153 | |
479 | 154 } ngx_http_upstream_conf_t; |
155 | |
156 | |
509 | 157 typedef struct { |
158 ngx_str_t name; | |
159 ngx_http_header_handler_pt handler; | |
160 ngx_uint_t offset; | |
161 ngx_http_header_handler_pt copy_handler; | |
162 ngx_uint_t conf; | |
515 | 163 ngx_uint_t redirect; /* unsigned redirect:1; */ |
509 | 164 } ngx_http_upstream_header_t; |
165 | |
166 | |
167 typedef struct { | |
168 ngx_list_t headers; | |
169 | |
529 | 170 ngx_uint_t status_n; |
171 ngx_str_t status_line; | |
172 | |
509 | 173 ngx_table_elt_t *status; |
174 ngx_table_elt_t *date; | |
175 ngx_table_elt_t *server; | |
176 ngx_table_elt_t *connection; | |
177 | |
178 ngx_table_elt_t *expires; | |
179 ngx_table_elt_t *etag; | |
180 ngx_table_elt_t *x_accel_expires; | |
515 | 181 ngx_table_elt_t *x_accel_redirect; |
527 | 182 ngx_table_elt_t *x_accel_limit_rate; |
509 | 183 |
184 ngx_table_elt_t *content_type; | |
185 ngx_table_elt_t *content_length; | |
186 | |
187 ngx_table_elt_t *last_modified; | |
188 ngx_table_elt_t *location; | |
189 ngx_table_elt_t *accept_ranges; | |
529 | 190 ngx_table_elt_t *www_authenticate; |
509 | 191 |
192 #if (NGX_HTTP_GZIP) | |
193 ngx_table_elt_t *content_encoding; | |
194 #endif | |
195 | |
1885
e5897822515f
test response length in proxy/fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1701
diff
changeset
|
196 off_t content_length_n; |
e5897822515f
test response length in proxy/fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1701
diff
changeset
|
197 |
509 | 198 ngx_array_t cache_control; |
199 } ngx_http_upstream_headers_in_t; | |
200 | |
479 | 201 |
1658 | 202 typedef struct { |
203 ngx_str_t host; | |
204 in_port_t port; | |
1912 | 205 ngx_uint_t default_port; /* unsigned default_port:1 */ |
1658 | 206 ngx_uint_t naddrs; |
207 in_addr_t *addrs; | |
208 ngx_resolver_ctx_t *ctx; | |
209 } ngx_http_upstream_resolved_t; | |
210 | |
211 | |
479 | 212 struct ngx_http_upstream_s { |
509 | 213 ngx_peer_connection_t peer; |
479 | 214 |
581 | 215 ngx_event_pipe_t *pipe; |
479 | 216 |
509 | 217 ngx_chain_t *request_bufs; |
479 | 218 |
509 | 219 ngx_output_chain_ctx_t output; |
220 ngx_chain_writer_ctx_t writer; | |
479 | 221 |
509 | 222 ngx_http_upstream_conf_t *conf; |
479 | 223 |
509 | 224 ngx_http_upstream_headers_in_t headers_in; |
225 | |
1658 | 226 ngx_http_upstream_resolved_t *resolved; |
227 | |
581 | 228 ngx_buf_t buffer; |
229 size_t length; | |
230 | |
231 ngx_chain_t *out_bufs; | |
232 ngx_chain_t *busy_bufs; | |
233 ngx_chain_t *free_bufs; | |
234 | |
235 ngx_int_t (*input_filter_init)(void *data); | |
236 ngx_int_t (*input_filter)(void *data, ssize_t bytes); | |
237 void *input_filter_ctx; | |
479 | 238 |
509 | 239 ngx_int_t (*create_request)(ngx_http_request_t *r); |
240 ngx_int_t (*reinit_request)(ngx_http_request_t *r); | |
241 ngx_int_t (*process_header)(ngx_http_request_t *r); | |
242 void (*abort_request)(ngx_http_request_t *r); | |
243 void (*finalize_request)(ngx_http_request_t *r, | |
244 ngx_int_t rc); | |
245 ngx_int_t (*rewrite_redirect)(ngx_http_request_t *r, | |
246 ngx_table_elt_t *h, size_t prefix); | |
479 | 247 |
527 | 248 ngx_msec_t timeout; |
249 | |
509 | 250 ngx_http_upstream_state_t *state; |
479 | 251 |
1658 | 252 ngx_str_t method; |
253 ngx_str_t schema; | |
555 | 254 ngx_str_t uri; |
255 | |
569 | 256 ngx_http_cleanup_pt *cleanup; |
257 | |
1291
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1168
diff
changeset
|
258 unsigned store:1; |
1565 | 259 unsigned cacheable:1; |
509 | 260 unsigned accel:1; |
1658 | 261 unsigned ssl:1; |
479 | 262 |
649 | 263 unsigned buffering:1; |
264 | |
509 | 265 unsigned request_sent:1; |
266 unsigned header_sent:1; | |
479 | 267 }; |
268 | |
269 | |
1162 | 270 ngx_int_t ngx_http_upstream_header_variable(ngx_http_request_t *r, |
271 ngx_http_variable_value_t *v, uintptr_t data); | |
272 | |
479 | 273 void ngx_http_upstream_init(ngx_http_request_t *r); |
651 | 274 ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf, |
884 | 275 ngx_url_t *u, ngx_uint_t flags); |
1701
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1658
diff
changeset
|
276 ngx_int_t ngx_http_upstream_hide_headers_hash(ngx_conf_t *cf, |
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1658
diff
changeset
|
277 ngx_http_upstream_conf_t *conf, ngx_http_upstream_conf_t *prev, |
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1658
diff
changeset
|
278 ngx_str_t *default_hide_headers, ngx_hash_init_t *hash); |
884 | 279 |
280 | |
281 #define ngx_http_conf_upstream_srv_conf(uscf, module) \ | |
282 uscf->srv_conf[module.ctx_index] | |
509 | 283 |
479 | 284 |
509 | 285 extern ngx_module_t ngx_http_upstream_module; |
479 | 286 |
287 | |
288 #endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */ |