comparison src/http/ngx_http_upstream.h @ 260:0effe91f6083 NGINX_0_5_0

nginx 0.5.0 *) Change: the parameters in the "%name" form in the "log_format" directive are not supported anymore. *) Change: the "proxy_upstream_max_fails", "proxy_upstream_fail_timeout", "fastcgi_upstream_max_fails", "fastcgi_upstream_fail_timeout", "memcached_upstream_max_fails", and "memcached_upstream_fail_timeout" directives are not supported anymore. *) Feature: the "server" directive in the "upstream" context supports the "max_fails", "fail_timeout", and "down" parameters. *) Feature: the "ip_hash" directive inside the "upstream" block. *) Feature: the WAIT status in the "Auth-Status" header line of the IMAP/POP3 proxy authentication server response. *) Bugfix: nginx could not be built on 64-bit platforms; bug appeared in 0.4.14.
author Igor Sysoev <http://sysoev.ru>
date Mon, 04 Dec 2006 00:00:00 +0300
parents 9909a161eb28
children e0b1d0a6c629
comparison
equal deleted inserted replaced
259:c68f18041059 260:0effe91f6083
42 42
43 43
44 typedef struct { 44 typedef struct {
45 ngx_hash_t headers_in_hash; 45 ngx_hash_t headers_in_hash;
46 ngx_array_t upstreams; 46 ngx_array_t upstreams;
47 /* ngx_http_upstream_srv_conf_t */ 47 /* ngx_http_upstream_srv_conf_t */
48 } ngx_http_upstream_main_conf_t; 48 } ngx_http_upstream_main_conf_t;
49 49
50 50 typedef struct ngx_http_upstream_srv_conf_s ngx_http_upstream_srv_conf_t;
51 typedef struct { 51
52 ngx_peers_t *peers; 52 typedef ngx_int_t (*ngx_http_upstream_init_pt)(ngx_conf_t *cf,
53 53 ngx_http_upstream_srv_conf_t *us);
54 ngx_array_t *servers; 54 typedef ngx_int_t (*ngx_http_upstream_init_peer_pt)(ngx_http_request_t *r,
55 55 ngx_http_upstream_srv_conf_t *us);
56
57
58 typedef struct {
59 ngx_http_upstream_init_pt init_upstream;
60 ngx_http_upstream_init_peer_pt init;
61 void *data;
62 } ngx_http_upstream_peer_t;
63
64
65 typedef struct {
66 ngx_peer_addr_t *addrs;
67 ngx_uint_t naddrs;
68 ngx_uint_t weight;
69 ngx_uint_t max_fails;
70 time_t fail_timeout;
71
72 unsigned down:1;
73 unsigned backup:1;
74 } ngx_http_upstream_server_t;
75
76
77 #define NGX_HTTP_UPSTREAM_CREATE 0x0001
78 #define NGX_HTTP_UPSTREAM_WEIGHT 0x0002
79 #define NGX_HTTP_UPSTREAM_MAX_FAILS 0x0004
80 #define NGX_HTTP_UPSTREAM_FAIL_TIMEOUT 0x0008
81 #define NGX_HTTP_UPSTREAM_DOWN 0x0010
82 #define NGX_HTTP_UPSTREAM_BACKUP 0x0020
83
84
85 struct ngx_http_upstream_srv_conf_s {
86 ngx_http_upstream_peer_t peer;
87 void **srv_conf;
88
89 ngx_array_t *servers; /* ngx_http_upstream_server_t */
90
91 ngx_uint_t flags;
56 ngx_str_t host; 92 ngx_str_t host;
57 ngx_str_t file_name; 93 ngx_str_t file_name;
58 ngx_uint_t line; 94 ngx_uint_t line;
59 in_port_t port; 95 in_port_t port;
60 } ngx_http_upstream_srv_conf_t; 96 };
61 97
62 98
63 typedef struct { 99 typedef struct {
100 ngx_http_upstream_srv_conf_t *upstream;
101
64 ngx_msec_t connect_timeout; 102 ngx_msec_t connect_timeout;
65 ngx_msec_t send_timeout; 103 ngx_msec_t send_timeout;
66 ngx_msec_t read_timeout; 104 ngx_msec_t read_timeout;
67 ngx_msec_t timeout; 105 ngx_msec_t timeout;
68 106
76 size_t busy_buffers_size_conf; 114 size_t busy_buffers_size_conf;
77 size_t max_temp_file_size_conf; 115 size_t max_temp_file_size_conf;
78 size_t temp_file_write_size_conf; 116 size_t temp_file_write_size_conf;
79 117
80 ngx_uint_t next_upstream; 118 ngx_uint_t next_upstream;
81 ngx_uint_t max_fails;
82
83 time_t fail_timeout;
84 119
85 ngx_bufs_t bufs; 120 ngx_bufs_t bufs;
86 121
87 ngx_flag_t buffering; 122 ngx_flag_t buffering;
88 ngx_flag_t pass_request_headers; 123 ngx_flag_t pass_request_headers;
211 }; 246 };
212 247
213 248
214 void ngx_http_upstream_init(ngx_http_request_t *r); 249 void ngx_http_upstream_init(ngx_http_request_t *r);
215 ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf, 250 ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf,
216 ngx_url_t *u); 251 ngx_url_t *u, ngx_uint_t flags);
252
253
254 #define ngx_http_conf_upstream_srv_conf(uscf, module) \
255 uscf->srv_conf[module.ctx_index]
217 256
218 257
219 extern ngx_module_t ngx_http_upstream_module; 258 extern ngx_module_t ngx_http_upstream_module;
220 259
221 260