Mercurial > hg > nginx-quic
annotate src/http/ngx_http_upstream.h @ 1286:a9c361479430
fix segfault when CRAM-MD5 is not enabled but client tries it
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 11 Jul 2007 07:47:57 +0000 |
parents | 4d0d12446c3b |
children | 13a4ce6e7f1e d59617e7e6a1 |
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 | |
27 #define NGX_HTTP_UPSTREAM_FT_OFF 0x80000000 | |
479 | 28 |
29 | |
30 #define NGX_HTTP_UPSTREAM_INVALID_HEADER 40 | |
31 | |
32 | |
33 typedef struct { | |
563 | 34 ngx_msec_t bl_time; |
509 | 35 ngx_uint_t bl_state; |
479 | 36 |
509 | 37 ngx_uint_t status; |
889
a9a7e4b1a72b
the previous fix does not actually fix overflow
Igor Sysoev <igor@sysoev.ru>
parents:
884
diff
changeset
|
38 time_t response_sec; |
a9a7e4b1a72b
the previous fix does not actually fix overflow
Igor Sysoev <igor@sysoev.ru>
parents:
884
diff
changeset
|
39 ngx_uint_t response_msec; |
563 | 40 |
509 | 41 ngx_str_t *peer; |
479 | 42 } ngx_http_upstream_state_t; |
43 | |
44 | |
45 typedef struct { | |
649 | 46 ngx_hash_t headers_in_hash; |
651 | 47 ngx_array_t upstreams; |
884 | 48 /* ngx_http_upstream_srv_conf_t */ |
509 | 49 } ngx_http_upstream_main_conf_t; |
50 | |
884 | 51 typedef struct ngx_http_upstream_srv_conf_s ngx_http_upstream_srv_conf_t; |
52 | |
53 typedef ngx_int_t (*ngx_http_upstream_init_pt)(ngx_conf_t *cf, | |
54 ngx_http_upstream_srv_conf_t *us); | |
55 typedef ngx_int_t (*ngx_http_upstream_init_peer_pt)(ngx_http_request_t *r, | |
56 ngx_http_upstream_srv_conf_t *us); | |
57 | |
58 | |
59 typedef struct { | |
60 ngx_http_upstream_init_pt init_upstream; | |
61 ngx_http_upstream_init_peer_pt init; | |
62 void *data; | |
63 } ngx_http_upstream_peer_t; | |
64 | |
509 | 65 |
66 typedef struct { | |
884 | 67 ngx_peer_addr_t *addrs; |
68 ngx_uint_t naddrs; | |
69 ngx_uint_t weight; | |
70 ngx_uint_t max_fails; | |
71 time_t fail_timeout; | |
72 | |
73 unsigned down:1; | |
74 unsigned backup:1; | |
75 } ngx_http_upstream_server_t; | |
76 | |
651 | 77 |
884 | 78 #define NGX_HTTP_UPSTREAM_CREATE 0x0001 |
79 #define NGX_HTTP_UPSTREAM_WEIGHT 0x0002 | |
80 #define NGX_HTTP_UPSTREAM_MAX_FAILS 0x0004 | |
81 #define NGX_HTTP_UPSTREAM_FAIL_TIMEOUT 0x0008 | |
82 #define NGX_HTTP_UPSTREAM_DOWN 0x0010 | |
83 #define NGX_HTTP_UPSTREAM_BACKUP 0x0020 | |
84 | |
651 | 85 |
884 | 86 struct ngx_http_upstream_srv_conf_s { |
87 ngx_http_upstream_peer_t peer; | |
88 void **srv_conf; | |
89 | |
90 ngx_array_t *servers; /* ngx_http_upstream_server_t */ | |
91 | |
92 ngx_uint_t flags; | |
651 | 93 ngx_str_t host; |
94 ngx_str_t file_name; | |
95 ngx_uint_t line; | |
96 in_port_t port; | |
906 | 97 in_port_t default_port; |
884 | 98 }; |
651 | 99 |
100 | |
101 typedef struct { | |
884 | 102 ngx_http_upstream_srv_conf_t *upstream; |
103 | |
509 | 104 ngx_msec_t connect_timeout; |
105 ngx_msec_t send_timeout; | |
106 ngx_msec_t read_timeout; | |
527 | 107 ngx_msec_t timeout; |
479 | 108 |
509 | 109 size_t send_lowat; |
581 | 110 size_t buffer_size; |
529 | 111 |
509 | 112 size_t busy_buffers_size; |
113 size_t max_temp_file_size; | |
114 size_t temp_file_write_size; | |
115 | |
529 | 116 size_t busy_buffers_size_conf; |
117 size_t max_temp_file_size_conf; | |
118 size_t temp_file_write_size_conf; | |
119 | |
509 | 120 ngx_uint_t next_upstream; |
479 | 121 |
509 | 122 ngx_bufs_t bufs; |
479 | 123 |
581 | 124 ngx_flag_t buffering; |
509 | 125 ngx_flag_t pass_request_headers; |
126 ngx_flag_t pass_request_body; | |
127 | |
629 | 128 ngx_flag_t ignore_client_abort; |
657 | 129 ngx_flag_t intercept_errors; |
509 | 130 ngx_flag_t cyclic_temp_file; |
479 | 131 |
649 | 132 ngx_path_t *temp_path; |
479 | 133 |
649 | 134 ngx_hash_t hide_headers_hash; |
135 ngx_array_t *hide_headers; | |
136 ngx_array_t *pass_headers; | |
509 | 137 |
138 ngx_str_t schema; | |
139 ngx_str_t uri; | |
573 | 140 ngx_str_t location; |
509 | 141 ngx_str_t url; /* used in proxy_rewrite_location */ |
577 | 142 |
675 | 143 unsigned intercept_404:1; |
649 | 144 unsigned change_buffering:1; |
581 | 145 |
577 | 146 #if (NGX_HTTP_SSL) |
147 ngx_ssl_t *ssl; | |
148 #endif | |
149 | |
479 | 150 } ngx_http_upstream_conf_t; |
151 | |
152 | |
509 | 153 typedef struct { |
154 ngx_str_t name; | |
155 ngx_http_header_handler_pt handler; | |
156 ngx_uint_t offset; | |
157 ngx_http_header_handler_pt copy_handler; | |
158 ngx_uint_t conf; | |
515 | 159 ngx_uint_t redirect; /* unsigned redirect:1; */ |
509 | 160 } ngx_http_upstream_header_t; |
161 | |
162 | |
163 typedef struct { | |
164 ngx_list_t headers; | |
165 | |
529 | 166 ngx_uint_t status_n; |
167 ngx_str_t status_line; | |
168 | |
509 | 169 ngx_table_elt_t *status; |
170 ngx_table_elt_t *date; | |
171 ngx_table_elt_t *server; | |
172 ngx_table_elt_t *connection; | |
173 | |
174 ngx_table_elt_t *expires; | |
175 ngx_table_elt_t *etag; | |
176 ngx_table_elt_t *x_accel_expires; | |
515 | 177 ngx_table_elt_t *x_accel_redirect; |
527 | 178 ngx_table_elt_t *x_accel_limit_rate; |
509 | 179 |
180 ngx_table_elt_t *content_type; | |
181 ngx_table_elt_t *content_length; | |
182 | |
183 ngx_table_elt_t *last_modified; | |
184 ngx_table_elt_t *location; | |
185 ngx_table_elt_t *accept_ranges; | |
529 | 186 ngx_table_elt_t *www_authenticate; |
509 | 187 |
188 #if (NGX_HTTP_GZIP) | |
189 ngx_table_elt_t *content_encoding; | |
190 #endif | |
191 | |
192 ngx_array_t cache_control; | |
193 } ngx_http_upstream_headers_in_t; | |
194 | |
479 | 195 |
196 struct ngx_http_upstream_s { | |
509 | 197 ngx_peer_connection_t peer; |
479 | 198 |
581 | 199 ngx_event_pipe_t *pipe; |
479 | 200 |
509 | 201 ngx_chain_t *request_bufs; |
479 | 202 |
509 | 203 ngx_output_chain_ctx_t output; |
204 ngx_chain_writer_ctx_t writer; | |
479 | 205 |
509 | 206 ngx_http_upstream_conf_t *conf; |
479 | 207 |
509 | 208 ngx_http_upstream_headers_in_t headers_in; |
209 | |
581 | 210 ngx_buf_t buffer; |
211 size_t length; | |
212 | |
213 ngx_chain_t *out_bufs; | |
214 ngx_chain_t *busy_bufs; | |
215 ngx_chain_t *free_bufs; | |
216 | |
217 ngx_int_t (*input_filter_init)(void *data); | |
218 ngx_int_t (*input_filter)(void *data, ssize_t bytes); | |
219 void *input_filter_ctx; | |
479 | 220 |
509 | 221 ngx_int_t (*create_request)(ngx_http_request_t *r); |
222 ngx_int_t (*reinit_request)(ngx_http_request_t *r); | |
223 ngx_int_t (*process_header)(ngx_http_request_t *r); | |
224 void (*abort_request)(ngx_http_request_t *r); | |
225 void (*finalize_request)(ngx_http_request_t *r, | |
226 ngx_int_t rc); | |
227 ngx_int_t (*rewrite_redirect)(ngx_http_request_t *r, | |
228 ngx_table_elt_t *h, size_t prefix); | |
479 | 229 |
527 | 230 ngx_msec_t timeout; |
231 | |
561 | 232 ngx_str_t method; |
479 | 233 |
509 | 234 ngx_http_upstream_state_t *state; |
479 | 235 |
555 | 236 ngx_str_t uri; |
237 | |
569 | 238 ngx_http_cleanup_pt *cleanup; |
239 | |
509 | 240 unsigned cachable:1; |
241 unsigned accel:1; | |
479 | 242 |
649 | 243 unsigned buffering:1; |
244 | |
509 | 245 unsigned request_sent:1; |
246 unsigned header_sent:1; | |
479 | 247 }; |
248 | |
249 | |
1162 | 250 ngx_int_t ngx_http_upstream_header_variable(ngx_http_request_t *r, |
251 ngx_http_variable_value_t *v, uintptr_t data); | |
252 | |
479 | 253 void ngx_http_upstream_init(ngx_http_request_t *r); |
651 | 254 ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf, |
884 | 255 ngx_url_t *u, ngx_uint_t flags); |
256 | |
257 | |
258 #define ngx_http_conf_upstream_srv_conf(uscf, module) \ | |
259 uscf->srv_conf[module.ctx_index] | |
509 | 260 |
479 | 261 |
509 | 262 extern ngx_module_t ngx_http_upstream_module; |
479 | 263 |
264 | |
265 #endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */ |