Mercurial > hg > nginx-quic
annotate src/http/ngx_http_upstream.h @ 1753:dd278570bdd2
bump version
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 19 Dec 2007 16:56:01 +0000 |
parents | 40d004d95d88 |
children | e5897822515f |
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; | |
151 #endif | |
152 | |
479 | 153 } ngx_http_upstream_conf_t; |
154 | |
155 | |
509 | 156 typedef struct { |
157 ngx_str_t name; | |
158 ngx_http_header_handler_pt handler; | |
159 ngx_uint_t offset; | |
160 ngx_http_header_handler_pt copy_handler; | |
161 ngx_uint_t conf; | |
515 | 162 ngx_uint_t redirect; /* unsigned redirect:1; */ |
509 | 163 } ngx_http_upstream_header_t; |
164 | |
165 | |
166 typedef struct { | |
167 ngx_list_t headers; | |
168 | |
529 | 169 ngx_uint_t status_n; |
170 ngx_str_t status_line; | |
171 | |
509 | 172 ngx_table_elt_t *status; |
173 ngx_table_elt_t *date; | |
174 ngx_table_elt_t *server; | |
175 ngx_table_elt_t *connection; | |
176 | |
177 ngx_table_elt_t *expires; | |
178 ngx_table_elt_t *etag; | |
179 ngx_table_elt_t *x_accel_expires; | |
515 | 180 ngx_table_elt_t *x_accel_redirect; |
527 | 181 ngx_table_elt_t *x_accel_limit_rate; |
509 | 182 |
183 ngx_table_elt_t *content_type; | |
184 ngx_table_elt_t *content_length; | |
185 | |
186 ngx_table_elt_t *last_modified; | |
187 ngx_table_elt_t *location; | |
188 ngx_table_elt_t *accept_ranges; | |
529 | 189 ngx_table_elt_t *www_authenticate; |
509 | 190 |
191 #if (NGX_HTTP_GZIP) | |
192 ngx_table_elt_t *content_encoding; | |
193 #endif | |
194 | |
195 ngx_array_t cache_control; | |
196 } ngx_http_upstream_headers_in_t; | |
197 | |
479 | 198 |
1658 | 199 typedef struct { |
200 ngx_str_t host; | |
201 in_port_t port; | |
202 ngx_uint_t naddrs; | |
203 in_addr_t *addrs; | |
204 ngx_resolver_ctx_t *ctx; | |
205 } ngx_http_upstream_resolved_t; | |
206 | |
207 | |
479 | 208 struct ngx_http_upstream_s { |
509 | 209 ngx_peer_connection_t peer; |
479 | 210 |
581 | 211 ngx_event_pipe_t *pipe; |
479 | 212 |
509 | 213 ngx_chain_t *request_bufs; |
479 | 214 |
509 | 215 ngx_output_chain_ctx_t output; |
216 ngx_chain_writer_ctx_t writer; | |
479 | 217 |
509 | 218 ngx_http_upstream_conf_t *conf; |
479 | 219 |
509 | 220 ngx_http_upstream_headers_in_t headers_in; |
221 | |
1658 | 222 ngx_http_upstream_resolved_t *resolved; |
223 | |
581 | 224 ngx_buf_t buffer; |
225 size_t length; | |
226 | |
227 ngx_chain_t *out_bufs; | |
228 ngx_chain_t *busy_bufs; | |
229 ngx_chain_t *free_bufs; | |
230 | |
231 ngx_int_t (*input_filter_init)(void *data); | |
232 ngx_int_t (*input_filter)(void *data, ssize_t bytes); | |
233 void *input_filter_ctx; | |
479 | 234 |
509 | 235 ngx_int_t (*create_request)(ngx_http_request_t *r); |
236 ngx_int_t (*reinit_request)(ngx_http_request_t *r); | |
237 ngx_int_t (*process_header)(ngx_http_request_t *r); | |
238 void (*abort_request)(ngx_http_request_t *r); | |
239 void (*finalize_request)(ngx_http_request_t *r, | |
240 ngx_int_t rc); | |
241 ngx_int_t (*rewrite_redirect)(ngx_http_request_t *r, | |
242 ngx_table_elt_t *h, size_t prefix); | |
479 | 243 |
527 | 244 ngx_msec_t timeout; |
245 | |
509 | 246 ngx_http_upstream_state_t *state; |
479 | 247 |
1658 | 248 ngx_str_t method; |
249 ngx_str_t schema; | |
555 | 250 ngx_str_t uri; |
251 | |
569 | 252 ngx_http_cleanup_pt *cleanup; |
253 | |
1291
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1168
diff
changeset
|
254 unsigned store:1; |
1565 | 255 unsigned cacheable:1; |
509 | 256 unsigned accel:1; |
1658 | 257 unsigned ssl:1; |
479 | 258 |
649 | 259 unsigned buffering:1; |
260 | |
509 | 261 unsigned request_sent:1; |
262 unsigned header_sent:1; | |
479 | 263 }; |
264 | |
265 | |
1162 | 266 ngx_int_t ngx_http_upstream_header_variable(ngx_http_request_t *r, |
267 ngx_http_variable_value_t *v, uintptr_t data); | |
268 | |
479 | 269 void ngx_http_upstream_init(ngx_http_request_t *r); |
651 | 270 ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf, |
884 | 271 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
|
272 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
|
273 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
|
274 ngx_str_t *default_hide_headers, ngx_hash_init_t *hash); |
884 | 275 |
276 | |
277 #define ngx_http_conf_upstream_srv_conf(uscf, module) \ | |
278 uscf->srv_conf[module.ctx_index] | |
509 | 279 |
479 | 280 |
509 | 281 extern ngx_module_t ngx_http_upstream_module; |
479 | 282 |
283 | |
284 #endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */ |