Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ngx_http_core_module.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_CORE_H_INCLUDED_
9 #define _NGX_HTTP_CORE_H_INCLUDED_
10 
11 
12 #include <ngx_config.h>
13 #include <ngx_core.h>
14 #include <ngx_http.h>
15 
16 
17 #define NGX_HTTP_GZIP_PROXIED_OFF 0x0002
18 #define NGX_HTTP_GZIP_PROXIED_EXPIRED 0x0004
19 #define NGX_HTTP_GZIP_PROXIED_NO_CACHE 0x0008
20 #define NGX_HTTP_GZIP_PROXIED_NO_STORE 0x0010
21 #define NGX_HTTP_GZIP_PROXIED_PRIVATE 0x0020
22 #define NGX_HTTP_GZIP_PROXIED_NO_LM 0x0040
23 #define NGX_HTTP_GZIP_PROXIED_NO_ETAG 0x0080
24 #define NGX_HTTP_GZIP_PROXIED_AUTH 0x0100
25 #define NGX_HTTP_GZIP_PROXIED_ANY 0x0200
26 
27 
28 #define NGX_HTTP_AIO_OFF 0
29 #define NGX_HTTP_AIO_ON 1
30 #define NGX_HTTP_AIO_SENDFILE 2
31 
32 
33 #define NGX_HTTP_SATISFY_ALL 0
34 #define NGX_HTTP_SATISFY_ANY 1
35 
36 
37 #define NGX_HTTP_LINGERING_OFF 0
38 #define NGX_HTTP_LINGERING_ON 1
39 #define NGX_HTTP_LINGERING_ALWAYS 2
40 
41 
42 #define NGX_HTTP_IMS_OFF 0
43 #define NGX_HTTP_IMS_EXACT 1
44 #define NGX_HTTP_IMS_BEFORE 2
45 
46 
47 #define NGX_HTTP_KEEPALIVE_DISABLE_NONE 0x0002
48 #define NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 0x0004
49 #define NGX_HTTP_KEEPALIVE_DISABLE_SAFARI 0x0008
50 
51 
54 
55 
56 typedef struct {
57  union {
58  struct sockaddr sockaddr;
59  struct sockaddr_in sockaddr_in;
60 #if (NGX_HAVE_INET6)
61  struct sockaddr_in6 sockaddr_in6;
62 #endif
63 #if (NGX_HAVE_UNIX_DOMAIN)
64  struct sockaddr_un sockaddr_un;
65 #endif
66  u_char sockaddr_data[NGX_SOCKADDRLEN];
67  } u;
68 
69  socklen_t socklen;
70 
71  unsigned set:1;
72  unsigned default_server:1;
73  unsigned bind:1;
74  unsigned wildcard:1;
75 #if (NGX_HTTP_SSL)
76  unsigned ssl:1;
77 #endif
78 #if (NGX_HTTP_SPDY)
79  unsigned spdy:1;
80 #endif
81 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
82  unsigned ipv6only:1;
83 #endif
84  unsigned so_keepalive:2;
85 
86  int backlog;
87  int rcvbuf;
88  int sndbuf;
89 #if (NGX_HAVE_SETFIB)
90  int setfib;
91 #endif
92 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
93  int tcp_keepidle;
94  int tcp_keepintvl;
95  int tcp_keepcnt;
96 #endif
97 
98 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
99  char *accept_filter;
100 #endif
101 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
102  ngx_uint_t deferred_accept;
103 #endif
104 
105  u_char addr[NGX_SOCKADDR_STRLEN + 1];
107 
108 
109 typedef enum {
111 
113 
117 
119 
122 
125 
128 
130 
133 
138 };
139 
140 
141 typedef struct {
146 
147 
148 typedef struct {
151 
152 
153 typedef struct {
154  ngx_array_t servers; /* ngx_http_core_srv_conf_t */
155 
157 
159 
161 
162  ngx_array_t variables; /* ngx_http_variable_t */
164 
167 
170 
172 
174 
175  ngx_uint_t try_files; /* unsigned try_files:1 */
176 
179 
180 
181 typedef struct {
182  /* array of the ngx_http_server_name_t, "server_name" directive */
184 
185  /* server ctx */
187 
189 
193 
195 
197 
201 
202  unsigned listen:1;
203 #if (NGX_PCRE)
204  unsigned captures:1;
205 #endif
206 
209 
210 
211 /* list of structures to find core_srv_conf quickly at run time */
212 
213 
214 typedef struct {
215 #if (NGX_PCRE)
216  ngx_http_regex_t *regex;
217 #endif
218  ngx_http_core_srv_conf_t *server; /* virtual name server conf */
221 
222 
223 typedef struct {
225 
229 
230 
232  /* the default server configuration for this address:port */
234 
236 
237 #if (NGX_HTTP_SSL)
238  unsigned ssl:1;
239 #endif
240 #if (NGX_HTTP_SPDY)
241  unsigned spdy:1;
242 #endif
243 };
244 
245 
246 typedef struct {
247  in_addr_t addr;
250 
251 
252 #if (NGX_HAVE_INET6)
253 
254 typedef struct {
255  struct in6_addr addr6;
257 } ngx_http_in6_addr_t;
258 
259 #endif
260 
261 
262 typedef struct {
263  /* ngx_http_in_addr_t or ngx_http_in6_addr_t */
264  void *addrs;
267 
268 
269 typedef struct {
271  in_port_t port;
272  ngx_array_t addrs; /* array of ngx_http_conf_addr_t */
274 
275 
276 typedef struct {
278 
282 
283 #if (NGX_PCRE)
284  ngx_uint_t nregex;
285  ngx_http_server_name_t *regex;
286 #endif
287 
288  /* the default server configuration for this address:port */
290  ngx_array_t servers; /* array of ngx_http_core_srv_conf_t */
292 
293 
294 typedef struct {
300 
301 
302 typedef struct {
306 
307  unsigned code:10;
308  unsigned test_dir:1;
310 
311 
313  ngx_str_t name; /* location name */
314 
315 #if (NGX_PCRE)
316  ngx_http_regex_t *regex;
317 #endif
318 
319  unsigned noname:1; /* "if () {}" block or limit_except */
320  unsigned lmt_excpt:1;
321  unsigned named:1;
322 
323  unsigned exact_match:1;
324  unsigned noregex:1;
325 
326  unsigned auto_redirect:1;
327 #if (NGX_HTTP_GZIP)
328  unsigned gzip_disable_msie6:2;
329 #if (NGX_HTTP_DEGRADATION)
330  unsigned gzip_disable_degradation:2;
331 #endif
332 #endif
333 
335 #if (NGX_PCRE)
336  ngx_http_core_loc_conf_t **regex_locations;
337 #endif
338 
339  /* pointer to the modules' loc_conf */
340  void **loc_conf;
341 
342  uint32_t limit_except;
344 
346 
347  /* location name length for inclusive location with inherited alias */
348  size_t alias;
349  ngx_str_t root; /* root, alias */
351 
354 
358 
359  off_t client_max_body_size; /* client_max_body_size */
360  off_t directio; /* directio */
361  off_t directio_alignment; /* directio_alignment */
362 
363  size_t client_body_buffer_size; /* client_body_buffer_size */
364  size_t send_lowat; /* send_lowat */
365  size_t postpone_output; /* postpone_output */
366  size_t limit_rate; /* limit_rate */
367  size_t limit_rate_after; /* limit_rate_after */
368  size_t sendfile_max_chunk; /* sendfile_max_chunk */
369  size_t read_ahead; /* read_ahead */
370 
371  ngx_msec_t client_body_timeout; /* client_body_timeout */
372  ngx_msec_t send_timeout; /* send_timeout */
373  ngx_msec_t keepalive_timeout; /* keepalive_timeout */
374  ngx_msec_t lingering_time; /* lingering_time */
375  ngx_msec_t lingering_timeout; /* lingering_timeout */
376  ngx_msec_t resolver_timeout; /* resolver_timeout */
377 
378  ngx_resolver_t *resolver; /* resolver */
379 
380  time_t keepalive_header; /* keepalive_timeout */
381 
382  ngx_uint_t keepalive_requests; /* keepalive_requests */
383  ngx_uint_t keepalive_disable; /* keepalive_disable */
384  ngx_uint_t satisfy; /* satisfy */
385  ngx_uint_t lingering_close; /* lingering_close */
386  ngx_uint_t if_modified_since; /* if_modified_since */
387  ngx_uint_t max_ranges; /* max_ranges */
388  ngx_uint_t client_body_in_file_only; /* client_body_in_file_only */
389 
391  /* client_body_in_singe_buffer */
392  ngx_flag_t internal; /* internal */
393  ngx_flag_t sendfile; /* sendfile */
394 #if (NGX_HAVE_FILE_AIO)
395  ngx_flag_t aio; /* aio */
396 #endif
397  ngx_flag_t tcp_nopush; /* tcp_nopush */
398  ngx_flag_t tcp_nodelay; /* tcp_nodelay */
399  ngx_flag_t reset_timedout_connection; /* reset_timedout_connection */
400  ngx_flag_t server_name_in_redirect; /* server_name_in_redirect */
401  ngx_flag_t port_in_redirect; /* port_in_redirect */
402  ngx_flag_t msie_padding; /* msie_padding */
403  ngx_flag_t msie_refresh; /* msie_refresh */
404  ngx_flag_t log_not_found; /* log_not_found */
405  ngx_flag_t log_subrequest; /* log_subrequest */
406  ngx_flag_t recursive_error_pages; /* recursive_error_pages */
407  ngx_flag_t server_tokens; /* server_tokens */
408  ngx_flag_t chunked_transfer_encoding; /* chunked_transfer_encoding */
409  ngx_flag_t etag; /* etag */
410 
411 #if (NGX_HTTP_GZIP)
412  ngx_flag_t gzip_vary; /* gzip_vary */
413 
414  ngx_uint_t gzip_http_version; /* gzip_http_version */
415  ngx_uint_t gzip_proxied; /* gzip_proxied */
416 
417 #if (NGX_PCRE)
418  ngx_array_t *gzip_disable; /* gzip_disable */
419 #endif
420 #endif
421 
422 #if (NGX_HAVE_OPENAT)
423  ngx_uint_t disable_symlinks; /* disable_symlinks */
424  ngx_http_complex_value_t *disable_symlinks_from;
425 #endif
426 
427  ngx_array_t *error_pages; /* error_page */
428  ngx_http_try_file_t *try_files; /* try_files */
429 
430  ngx_path_t *client_body_temp_path; /* client_body_temp_path */
431 
437 
439 
442 
444 
445 #if 0
446  ngx_http_core_loc_conf_t *prev_location;
447 #endif
448 };
449 
450 
451 typedef struct {
456  u_char *file_name;
460 
461 
466 
469 
471  u_char len;
472  u_char name[1];
473 };
474 
475 
493 
494 
502  size_t *root_length, size_t reserved);
504 #if (NGX_HTTP_GZIP)
505 ngx_int_t ngx_http_gzip_ok(ngx_http_request_t *r);
506 #endif
507 
508 
510  ngx_str_t *uri, ngx_str_t *args, ngx_http_request_t **sr,
513  ngx_str_t *uri, ngx_str_t *args);
515 
516 
518 
519 
523 
524 
527 
528 
531 
533  ngx_array_t *headers, ngx_str_t *value, ngx_array_t *proxies,
534  int recursive);
535 
536 
538 
540 
542 
543 
544 #define ngx_http_clear_content_length(r) \
545  \
546  r->headers_out.content_length_n = -1; \
547  if (r->headers_out.content_length) { \
548  r->headers_out.content_length->hash = 0; \
549  r->headers_out.content_length = NULL; \
550  }
551  \
552 #define ngx_http_clear_accept_ranges(r) \
553  \
554  r->allow_ranges = 0; \
555  if (r->headers_out.accept_ranges) { \
556  r->headers_out.accept_ranges->hash = 0; \
557  r->headers_out.accept_ranges = NULL; \
558  }
559 
560 #define ngx_http_clear_last_modified(r) \
561  \
562  r->headers_out.last_modified_time = -1; \
563  if (r->headers_out.last_modified) { \
564  r->headers_out.last_modified->hash = 0; \
565  r->headers_out.last_modified = NULL; \
566  }
567 
568 #define ngx_http_clear_location(r) \
569  \
570  if (r->headers_out.location) { \
571  r->headers_out.location->hash = 0; \
572  r->headers_out.location = NULL; \
573  }
574 
575 #define ngx_http_clear_etag(r) \
576  \
577  if (r->headers_out.etag) { \
578  r->headers_out.etag->hash = 0; \
579  r->headers_out.etag = NULL; \
580  }
581 
582 
583 #endif /* _NGX_HTTP_CORE_H_INCLUDED_ */