Update and clean Tomato RAF files
[tomato.git] / release / src / router / nginx / src / http / ngx_http.h
blob3d758bfd96320dbef62eb24f6c32c1a576b79025
2 /*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Nginx, Inc.
5 */
8 #ifndef _NGX_HTTP_H_INCLUDED_
9 #define _NGX_HTTP_H_INCLUDED_
12 #include <ngx_config.h>
13 #include <ngx_core.h>
16 typedef struct ngx_http_request_s ngx_http_request_t;
17 typedef struct ngx_http_upstream_s ngx_http_upstream_t;
18 typedef struct ngx_http_cache_s ngx_http_cache_t;
19 typedef struct ngx_http_file_cache_s ngx_http_file_cache_t;
20 typedef struct ngx_http_log_ctx_s ngx_http_log_ctx_t;
21 typedef struct ngx_http_chunked_s ngx_http_chunked_t;
23 #if (NGX_HTTP_SPDY)
24 typedef struct ngx_http_spdy_stream_s ngx_http_spdy_stream_t;
25 #endif
27 typedef ngx_int_t (*ngx_http_header_handler_pt)(ngx_http_request_t *r,
28 ngx_table_elt_t *h, ngx_uint_t offset);
29 typedef u_char *(*ngx_http_log_handler_pt)(ngx_http_request_t *r,
30 ngx_http_request_t *sr, u_char *buf, size_t len);
33 #include <ngx_http_variables.h>
34 #include <ngx_http_config.h>
35 #include <ngx_http_request.h>
36 #include <ngx_http_script.h>
37 #include <ngx_http_upstream.h>
38 #include <ngx_http_upstream_round_robin.h>
39 #include <ngx_http_busy_lock.h>
40 #include <ngx_http_core_module.h>
42 #if (NGX_HTTP_SPDY)
43 #include <ngx_http_spdy.h>
44 #endif
45 #if (NGX_HTTP_CACHE)
46 #include <ngx_http_cache.h>
47 #endif
48 #if (NGX_HTTP_SSI)
49 #include <ngx_http_ssi_filter_module.h>
50 #endif
51 #if (NGX_HTTP_SSL)
52 #include <ngx_http_ssl_module.h>
53 #endif
56 struct ngx_http_log_ctx_s {
57 ngx_connection_t *connection;
58 ngx_http_request_t *request;
59 ngx_http_request_t *current_request;
63 struct ngx_http_chunked_s {
64 ngx_uint_t state;
65 off_t size;
66 off_t length;
70 typedef struct {
71 ngx_uint_t http_version;
72 ngx_uint_t code;
73 ngx_uint_t count;
74 u_char *start;
75 u_char *end;
76 } ngx_http_status_t;
79 #define ngx_http_get_module_ctx(r, module) (r)->ctx[module.ctx_index]
80 #define ngx_http_set_ctx(r, c, module) r->ctx[module.ctx_index] = c;
83 ngx_int_t ngx_http_add_location(ngx_conf_t *cf, ngx_queue_t **locations,
84 ngx_http_core_loc_conf_t *clcf);
85 ngx_int_t ngx_http_add_listen(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
86 ngx_http_listen_opt_t *lsopt);
89 void ngx_http_init_connection(ngx_connection_t *c);
90 void ngx_http_close_connection(ngx_connection_t *c);
92 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
93 int ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg);
94 #endif
96 ngx_int_t ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b);
97 ngx_int_t ngx_http_parse_uri(ngx_http_request_t *r);
98 ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r,
99 ngx_uint_t merge_slashes);
100 ngx_int_t ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b,
101 ngx_http_status_t *status);
102 ngx_int_t ngx_http_parse_unsafe_uri(ngx_http_request_t *r, ngx_str_t *uri,
103 ngx_str_t *args, ngx_uint_t *flags);
104 ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b,
105 ngx_uint_t allow_underscores);
106 ngx_int_t ngx_http_parse_multi_header_lines(ngx_array_t *headers,
107 ngx_str_t *name, ngx_str_t *value);
108 ngx_int_t ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len,
109 ngx_str_t *value);
110 void ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri,
111 ngx_str_t *args);
112 ngx_int_t ngx_http_parse_chunked(ngx_http_request_t *r, ngx_buf_t *b,
113 ngx_http_chunked_t *ctx);
116 ngx_http_request_t *ngx_http_create_request(ngx_connection_t *c);
117 ngx_int_t ngx_http_process_request_uri(ngx_http_request_t *r);
118 ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r);
119 void ngx_http_process_request(ngx_http_request_t *r);
120 void ngx_http_update_location_config(ngx_http_request_t *r);
121 void ngx_http_handler(ngx_http_request_t *r);
122 void ngx_http_run_posted_requests(ngx_connection_t *c);
123 ngx_int_t ngx_http_post_request(ngx_http_request_t *r,
124 ngx_http_posted_request_t *pr);
125 void ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
126 void ngx_http_free_request(ngx_http_request_t *r, ngx_int_t rc);
128 void ngx_http_empty_handler(ngx_event_t *wev);
129 void ngx_http_request_empty_handler(ngx_http_request_t *r);
132 #define ngx_http_ephemeral(r) (void *) (&r->uri_start)
135 #define NGX_HTTP_LAST 1
136 #define NGX_HTTP_FLUSH 2
138 ngx_int_t ngx_http_send_special(ngx_http_request_t *r, ngx_uint_t flags);
141 ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r,
142 ngx_http_client_body_handler_pt post_handler);
144 ngx_int_t ngx_http_send_header(ngx_http_request_t *r);
145 ngx_int_t ngx_http_special_response_handler(ngx_http_request_t *r,
146 ngx_int_t error);
147 ngx_int_t ngx_http_filter_finalize_request(ngx_http_request_t *r,
148 ngx_module_t *m, ngx_int_t error);
149 void ngx_http_clean_header(ngx_http_request_t *r);
152 time_t ngx_http_parse_time(u_char *value, size_t len);
153 size_t ngx_http_get_time(char *buf, time_t t);
157 ngx_int_t ngx_http_discard_request_body(ngx_http_request_t *r);
158 void ngx_http_discarded_request_body_handler(ngx_http_request_t *r);
159 void ngx_http_block_reading(ngx_http_request_t *r);
160 void ngx_http_test_reading(ngx_http_request_t *r);
163 char *ngx_http_types_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
164 char *ngx_http_merge_types(ngx_conf_t *cf, ngx_array_t **keys,
165 ngx_hash_t *types_hash, ngx_array_t **prev_keys,
166 ngx_hash_t *prev_types_hash, ngx_str_t *default_types);
167 ngx_int_t ngx_http_set_default_types(ngx_conf_t *cf, ngx_array_t **types,
168 ngx_str_t *default_type);
170 #if (NGX_HTTP_DEGRADATION)
171 ngx_uint_t ngx_http_degraded(ngx_http_request_t *);
172 #endif
175 extern ngx_module_t ngx_http_module;
177 extern ngx_str_t ngx_http_html_default_types[];
180 extern ngx_http_output_header_filter_pt ngx_http_top_header_filter;
181 extern ngx_http_output_body_filter_pt ngx_http_top_body_filter;
184 #endif /* _NGX_HTTP_H_INCLUDED_ */