Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ngx_http_upstream.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) Igor Sysoev
4  * Copyright (C) Nginx, Inc.
5  */
6 
7 
8 #ifndef _NGX_HTTP_UPSTREAM_H_INCLUDED_
9 #define _NGX_HTTP_UPSTREAM_H_INCLUDED_
10 
11 
12 #include <ngx_config.h>
13 #include <ngx_core.h>
14 #include <ngx_event.h>
15 #include <ngx_event_connect.h>
16 #include <ngx_event_pipe.h>
17 #include <ngx_http.h>
18 
19 
20 #define NGX_HTTP_UPSTREAM_FT_ERROR 0x00000002
21 #define NGX_HTTP_UPSTREAM_FT_TIMEOUT 0x00000004
22 #define NGX_HTTP_UPSTREAM_FT_INVALID_HEADER 0x00000008
23 #define NGX_HTTP_UPSTREAM_FT_HTTP_500 0x00000010
24 #define NGX_HTTP_UPSTREAM_FT_HTTP_502 0x00000020
25 #define NGX_HTTP_UPSTREAM_FT_HTTP_503 0x00000040
26 #define NGX_HTTP_UPSTREAM_FT_HTTP_504 0x00000080
27 #define NGX_HTTP_UPSTREAM_FT_HTTP_404 0x00000100
28 #define NGX_HTTP_UPSTREAM_FT_UPDATING 0x00000200
29 #define NGX_HTTP_UPSTREAM_FT_BUSY_LOCK 0x00000400
30 #define NGX_HTTP_UPSTREAM_FT_MAX_WAITING 0x00000800
31 #define NGX_HTTP_UPSTREAM_FT_NOLIVE 0x40000000
32 #define NGX_HTTP_UPSTREAM_FT_OFF 0x80000000
33 
34 #define NGX_HTTP_UPSTREAM_FT_STATUS (NGX_HTTP_UPSTREAM_FT_HTTP_500 \
35  |NGX_HTTP_UPSTREAM_FT_HTTP_502 \
36  |NGX_HTTP_UPSTREAM_FT_HTTP_503 \
37  |NGX_HTTP_UPSTREAM_FT_HTTP_504 \
38  |NGX_HTTP_UPSTREAM_FT_HTTP_404)
39 
40 #define NGX_HTTP_UPSTREAM_INVALID_HEADER 40
41 
42 
43 #define NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT 0x00000002
44 #define NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES 0x00000004
45 #define NGX_HTTP_UPSTREAM_IGN_EXPIRES 0x00000008
46 #define NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL 0x00000010
47 #define NGX_HTTP_UPSTREAM_IGN_SET_COOKIE 0x00000020
48 #define NGX_HTTP_UPSTREAM_IGN_XA_LIMIT_RATE 0x00000040
49 #define NGX_HTTP_UPSTREAM_IGN_XA_BUFFERING 0x00000080
50 #define NGX_HTTP_UPSTREAM_IGN_XA_CHARSET 0x00000100
51 
52 
53 typedef struct {
56 
58  time_t response_sec;
61 
64 
65 
66 typedef struct {
69  /* ngx_http_upstream_srv_conf_t */
71 
73 
78 
79 
80 typedef struct {
83  void *data;
85 
86 
87 typedef struct {
92  time_t fail_timeout;
93 
94  unsigned down:1;
95  unsigned backup:1;
97 
98 
99 #define NGX_HTTP_UPSTREAM_CREATE 0x0001
100 #define NGX_HTTP_UPSTREAM_WEIGHT 0x0002
101 #define NGX_HTTP_UPSTREAM_MAX_FAILS 0x0004
102 #define NGX_HTTP_UPSTREAM_FAIL_TIMEOUT 0x0008
103 #define NGX_HTTP_UPSTREAM_DOWN 0x0010
104 #define NGX_HTTP_UPSTREAM_BACKUP 0x0020
105 
106 
109  void **srv_conf;
110 
111  ngx_array_t *servers; /* ngx_http_upstream_server_t */
112 
115  u_char *file_name;
117  in_port_t port;
118  in_port_t default_port;
119  ngx_uint_t no_port; /* unsigned no_port:1 */
120 };
121 
122 
123 typedef struct {
127 
128 
129 typedef struct {
131 
136 
137  size_t send_lowat;
138  size_t buffer_size;
139 
143 
147 
149 
156 
160 
162 
166 
168 
169 #if (NGX_HTTP_CACHE)
170  ngx_shm_zone_t *cache;
171 
172  ngx_uint_t cache_min_uses;
173  ngx_uint_t cache_use_stale;
174  ngx_uint_t cache_methods;
175 
176  ngx_flag_t cache_lock;
177  ngx_msec_t cache_lock_timeout;
178 
179  ngx_array_t *cache_valid;
180  ngx_array_t *cache_bypass;
181  ngx_array_t *no_cache;
182 #endif
183 
186 
187  signed store:2;
188  unsigned intercept_404:1;
189  unsigned change_buffering:1;
190 
191 #if (NGX_HTTP_SSL)
192  ngx_ssl_t *ssl;
193  ngx_flag_t ssl_session_reuse;
194 #endif
195 
198 
199 
200 typedef struct {
206  ngx_uint_t redirect; /* unsigned redirect:1; */
208 
209 
210 typedef struct {
212 
215 
220 
226 
229 
235 
236 #if (NGX_HTTP_GZIP)
237  ngx_table_elt_t *content_encoding;
238 #endif
239 
241 
243 
244  unsigned connection_close:1;
245  unsigned chunked:1;
247 
248 
249 typedef struct {
251  in_port_t port;
252  ngx_uint_t no_port; /* unsigned no_port:1 */
253 
255  in_addr_t *addrs;
256 
257  struct sockaddr *sockaddr;
258  socklen_t socklen;
259 
262 
263 
266 
267 
271 
273 
275 
277 
280 
282 
284 
286 
288 
290  off_t length;
291 
295 
296  ngx_int_t (*input_filter_init)(void *data);
297  ngx_int_t (*input_filter)(void *data, ssize_t bytes);
299 
300 #if (NGX_HTTP_CACHE)
301  ngx_int_t (*create_key)(ngx_http_request_t *r);
302 #endif
308  ngx_int_t rc);
310  ngx_table_elt_t *h, size_t prefix);
312  ngx_table_elt_t *h);
313 
315 
317 
321 
323 
324  unsigned store:1;
325  unsigned cacheable:1;
326  unsigned accel:1;
327  unsigned ssl:1;
328 #if (NGX_HTTP_CACHE)
329  unsigned cache_status:3;
330 #endif
331 
332  unsigned buffering:1;
333  unsigned keepalive:1;
334  unsigned upgrade:1;
335 
336  unsigned request_sent:1;
337  unsigned header_sent:1;
338 };
339 
340 
341 typedef struct {
345 
346 
347 typedef struct {
352 
353 
355  ngx_http_variable_value_t *v, uintptr_t data);
356 
360  ngx_url_t *u, ngx_uint_t flags);
362  void *conf);
364  void *conf);
367  ngx_str_t *default_hide_headers, ngx_hash_init_t *hash);
368 
369 
370 #define ngx_http_conf_upstream_srv_conf(uscf, module) \
371  uscf->srv_conf[module.ctx_index]
372 
373 
377 
378 
379 #endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */