Mercurial > hg > nginx-quic
annotate src/http/ngx_http_upstream.h @ 1574:6a60502db714
use ngx_sha1.h
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 16 Oct 2007 12:17:11 +0000 |
parents | 4c43e25d11ea |
children | 13f8dec720b5 |
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; | |
141 ngx_str_t uri; | |
573 | 142 ngx_str_t location; |
509 | 143 ngx_str_t url; /* used in proxy_rewrite_location */ |
577 | 144 |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
145 ngx_array_t *store_lengths; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
146 ngx_array_t *store_values; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
147 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
148 signed store:2; |
675 | 149 unsigned intercept_404:1; |
649 | 150 unsigned change_buffering:1; |
581 | 151 |
577 | 152 #if (NGX_HTTP_SSL) |
153 ngx_ssl_t *ssl; | |
154 #endif | |
155 | |
479 | 156 } ngx_http_upstream_conf_t; |
157 | |
158 | |
509 | 159 typedef struct { |
160 ngx_str_t name; | |
161 ngx_http_header_handler_pt handler; | |
162 ngx_uint_t offset; | |
163 ngx_http_header_handler_pt copy_handler; | |
164 ngx_uint_t conf; | |
515 | 165 ngx_uint_t redirect; /* unsigned redirect:1; */ |
509 | 166 } ngx_http_upstream_header_t; |
167 | |
168 | |
169 typedef struct { | |
170 ngx_list_t headers; | |
171 | |
529 | 172 ngx_uint_t status_n; |
173 ngx_str_t status_line; | |
174 | |
509 | 175 ngx_table_elt_t *status; |
176 ngx_table_elt_t *date; | |
177 ngx_table_elt_t *server; | |
178 ngx_table_elt_t *connection; | |
179 | |
180 ngx_table_elt_t *expires; | |
181 ngx_table_elt_t *etag; | |
182 ngx_table_elt_t *x_accel_expires; | |
515 | 183 ngx_table_elt_t *x_accel_redirect; |
527 | 184 ngx_table_elt_t *x_accel_limit_rate; |
509 | 185 |
186 ngx_table_elt_t *content_type; | |
187 ngx_table_elt_t *content_length; | |
188 | |
189 ngx_table_elt_t *last_modified; | |
190 ngx_table_elt_t *location; | |
191 ngx_table_elt_t *accept_ranges; | |
529 | 192 ngx_table_elt_t *www_authenticate; |
509 | 193 |
194 #if (NGX_HTTP_GZIP) | |
195 ngx_table_elt_t *content_encoding; | |
196 #endif | |
197 | |
198 ngx_array_t cache_control; | |
199 } ngx_http_upstream_headers_in_t; | |
200 | |
479 | 201 |
202 struct ngx_http_upstream_s { | |
509 | 203 ngx_peer_connection_t peer; |
479 | 204 |
581 | 205 ngx_event_pipe_t *pipe; |
479 | 206 |
509 | 207 ngx_chain_t *request_bufs; |
479 | 208 |
509 | 209 ngx_output_chain_ctx_t output; |
210 ngx_chain_writer_ctx_t writer; | |
479 | 211 |
509 | 212 ngx_http_upstream_conf_t *conf; |
479 | 213 |
509 | 214 ngx_http_upstream_headers_in_t headers_in; |
215 | |
581 | 216 ngx_buf_t buffer; |
217 size_t length; | |
218 | |
219 ngx_chain_t *out_bufs; | |
220 ngx_chain_t *busy_bufs; | |
221 ngx_chain_t *free_bufs; | |
222 | |
223 ngx_int_t (*input_filter_init)(void *data); | |
224 ngx_int_t (*input_filter)(void *data, ssize_t bytes); | |
225 void *input_filter_ctx; | |
479 | 226 |
509 | 227 ngx_int_t (*create_request)(ngx_http_request_t *r); |
228 ngx_int_t (*reinit_request)(ngx_http_request_t *r); | |
229 ngx_int_t (*process_header)(ngx_http_request_t *r); | |
230 void (*abort_request)(ngx_http_request_t *r); | |
231 void (*finalize_request)(ngx_http_request_t *r, | |
232 ngx_int_t rc); | |
233 ngx_int_t (*rewrite_redirect)(ngx_http_request_t *r, | |
234 ngx_table_elt_t *h, size_t prefix); | |
479 | 235 |
527 | 236 ngx_msec_t timeout; |
237 | |
561 | 238 ngx_str_t method; |
479 | 239 |
509 | 240 ngx_http_upstream_state_t *state; |
479 | 241 |
555 | 242 ngx_str_t uri; |
243 | |
569 | 244 ngx_http_cleanup_pt *cleanup; |
245 | |
1291
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1168
diff
changeset
|
246 unsigned store:1; |
1565 | 247 unsigned cacheable:1; |
509 | 248 unsigned accel:1; |
479 | 249 |
649 | 250 unsigned buffering:1; |
251 | |
509 | 252 unsigned request_sent:1; |
253 unsigned header_sent:1; | |
479 | 254 }; |
255 | |
256 | |
1162 | 257 ngx_int_t ngx_http_upstream_header_variable(ngx_http_request_t *r, |
258 ngx_http_variable_value_t *v, uintptr_t data); | |
259 | |
479 | 260 void ngx_http_upstream_init(ngx_http_request_t *r); |
651 | 261 ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf, |
884 | 262 ngx_url_t *u, ngx_uint_t flags); |
263 | |
264 | |
265 #define ngx_http_conf_upstream_srv_conf(uscf, module) \ | |
266 uscf->srv_conf[module.ctx_index] | |
509 | 267 |
479 | 268 |
509 | 269 extern ngx_module_t ngx_http_upstream_module; |
479 | 270 |
271 | |
272 #endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */ |