Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 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 | |
Igor Sysoev | bb28b6d | 2006-07-11 13:20:19 +0000 | [diff] [blame] | 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 |
Igor Sysoev | 797c6ef | 2008-09-30 15:39:02 +0000 | [diff] [blame] | 23 | #define NGX_HTTP_UPSTREAM_FT_HTTP_502 0x00000020 |
| 24 | #define NGX_HTTP_UPSTREAM_FT_HTTP_503 0x00000040 |
| 25 | #define NGX_HTTP_UPSTREAM_FT_HTTP_504 0x00000080 |
| 26 | #define NGX_HTTP_UPSTREAM_FT_HTTP_404 0x00000100 |
| 27 | #define NGX_HTTP_UPSTREAM_FT_BUSY_LOCK 0x00000200 |
| 28 | #define NGX_HTTP_UPSTREAM_FT_MAX_WAITING 0x00000400 |
Igor Sysoev | 6876bcd | 2007-08-09 13:54:33 +0000 | [diff] [blame] | 29 | #define NGX_HTTP_UPSTREAM_FT_NOLIVE 0x40000000 |
Igor Sysoev | bb28b6d | 2006-07-11 13:20:19 +0000 | [diff] [blame] | 30 | #define NGX_HTTP_UPSTREAM_FT_OFF 0x80000000 |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 31 | |
Igor Sysoev | 797c6ef | 2008-09-30 15:39:02 +0000 | [diff] [blame] | 32 | #define NGX_HTTP_UPSTREAM_FT_STATUS (NGX_HTTP_UPSTREAM_FT_HTTP_500 \ |
| 33 | |NGX_HTTP_UPSTREAM_FT_HTTP_502 \ |
| 34 | |NGX_HTTP_UPSTREAM_FT_HTTP_503 \ |
| 35 | |NGX_HTTP_UPSTREAM_FT_HTTP_504 \ |
| 36 | |NGX_HTTP_UPSTREAM_FT_HTTP_404) |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 37 | |
| 38 | #define NGX_HTTP_UPSTREAM_INVALID_HEADER 40 |
| 39 | |
| 40 | |
| 41 | typedef struct { |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 42 | ngx_msec_t bl_time; |
| 43 | ngx_uint_t bl_state; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 44 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 45 | ngx_uint_t status; |
| 46 | time_t response_sec; |
| 47 | ngx_uint_t response_msec; |
Igor Sysoev | 371766c | 2008-12-11 15:30:52 +0000 | [diff] [blame] | 48 | off_t response_length; |
Igor Sysoev | c2068d0 | 2005-10-19 12:33:58 +0000 | [diff] [blame] | 49 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 50 | ngx_str_t *peer; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 51 | } ngx_http_upstream_state_t; |
| 52 | |
| 53 | |
| 54 | typedef struct { |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 55 | ngx_hash_t headers_in_hash; |
| 56 | ngx_array_t upstreams; |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 57 | /* ngx_http_upstream_srv_conf_t */ |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 58 | } ngx_http_upstream_main_conf_t; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 59 | |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 60 | typedef struct ngx_http_upstream_srv_conf_s ngx_http_upstream_srv_conf_t; |
| 61 | |
| 62 | typedef ngx_int_t (*ngx_http_upstream_init_pt)(ngx_conf_t *cf, |
| 63 | ngx_http_upstream_srv_conf_t *us); |
| 64 | typedef ngx_int_t (*ngx_http_upstream_init_peer_pt)(ngx_http_request_t *r, |
| 65 | ngx_http_upstream_srv_conf_t *us); |
| 66 | |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 67 | |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 68 | typedef struct { |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 69 | ngx_http_upstream_init_pt init_upstream; |
| 70 | ngx_http_upstream_init_peer_pt init; |
| 71 | void *data; |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 72 | } ngx_http_upstream_peer_t; |
Igor Sysoev | 6f134cc | 2006-05-23 14:54:58 +0000 | [diff] [blame] | 73 | |
Igor Sysoev | 6f134cc | 2006-05-23 14:54:58 +0000 | [diff] [blame] | 74 | |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 75 | typedef struct { |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 76 | ngx_peer_addr_t *addrs; |
| 77 | ngx_uint_t naddrs; |
| 78 | ngx_uint_t weight; |
| 79 | ngx_uint_t max_fails; |
| 80 | time_t fail_timeout; |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 81 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 82 | unsigned down:1; |
| 83 | unsigned backup:1; |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 84 | } ngx_http_upstream_server_t; |
| 85 | |
| 86 | |
| 87 | #define NGX_HTTP_UPSTREAM_CREATE 0x0001 |
| 88 | #define NGX_HTTP_UPSTREAM_WEIGHT 0x0002 |
| 89 | #define NGX_HTTP_UPSTREAM_MAX_FAILS 0x0004 |
| 90 | #define NGX_HTTP_UPSTREAM_FAIL_TIMEOUT 0x0008 |
| 91 | #define NGX_HTTP_UPSTREAM_DOWN 0x0010 |
| 92 | #define NGX_HTTP_UPSTREAM_BACKUP 0x0020 |
| 93 | |
| 94 | |
| 95 | struct ngx_http_upstream_srv_conf_s { |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 96 | ngx_http_upstream_peer_t peer; |
| 97 | void **srv_conf; |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 98 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 99 | ngx_array_t *servers; /* ngx_http_upstream_server_t */ |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 100 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 101 | ngx_uint_t flags; |
| 102 | ngx_str_t host; |
| 103 | u_char *file_name; |
| 104 | ngx_uint_t line; |
| 105 | in_port_t port; |
| 106 | in_port_t default_port; |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 107 | }; |
Igor Sysoev | 6f134cc | 2006-05-23 14:54:58 +0000 | [diff] [blame] | 108 | |
| 109 | |
| 110 | typedef struct { |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 111 | ngx_http_upstream_srv_conf_t *upstream; |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 112 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 113 | ngx_msec_t connect_timeout; |
| 114 | ngx_msec_t send_timeout; |
| 115 | ngx_msec_t read_timeout; |
| 116 | ngx_msec_t timeout; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 117 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 118 | size_t send_lowat; |
| 119 | size_t buffer_size; |
Igor Sysoev | 187b7d9 | 2005-07-14 12:51:53 +0000 | [diff] [blame] | 120 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 121 | size_t busy_buffers_size; |
| 122 | size_t max_temp_file_size; |
| 123 | size_t temp_file_write_size; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 124 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 125 | size_t busy_buffers_size_conf; |
| 126 | size_t max_temp_file_size_conf; |
| 127 | size_t temp_file_write_size_conf; |
Igor Sysoev | 187b7d9 | 2005-07-14 12:51:53 +0000 | [diff] [blame] | 128 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 129 | ngx_bufs_t bufs; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 130 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 131 | ngx_uint_t next_upstream; |
| 132 | ngx_uint_t store_access; |
| 133 | ngx_flag_t buffering; |
| 134 | ngx_flag_t pass_request_headers; |
| 135 | ngx_flag_t pass_request_body; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 136 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 137 | ngx_flag_t ignore_client_abort; |
| 138 | ngx_flag_t intercept_errors; |
| 139 | ngx_flag_t cyclic_temp_file; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 140 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 141 | ngx_path_t *temp_path; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 142 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 143 | ngx_hash_t hide_headers_hash; |
| 144 | ngx_array_t *hide_headers; |
| 145 | ngx_array_t *pass_headers; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 146 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 147 | #if (NGX_HTTP_CACHE) |
| 148 | ngx_shm_zone_t *cache; |
Igor Sysoev | 3338cfd | 2006-05-11 14:43:47 +0000 | [diff] [blame] | 149 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 150 | ngx_uint_t cache_min_uses; |
| 151 | ngx_uint_t cache_use_stale; |
Igor Sysoev | fbd9b43 | 2007-07-13 08:30:34 +0000 | [diff] [blame] | 152 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 153 | ngx_array_t *cache_valid; |
| 154 | #endif |
| 155 | |
| 156 | ngx_array_t *store_lengths; |
| 157 | ngx_array_t *store_values; |
| 158 | |
| 159 | signed store:2; |
| 160 | unsigned intercept_404:1; |
| 161 | unsigned change_buffering:1; |
Igor Sysoev | c31a9bb | 2005-11-26 10:11:11 +0000 | [diff] [blame] | 162 | |
Igor Sysoev | 0e5dc5c | 2005-11-15 13:30:52 +0000 | [diff] [blame] | 163 | #if (NGX_HTTP_SSL) |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 164 | ngx_ssl_t *ssl; |
Igor Sysoev | 916ee8e | 2008-08-17 17:47:52 +0000 | [diff] [blame] | 165 | ngx_flag_t ssl_session_reuse; |
Igor Sysoev | 0e5dc5c | 2005-11-15 13:30:52 +0000 | [diff] [blame] | 166 | #endif |
| 167 | |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 168 | } ngx_http_upstream_conf_t; |
| 169 | |
| 170 | |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 171 | typedef struct { |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 172 | ngx_str_t name; |
| 173 | ngx_http_header_handler_pt handler; |
| 174 | ngx_uint_t offset; |
| 175 | ngx_http_header_handler_pt copy_handler; |
| 176 | ngx_uint_t conf; |
| 177 | ngx_uint_t redirect; /* unsigned redirect:1; */ |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 178 | } ngx_http_upstream_header_t; |
| 179 | |
| 180 | |
| 181 | typedef struct { |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 182 | ngx_list_t headers; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 183 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 184 | ngx_uint_t status_n; |
| 185 | ngx_str_t status_line; |
Igor Sysoev | 187b7d9 | 2005-07-14 12:51:53 +0000 | [diff] [blame] | 186 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 187 | ngx_table_elt_t *status; |
| 188 | ngx_table_elt_t *date; |
| 189 | ngx_table_elt_t *server; |
| 190 | ngx_table_elt_t *connection; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 191 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 192 | ngx_table_elt_t *expires; |
| 193 | ngx_table_elt_t *etag; |
| 194 | ngx_table_elt_t *x_accel_expires; |
| 195 | ngx_table_elt_t *x_accel_redirect; |
| 196 | ngx_table_elt_t *x_accel_limit_rate; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 197 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 198 | ngx_table_elt_t *content_type; |
| 199 | ngx_table_elt_t *content_length; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 200 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 201 | ngx_table_elt_t *last_modified; |
| 202 | ngx_table_elt_t *location; |
| 203 | ngx_table_elt_t *accept_ranges; |
| 204 | ngx_table_elt_t *www_authenticate; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 205 | |
| 206 | #if (NGX_HTTP_GZIP) |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 207 | ngx_table_elt_t *content_encoding; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 208 | #endif |
| 209 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 210 | off_t content_length_n; |
Igor Sysoev | be0a61e | 2008-02-11 13:14:56 +0000 | [diff] [blame] | 211 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 212 | ngx_array_t cache_control; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 213 | } ngx_http_upstream_headers_in_t; |
| 214 | |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 215 | |
Igor Sysoev | 96dd8af | 2007-11-27 13:34:13 +0000 | [diff] [blame] | 216 | typedef struct { |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 217 | ngx_str_t host; |
| 218 | in_port_t port; |
| 219 | ngx_uint_t no_port; /* unsigned no_port:1 */ |
Igor Sysoev | 302cedc | 2008-12-23 19:35:12 +0000 | [diff] [blame] | 220 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 221 | ngx_uint_t naddrs; |
| 222 | in_addr_t *addrs; |
Igor Sysoev | 302cedc | 2008-12-23 19:35:12 +0000 | [diff] [blame] | 223 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 224 | struct sockaddr *sockaddr; |
| 225 | socklen_t socklen; |
Igor Sysoev | 302cedc | 2008-12-23 19:35:12 +0000 | [diff] [blame] | 226 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 227 | ngx_resolver_ctx_t *ctx; |
Igor Sysoev | 96dd8af | 2007-11-27 13:34:13 +0000 | [diff] [blame] | 228 | } ngx_http_upstream_resolved_t; |
| 229 | |
| 230 | |
Igor Sysoev | b9409a8 | 2008-12-09 17:25:03 +0000 | [diff] [blame] | 231 | typedef void (*ngx_http_upstream_handler_pt)(ngx_http_request_t *r, |
| 232 | ngx_http_upstream_t *u); |
| 233 | |
| 234 | |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 235 | struct ngx_http_upstream_s { |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 236 | ngx_http_upstream_handler_pt read_event_handler; |
| 237 | ngx_http_upstream_handler_pt write_event_handler; |
Igor Sysoev | 851cd73 | 2008-12-08 14:23:20 +0000 | [diff] [blame] | 238 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 239 | ngx_peer_connection_t peer; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 240 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 241 | ngx_event_pipe_t *pipe; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 242 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 243 | ngx_chain_t *request_bufs; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 244 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 245 | ngx_output_chain_ctx_t output; |
| 246 | ngx_chain_writer_ctx_t writer; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 247 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 248 | ngx_http_upstream_conf_t *conf; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 249 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 250 | ngx_http_upstream_headers_in_t headers_in; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 251 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 252 | ngx_http_upstream_resolved_t *resolved; |
Igor Sysoev | 96dd8af | 2007-11-27 13:34:13 +0000 | [diff] [blame] | 253 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 254 | ngx_buf_t buffer; |
| 255 | size_t length; |
Igor Sysoev | c31a9bb | 2005-11-26 10:11:11 +0000 | [diff] [blame] | 256 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 257 | ngx_chain_t *out_bufs; |
| 258 | ngx_chain_t *busy_bufs; |
| 259 | ngx_chain_t *free_bufs; |
Igor Sysoev | c31a9bb | 2005-11-26 10:11:11 +0000 | [diff] [blame] | 260 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 261 | ngx_int_t (*input_filter_init)(void *data); |
| 262 | ngx_int_t (*input_filter)(void *data, ssize_t bytes); |
| 263 | void *input_filter_ctx; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 264 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 265 | #if (NGX_HTTP_CACHE) |
| 266 | ngx_int_t (*create_key)(ngx_http_request_t *r); |
| 267 | #endif |
| 268 | ngx_int_t (*create_request)(ngx_http_request_t *r); |
| 269 | ngx_int_t (*reinit_request)(ngx_http_request_t *r); |
| 270 | ngx_int_t (*process_header)(ngx_http_request_t *r); |
| 271 | void (*abort_request)(ngx_http_request_t *r); |
| 272 | void (*finalize_request)(ngx_http_request_t *r, |
| 273 | ngx_int_t rc); |
| 274 | ngx_int_t (*rewrite_redirect)(ngx_http_request_t *r, |
| 275 | ngx_table_elt_t *h, size_t prefix); |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 276 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 277 | ngx_msec_t timeout; |
Igor Sysoev | 5192b36 | 2005-07-08 14:34:20 +0000 | [diff] [blame] | 278 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 279 | ngx_http_upstream_state_t *state; |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 280 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 281 | ngx_str_t method; |
| 282 | ngx_str_t schema; |
| 283 | ngx_str_t uri; |
Igor Sysoev | a257367 | 2005-10-05 14:46:21 +0000 | [diff] [blame] | 284 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 285 | ngx_http_cleanup_pt *cleanup; |
Igor Sysoev | 9ac946b | 2005-10-24 15:09:41 +0000 | [diff] [blame] | 286 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 287 | unsigned store:1; |
| 288 | unsigned cacheable:1; |
| 289 | unsigned accel:1; |
| 290 | unsigned ssl:1; |
| 291 | #if (NGX_HTTP_CACHE) |
| 292 | unsigned stale_cache:1; |
| 293 | #endif |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 294 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 295 | unsigned buffering:1; |
Igor Sysoev | 3338cfd | 2006-05-11 14:43:47 +0000 | [diff] [blame] | 296 | |
Igor Sysoev | 52859f2 | 2009-03-23 13:14:51 +0000 | [diff] [blame] | 297 | unsigned request_sent:1; |
| 298 | unsigned header_sent:1; |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 299 | }; |
| 300 | |
| 301 | |
Igor Sysoev | 797c6ef | 2008-09-30 15:39:02 +0000 | [diff] [blame] | 302 | typedef struct { |
| 303 | ngx_uint_t status; |
| 304 | ngx_uint_t mask; |
| 305 | } ngx_http_upstream_next_t; |
| 306 | |
| 307 | |
Igor Sysoev | 2723361 | 2007-04-10 07:08:06 +0000 | [diff] [blame] | 308 | ngx_int_t ngx_http_upstream_header_variable(ngx_http_request_t *r, |
| 309 | ngx_http_variable_value_t *v, uintptr_t data); |
| 310 | |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 311 | void ngx_http_upstream_init(ngx_http_request_t *r); |
Igor Sysoev | 6f134cc | 2006-05-23 14:54:58 +0000 | [diff] [blame] | 312 | ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf, |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 313 | ngx_url_t *u, ngx_uint_t flags); |
Igor Sysoev | cb54061 | 2007-12-09 18:03:20 +0000 | [diff] [blame] | 314 | ngx_int_t ngx_http_upstream_hide_headers_hash(ngx_conf_t *cf, |
| 315 | ngx_http_upstream_conf_t *conf, ngx_http_upstream_conf_t *prev, |
| 316 | ngx_str_t *default_hide_headers, ngx_hash_init_t *hash); |
Igor Sysoev | 3d2fd18 | 2006-12-04 16:46:13 +0000 | [diff] [blame] | 317 | |
| 318 | |
| 319 | #define ngx_http_conf_upstream_srv_conf(uscf, module) \ |
| 320 | uscf->srv_conf[module.ctx_index] |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 321 | |
| 322 | |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 323 | extern ngx_module_t ngx_http_upstream_module; |
| 324 | |
Igor Sysoev | 02025fd | 2005-01-18 13:03:58 +0000 | [diff] [blame] | 325 | |
| 326 | #endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */ |