xref: /unit/src/nxt_http.h (revision 2139:99d792169ffb)
1431Sigor@sysoev.ru 
2431Sigor@sysoev.ru /*
3431Sigor@sysoev.ru  * Copyright (C) Igor Sysoev
4431Sigor@sysoev.ru  * Copyright (C) NGINX, Inc.
5431Sigor@sysoev.ru  */
6431Sigor@sysoev.ru 
7431Sigor@sysoev.ru #ifndef _NXT_HTTP_H_INCLUDED_
8431Sigor@sysoev.ru #define _NXT_HTTP_H_INCLUDED_
9431Sigor@sysoev.ru 
101721Saxel.duch@nginx.com #include <nxt_regex.h>
111721Saxel.duch@nginx.com 
12431Sigor@sysoev.ru 
13431Sigor@sysoev.ru typedef enum {
141270Sigor@sysoev.ru     NXT_HTTP_UNSET = -1,
15431Sigor@sysoev.ru     NXT_HTTP_INVALID = 0,
16431Sigor@sysoev.ru 
171131Smax.romanov@nginx.com     NXT_HTTP_CONTINUE = 100,
181131Smax.romanov@nginx.com     NXT_HTTP_SWITCHING_PROTOCOLS = 101,
191131Smax.romanov@nginx.com 
20431Sigor@sysoev.ru     NXT_HTTP_OK = 200,
21793Sigor@sysoev.ru     NXT_HTTP_NO_CONTENT = 204,
22431Sigor@sysoev.ru 
23431Sigor@sysoev.ru     NXT_HTTP_MULTIPLE_CHOICES = 300,
24431Sigor@sysoev.ru     NXT_HTTP_MOVED_PERMANENTLY = 301,
25431Sigor@sysoev.ru     NXT_HTTP_FOUND = 302,
26431Sigor@sysoev.ru     NXT_HTTP_SEE_OTHER = 303,
27431Sigor@sysoev.ru     NXT_HTTP_NOT_MODIFIED = 304,
281432Svbart@nginx.com     NXT_HTTP_TEMPORARY_REDIRECT = 307,
291432Svbart@nginx.com     NXT_HTTP_PERMANENT_REDIRECT = 308,
30431Sigor@sysoev.ru 
31431Sigor@sysoev.ru     NXT_HTTP_BAD_REQUEST = 400,
321183Svbart@nginx.com     NXT_HTTP_FORBIDDEN = 403,
33964Sigor@sysoev.ru     NXT_HTTP_NOT_FOUND = 404,
341183Svbart@nginx.com     NXT_HTTP_METHOD_NOT_ALLOWED = 405,
35624Sigor@sysoev.ru     NXT_HTTP_REQUEST_TIMEOUT = 408,
36431Sigor@sysoev.ru     NXT_HTTP_LENGTH_REQUIRED = 411,
37431Sigor@sysoev.ru     NXT_HTTP_PAYLOAD_TOO_LARGE = 413,
38431Sigor@sysoev.ru     NXT_HTTP_URI_TOO_LONG = 414,
391131Smax.romanov@nginx.com     NXT_HTTP_UPGRADE_REQUIRED = 426,
40431Sigor@sysoev.ru     NXT_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
41431Sigor@sysoev.ru 
42772Sigor@sysoev.ru     NXT_HTTP_TO_HTTPS = 497,
43772Sigor@sysoev.ru 
44431Sigor@sysoev.ru     NXT_HTTP_INTERNAL_SERVER_ERROR = 500,
45431Sigor@sysoev.ru     NXT_HTTP_NOT_IMPLEMENTED = 501,
46431Sigor@sysoev.ru     NXT_HTTP_BAD_GATEWAY = 502,
47431Sigor@sysoev.ru     NXT_HTTP_SERVICE_UNAVAILABLE = 503,
48431Sigor@sysoev.ru     NXT_HTTP_GATEWAY_TIMEOUT = 504,
49482Svbart@nginx.com     NXT_HTTP_VERSION_NOT_SUPPORTED = 505,
501429Svbart@nginx.com     NXT_HTTP_SERVER_ERROR_MAX = 599,
511429Svbart@nginx.com 
521429Svbart@nginx.com     NXT_HTTP_STATUS_MAX = 999,
53431Sigor@sysoev.ru } nxt_http_status_t;
54431Sigor@sysoev.ru 
55431Sigor@sysoev.ru 
56431Sigor@sysoev.ru typedef enum {
57431Sigor@sysoev.ru     NXT_HTTP_TE_NONE = 0,
58431Sigor@sysoev.ru     NXT_HTTP_TE_CHUNKED = 1,
59431Sigor@sysoev.ru     NXT_HTTP_TE_UNSUPPORTED = 2,
60431Sigor@sysoev.ru } nxt_http_te_t;
61431Sigor@sysoev.ru 
62431Sigor@sysoev.ru 
631112Sigor@sysoev.ru typedef enum {
641112Sigor@sysoev.ru     NXT_HTTP_PROTO_H1 = 0,
651112Sigor@sysoev.ru     NXT_HTTP_PROTO_H2,
661112Sigor@sysoev.ru     NXT_HTTP_PROTO_DEVNULL,
671112Sigor@sysoev.ru } nxt_http_protocol_t;
681112Sigor@sysoev.ru 
691112Sigor@sysoev.ru 
70431Sigor@sysoev.ru typedef struct {
71431Sigor@sysoev.ru     nxt_work_handler_t              ready_handler;
72431Sigor@sysoev.ru     nxt_work_handler_t              error_handler;
73431Sigor@sysoev.ru } nxt_http_request_state_t;
74431Sigor@sysoev.ru 
75431Sigor@sysoev.ru 
761113Sigor@sysoev.ru typedef struct nxt_h1proto_s        nxt_h1proto_t;
77431Sigor@sysoev.ru 
781131Smax.romanov@nginx.com struct nxt_h1p_websocket_timer_s {
791131Smax.romanov@nginx.com     nxt_timer_t                     timer;
801131Smax.romanov@nginx.com     nxt_h1proto_t                   *h1p;
811131Smax.romanov@nginx.com     nxt_msec_t                      keepalive_interval;
821131Smax.romanov@nginx.com };
831131Smax.romanov@nginx.com 
841131Smax.romanov@nginx.com 
85431Sigor@sysoev.ru typedef union {
86431Sigor@sysoev.ru     void                            *any;
87431Sigor@sysoev.ru     nxt_h1proto_t                   *h1;
88431Sigor@sysoev.ru } nxt_http_proto_t;
89431Sigor@sysoev.ru 
90431Sigor@sysoev.ru 
91431Sigor@sysoev.ru #define nxt_http_field_name_set(_field, _name)                                \
92431Sigor@sysoev.ru     do {                                                                      \
932078Salx.manpages@gmail.com         (_field)->name_length = nxt_length(_name);                            \
942078Salx.manpages@gmail.com         (_field)->name = (u_char *) _name;                                    \
95431Sigor@sysoev.ru     } while (0)
96431Sigor@sysoev.ru 
97431Sigor@sysoev.ru 
98431Sigor@sysoev.ru #define nxt_http_field_set(_field, _name, _value)                             \
99431Sigor@sysoev.ru     do {                                                                      \
1002078Salx.manpages@gmail.com         (_field)->name_length = nxt_length(_name);                            \
1012078Salx.manpages@gmail.com         (_field)->value_length = nxt_length(_value);                          \
1022078Salx.manpages@gmail.com         (_field)->name = (u_char *) _name;                                    \
1032078Salx.manpages@gmail.com         (_field)->value = (u_char *) _value;                                  \
104431Sigor@sysoev.ru     } while (0)
105431Sigor@sysoev.ru 
106431Sigor@sysoev.ru 
107431Sigor@sysoev.ru typedef struct {
108431Sigor@sysoev.ru     nxt_list_t                      *fields;
109543Svbart@nginx.com     nxt_http_field_t                *date;
110431Sigor@sysoev.ru     nxt_http_field_t                *content_type;
111431Sigor@sysoev.ru     nxt_http_field_t                *content_length;
112431Sigor@sysoev.ru     nxt_off_t                       content_length_n;
113431Sigor@sysoev.ru } nxt_http_response_t;
114431Sigor@sysoev.ru 
115431Sigor@sysoev.ru 
1161394Sigor@sysoev.ru typedef struct nxt_upstream_server_s  nxt_upstream_server_t;
1171394Sigor@sysoev.ru 
1181270Sigor@sysoev.ru typedef struct {
1191270Sigor@sysoev.ru     nxt_http_proto_t                proto;
1201270Sigor@sysoev.ru     nxt_http_request_t              *request;
1211394Sigor@sysoev.ru     nxt_upstream_server_t           *server;
1221270Sigor@sysoev.ru     nxt_list_t                      *fields;
1231270Sigor@sysoev.ru     nxt_buf_t                       *body;
1241270Sigor@sysoev.ru 
1251270Sigor@sysoev.ru     nxt_http_status_t               status:16;
1261270Sigor@sysoev.ru     nxt_http_protocol_t             protocol:8;       /* 2 bits */
1271270Sigor@sysoev.ru     uint8_t                         header_received;  /* 1 bit  */
1281270Sigor@sysoev.ru     uint8_t                         closed;           /* 1 bit  */
1291270Sigor@sysoev.ru } nxt_http_peer_t;
1301270Sigor@sysoev.ru 
1311270Sigor@sysoev.ru 
132431Sigor@sysoev.ru struct nxt_http_request_s {
133431Sigor@sysoev.ru     nxt_http_proto_t                proto;
134683Sigor@sysoev.ru     nxt_socket_conf_joint_t         *conf;
135431Sigor@sysoev.ru 
136431Sigor@sysoev.ru     nxt_mp_t                        *mem_pool;
137431Sigor@sysoev.ru 
138431Sigor@sysoev.ru     nxt_buf_t                       *body;
1391131Smax.romanov@nginx.com     nxt_buf_t                       *ws_frame;
140431Sigor@sysoev.ru     nxt_buf_t                       *out;
141431Sigor@sysoev.ru     const nxt_http_request_state_t  *state;
142431Sigor@sysoev.ru 
143964Sigor@sysoev.ru     nxt_str_t                       host;
1441007Salexander.borisov@nginx.com     nxt_str_t                       server_name;
145431Sigor@sysoev.ru     nxt_str_t                       target;
146431Sigor@sysoev.ru     nxt_str_t                       version;
147431Sigor@sysoev.ru     nxt_str_t                       *method;
148431Sigor@sysoev.ru     nxt_str_t                       *path;
149431Sigor@sysoev.ru     nxt_str_t                       *args;
150431Sigor@sysoev.ru 
1511991Sz.hong@f5.com     nxt_str_t                       args_decoded;
1521061Sigor@sysoev.ru     nxt_array_t                     *arguments;  /* of nxt_http_name_value_t */
1531062Sigor@sysoev.ru     nxt_array_t                     *cookies;    /* of nxt_http_name_value_t */
154431Sigor@sysoev.ru     nxt_list_t                      *fields;
155431Sigor@sysoev.ru     nxt_http_field_t                *content_type;
156431Sigor@sysoev.ru     nxt_http_field_t                *content_length;
157431Sigor@sysoev.ru     nxt_http_field_t                *cookie;
158630Svbart@nginx.com     nxt_http_field_t                *referer;
159630Svbart@nginx.com     nxt_http_field_t                *user_agent;
1601733Svbart@nginx.com     nxt_http_field_t                *authorization;
161431Sigor@sysoev.ru     nxt_off_t                       content_length_n;
162431Sigor@sysoev.ru 
163431Sigor@sysoev.ru     nxt_sockaddr_t                  *remote;
164431Sigor@sysoev.ru     nxt_sockaddr_t                  *local;
1651265Sigor@sysoev.ru     nxt_task_t                      task;
166431Sigor@sysoev.ru 
1671007Salexander.borisov@nginx.com     nxt_timer_t                     timer;
1681007Salexander.borisov@nginx.com     void                            *timer_data;
1691007Salexander.borisov@nginx.com 
1701563Svbart@nginx.com     nxt_var_query_t                 *var_query;
1711563Svbart@nginx.com 
1721131Smax.romanov@nginx.com     void                            *req_rpc_data;
1731131Smax.romanov@nginx.com 
1741721Saxel.duch@nginx.com #if (NXT_HAVE_REGEX)
1751721Saxel.duch@nginx.com     nxt_regex_match_t               *regex_match;
1761721Saxel.duch@nginx.com #endif
1771721Saxel.duch@nginx.com 
1781270Sigor@sysoev.ru     nxt_http_peer_t                 *peer;
179608Sigor@sysoev.ru     nxt_buf_t                       *last;
180608Sigor@sysoev.ru 
1811561Smax.romanov@nginx.com     nxt_queue_link_t                app_link;   /* nxt_app_t.ack_waiting_req */
1821561Smax.romanov@nginx.com     nxt_event_engine_t              *engine;
1831561Smax.romanov@nginx.com     nxt_work_t                      err_work;
1841561Smax.romanov@nginx.com 
185431Sigor@sysoev.ru     nxt_http_response_t             resp;
186431Sigor@sysoev.ru 
187431Sigor@sysoev.ru     nxt_http_status_t               status:16;
188431Sigor@sysoev.ru 
189964Sigor@sysoev.ru     uint8_t                         pass_count;   /* 8 bits */
1901473Svbart@nginx.com     uint8_t                         app_target;
1911112Sigor@sysoev.ru     nxt_http_protocol_t             protocol:8;   /* 2 bits */
1922133Sz.hong@f5.com     uint8_t                         tls;          /* 1 bit  */
193431Sigor@sysoev.ru     uint8_t                         logged;       /* 1 bit  */
194431Sigor@sysoev.ru     uint8_t                         header_sent;  /* 1 bit  */
1951271Sigor@sysoev.ru     uint8_t                         inconsistent; /* 1 bit  */
196608Sigor@sysoev.ru     uint8_t                         error;        /* 1 bit  */
1971131Smax.romanov@nginx.com     uint8_t                         websocket_handshake;  /* 1 bit */
198431Sigor@sysoev.ru };
199431Sigor@sysoev.ru 
200431Sigor@sysoev.ru 
2012104Sz.hong@f5.com typedef struct {
2022104Sz.hong@f5.com     uint16_t                        hash;
2032104Sz.hong@f5.com     uint16_t                        name_length;
2042104Sz.hong@f5.com     uint32_t                        value_length;
2052104Sz.hong@f5.com     u_char                          *name;
2062104Sz.hong@f5.com     u_char                          *value;
2072104Sz.hong@f5.com } nxt_http_name_value_t;
2082104Sz.hong@f5.com 
2092104Sz.hong@f5.com 
2102123Sz.hong@f5.com typedef enum {
2112123Sz.hong@f5.com     NXT_HTTP_URI_ENCODING_NONE = 0,
2122123Sz.hong@f5.com     NXT_HTTP_URI_ENCODING,
2132123Sz.hong@f5.com     NXT_HTTP_URI_ENCODING_PLUS
2142123Sz.hong@f5.com } nxt_http_uri_encoding_t;
2152123Sz.hong@f5.com 
2162123Sz.hong@f5.com 
2171936So.canty@f5.com typedef struct nxt_http_route_s            nxt_http_route_t;
2181936So.canty@f5.com typedef struct nxt_http_route_rule_s       nxt_http_route_rule_t;
2191936So.canty@f5.com typedef struct nxt_http_route_addr_rule_s  nxt_http_route_addr_rule_t;
220964Sigor@sysoev.ru 
221964Sigor@sysoev.ru 
2221903Sz.hong@f5.com typedef struct {
2231903Sz.hong@f5.com     nxt_conf_value_t                *pass;
2241903Sz.hong@f5.com     nxt_conf_value_t                *ret;
2252098Salx.manpages@gmail.com     nxt_conf_value_t                *location;
2261903Sz.hong@f5.com     nxt_conf_value_t                *proxy;
2271903Sz.hong@f5.com     nxt_conf_value_t                *share;
2282108Salx.manpages@gmail.com     nxt_conf_value_t                *index;
2291903Sz.hong@f5.com     nxt_str_t                       chroot;
2301903Sz.hong@f5.com     nxt_conf_value_t                *follow_symlinks;
2311903Sz.hong@f5.com     nxt_conf_value_t                *traverse_mounts;
2321903Sz.hong@f5.com     nxt_conf_value_t                *types;
2331903Sz.hong@f5.com     nxt_conf_value_t                *fallback;
2341903Sz.hong@f5.com } nxt_http_action_conf_t;
2351903Sz.hong@f5.com 
2361903Sz.hong@f5.com 
2371264Sigor@sysoev.ru struct nxt_http_action_s {
2381264Sigor@sysoev.ru     nxt_http_action_t               *(*handler)(nxt_task_t *task,
239964Sigor@sysoev.ru                                         nxt_http_request_t *r,
2401264Sigor@sysoev.ru                                         nxt_http_action_t *action);
241964Sigor@sysoev.ru     union {
2421903Sz.hong@f5.com         void                        *conf;
243964Sigor@sysoev.ru         nxt_http_route_t            *route;
2441394Sigor@sysoev.ru         nxt_upstream_t              *upstream;
2451394Sigor@sysoev.ru         uint32_t                    upstream_number;
2461563Svbart@nginx.com         nxt_var_t                   *var;
2471954Sz.hong@f5.com         nxt_str_t                   *pass;
248964Sigor@sysoev.ru     } u;
249964Sigor@sysoev.ru 
2501923Sz.hong@f5.com     nxt_http_action_t               *fallback;
251964Sigor@sysoev.ru };
252964Sigor@sysoev.ru 
253964Sigor@sysoev.ru 
2541112Sigor@sysoev.ru typedef struct {
2551112Sigor@sysoev.ru     void (*body_read)(nxt_task_t *task, nxt_http_request_t *r);
2561112Sigor@sysoev.ru     void (*local_addr)(nxt_task_t *task, nxt_http_request_t *r);
2571148Sigor@sysoev.ru     void (*header_send)(nxt_task_t *task, nxt_http_request_t *r,
2582078Salx.manpages@gmail.com         nxt_work_handler_t body_handler, void *data);
2591112Sigor@sysoev.ru     void (*send)(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *out);
2601112Sigor@sysoev.ru     nxt_off_t (*body_bytes_sent)(nxt_task_t *task, nxt_http_proto_t proto);
2611112Sigor@sysoev.ru     void (*discard)(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *last);
2621112Sigor@sysoev.ru     void (*close)(nxt_task_t *task, nxt_http_proto_t proto,
2631112Sigor@sysoev.ru         nxt_socket_conf_joint_t *joint);
2641270Sigor@sysoev.ru 
2651270Sigor@sysoev.ru     void (*peer_connect)(nxt_task_t *task, nxt_http_peer_t *peer);
2661270Sigor@sysoev.ru     void (*peer_header_send)(nxt_task_t *task, nxt_http_peer_t *peer);
2671270Sigor@sysoev.ru     void (*peer_header_read)(nxt_task_t *task, nxt_http_peer_t *peer);
2681270Sigor@sysoev.ru     void (*peer_read)(nxt_task_t *task, nxt_http_peer_t *peer);
2691270Sigor@sysoev.ru     void (*peer_close)(nxt_task_t *task, nxt_http_peer_t *peer);
2701270Sigor@sysoev.ru 
2711131Smax.romanov@nginx.com     void (*ws_frame_start)(nxt_task_t *task, nxt_http_request_t *r,
2721131Smax.romanov@nginx.com         nxt_buf_t *ws_frame);
2731112Sigor@sysoev.ru } nxt_http_proto_table_t;
274431Sigor@sysoev.ru 
275431Sigor@sysoev.ru 
2762132Sz.hong@f5.com typedef struct {
2771936So.canty@f5.com     nxt_str_t                   *header;
2781936So.canty@f5.com     uint32_t                    header_hash;
2792132Sz.hong@f5.com } nxt_http_forward_header_t;
2802132Sz.hong@f5.com 
2812132Sz.hong@f5.com 
2822132Sz.hong@f5.com struct nxt_http_forward_s {
2832132Sz.hong@f5.com     nxt_http_forward_header_t   client_ip;
2842133Sz.hong@f5.com     nxt_http_forward_header_t   protocol;
2852132Sz.hong@f5.com     nxt_http_route_addr_rule_t  *source;
2861936So.canty@f5.com     uint8_t                     recursive;    /* 1 bit */
2871936So.canty@f5.com };
2881936So.canty@f5.com 
2891936So.canty@f5.com 
2901183Svbart@nginx.com #define NXT_HTTP_DATE_LEN  nxt_length("Wed, 31 Dec 1986 16:40:00 GMT")
2911183Svbart@nginx.com 
2921183Svbart@nginx.com nxt_inline u_char *
nxt_http_date(u_char * buf,struct tm * tm)2931183Svbart@nginx.com nxt_http_date(u_char *buf, struct tm *tm)
2941183Svbart@nginx.com {
2951183Svbart@nginx.com     static const char  *week[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri",
2961183Svbart@nginx.com                                    "Sat" };
2971183Svbart@nginx.com 
2981183Svbart@nginx.com     static const char  *month[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2991183Svbart@nginx.com                                     "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
3001183Svbart@nginx.com 
3011183Svbart@nginx.com     return nxt_sprintf(buf, buf + NXT_HTTP_DATE_LEN,
3021183Svbart@nginx.com                        "%s, %02d %s %4d %02d:%02d:%02d GMT",
3031183Svbart@nginx.com                        week[tm->tm_wday], tm->tm_mday,
3041183Svbart@nginx.com                        month[tm->tm_mon], tm->tm_year + 1900,
3051183Svbart@nginx.com                        tm->tm_hour, tm->tm_min, tm->tm_sec);
3061183Svbart@nginx.com }
3071183Svbart@nginx.com 
3081183Svbart@nginx.com 
3091459Smax.romanov@nginx.com nxt_int_t nxt_http_init(nxt_task_t *task);
3101459Smax.romanov@nginx.com nxt_int_t nxt_h1p_init(nxt_task_t *task);
3111459Smax.romanov@nginx.com nxt_int_t nxt_http_response_hash_init(nxt_task_t *task);
312431Sigor@sysoev.ru 
313431Sigor@sysoev.ru void nxt_http_conn_init(nxt_task_t *task, void *obj, void *data);
314431Sigor@sysoev.ru nxt_http_request_t *nxt_http_request_create(nxt_task_t *task);
315431Sigor@sysoev.ru void nxt_http_request_error(nxt_task_t *task, nxt_http_request_t *r,
316431Sigor@sysoev.ru     nxt_http_status_t status);
317431Sigor@sysoev.ru void nxt_http_request_read_body(nxt_task_t *task, nxt_http_request_t *r);
3181148Sigor@sysoev.ru void nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r,
3191270Sigor@sysoev.ru     nxt_work_handler_t body_handler, void *data);
3201131Smax.romanov@nginx.com void nxt_http_request_ws_frame_start(nxt_task_t *task, nxt_http_request_t *r,
3211131Smax.romanov@nginx.com     nxt_buf_t *ws_frame);
322431Sigor@sysoev.ru void nxt_http_request_send(nxt_task_t *task, nxt_http_request_t *r,
323431Sigor@sysoev.ru     nxt_buf_t *out);
324608Sigor@sysoev.ru nxt_buf_t *nxt_http_buf_mem(nxt_task_t *task, nxt_http_request_t *r,
325608Sigor@sysoev.ru     size_t size);
326608Sigor@sysoev.ru nxt_buf_t *nxt_http_buf_last(nxt_http_request_t *r);
327608Sigor@sysoev.ru void nxt_http_request_error_handler(nxt_task_t *task, void *obj, void *data);
3281131Smax.romanov@nginx.com void nxt_http_request_close_handler(nxt_task_t *task, void *obj, void *data);
329431Sigor@sysoev.ru 
330431Sigor@sysoev.ru nxt_int_t nxt_http_request_host(void *ctx, nxt_http_field_t *field,
331431Sigor@sysoev.ru     uintptr_t data);
332431Sigor@sysoev.ru nxt_int_t nxt_http_request_field(void *ctx, nxt_http_field_t *field,
333431Sigor@sysoev.ru     uintptr_t offset);
334431Sigor@sysoev.ru nxt_int_t nxt_http_request_content_length(void *ctx, nxt_http_field_t *field,
335431Sigor@sysoev.ru     uintptr_t data);
336431Sigor@sysoev.ru 
3372104Sz.hong@f5.com nxt_array_t *nxt_http_arguments_parse(nxt_http_request_t *r);
3382104Sz.hong@f5.com nxt_array_t *nxt_http_cookies_parse(nxt_http_request_t *r);
3392104Sz.hong@f5.com 
3402123Sz.hong@f5.com int64_t nxt_http_field_hash(nxt_mp_t *mp, nxt_str_t *name,
3412123Sz.hong@f5.com     nxt_bool_t case_sensitive, uint8_t encoding);
3422123Sz.hong@f5.com 
343964Sigor@sysoev.ru nxt_http_routes_t *nxt_http_routes_create(nxt_task_t *task,
344964Sigor@sysoev.ru     nxt_router_temp_conf_t *tmcf, nxt_conf_value_t *routes_conf);
3451264Sigor@sysoev.ru nxt_http_action_t *nxt_http_action_create(nxt_task_t *task,
3461954Sz.hong@f5.com     nxt_router_temp_conf_t *tmcf, nxt_str_t *pass);
3471472Svbart@nginx.com nxt_int_t nxt_http_routes_resolve(nxt_task_t *task,
3481472Svbart@nginx.com     nxt_router_temp_conf_t *tmcf);
3491472Svbart@nginx.com nxt_int_t nxt_http_pass_segments(nxt_mp_t *mp, nxt_str_t *pass,
3501472Svbart@nginx.com     nxt_str_t *segments, nxt_uint_t n);
3511264Sigor@sysoev.ru nxt_http_action_t *nxt_http_pass_application(nxt_task_t *task,
3521563Svbart@nginx.com     nxt_router_conf_t *rtcf, nxt_str_t *name);
3531936So.canty@f5.com nxt_http_route_addr_rule_t *nxt_http_route_addr_rule_create(
3541936So.canty@f5.com     nxt_task_t *task, nxt_mp_t *mp, nxt_conf_value_t *cv);
3551936So.canty@f5.com nxt_int_t nxt_http_route_addr_rule(nxt_http_request_t *r,
3561936So.canty@f5.com     nxt_http_route_addr_rule_t *addr_rule, nxt_sockaddr_t *sockaddr);
3571923Sz.hong@f5.com nxt_http_route_rule_t *nxt_http_route_types_rule_create(nxt_task_t *task,
3581923Sz.hong@f5.com     nxt_mp_t *mp, nxt_conf_value_t *types);
3591859So.canty@f5.com nxt_int_t nxt_http_route_test_rule(nxt_http_request_t *r,
3601859So.canty@f5.com     nxt_http_route_rule_t *rule, u_char *start, size_t length);
361964Sigor@sysoev.ru 
3621923Sz.hong@f5.com nxt_int_t nxt_http_action_init(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
3631923Sz.hong@f5.com     nxt_conf_value_t *cv, nxt_http_action_t *action);
3641923Sz.hong@f5.com void nxt_http_request_action(nxt_task_t *task, nxt_http_request_t *r,
3651923Sz.hong@f5.com     nxt_http_action_t *action);
3661923Sz.hong@f5.com 
3671394Sigor@sysoev.ru nxt_int_t nxt_upstreams_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
3681394Sigor@sysoev.ru     nxt_conf_value_t *conf);
3691394Sigor@sysoev.ru nxt_int_t nxt_upstreams_joint_create(nxt_router_temp_conf_t *tmcf,
3701394Sigor@sysoev.ru     nxt_upstream_t ***upstream_joint);
3711394Sigor@sysoev.ru 
3721903Sz.hong@f5.com nxt_int_t nxt_http_return_init(nxt_mp_t *mp, nxt_http_action_t *action,
3731903Sz.hong@f5.com     nxt_http_action_conf_t *acf);
3741429Svbart@nginx.com 
3751923Sz.hong@f5.com nxt_int_t nxt_http_static_init(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
3761923Sz.hong@f5.com     nxt_http_action_t *action, nxt_http_action_conf_t *acf);
3771183Svbart@nginx.com nxt_int_t nxt_http_static_mtypes_init(nxt_mp_t *mp, nxt_lvlhsh_t *hash);
3781183Svbart@nginx.com nxt_int_t nxt_http_static_mtypes_hash_add(nxt_mp_t *mp, nxt_lvlhsh_t *hash,
379*2139Sandrew@digital-domain.net     const nxt_str_t *exten, nxt_str_t *type);
380*2139Sandrew@digital-domain.net nxt_str_t *nxt_http_static_mtype_get(nxt_lvlhsh_t *hash,
381*2139Sandrew@digital-domain.net     const nxt_str_t *exten);
3821183Svbart@nginx.com 
3831264Sigor@sysoev.ru nxt_http_action_t *nxt_http_application_handler(nxt_task_t *task,
3841264Sigor@sysoev.ru     nxt_http_request_t *r, nxt_http_action_t *action);
3851563Svbart@nginx.com nxt_int_t nxt_upstream_find(nxt_upstreams_t *upstreams, nxt_str_t *name,
3861394Sigor@sysoev.ru     nxt_http_action_t *action);
3871394Sigor@sysoev.ru nxt_http_action_t *nxt_upstream_proxy_handler(nxt_task_t *task,
3881394Sigor@sysoev.ru     nxt_http_request_t *r, nxt_upstream_t *upstream);
3891394Sigor@sysoev.ru 
3901924Sz.hong@f5.com nxt_int_t nxt_http_proxy_init(nxt_mp_t *mp, nxt_http_action_t *action,
3911924Sz.hong@f5.com     nxt_http_action_conf_t *acf);
3921270Sigor@sysoev.ru nxt_int_t nxt_http_proxy_date(void *ctx, nxt_http_field_t *field,
3931270Sigor@sysoev.ru     uintptr_t data);
3941270Sigor@sysoev.ru nxt_int_t nxt_http_proxy_content_length(void *ctx, nxt_http_field_t *field,
3951270Sigor@sysoev.ru     uintptr_t data);
3961270Sigor@sysoev.ru nxt_int_t nxt_http_proxy_skip(void *ctx, nxt_http_field_t *field,
3971270Sigor@sysoev.ru     uintptr_t data);
3981270Sigor@sysoev.ru nxt_buf_t *nxt_http_proxy_buf_mem_alloc(nxt_task_t *task, nxt_http_request_t *r,
3991270Sigor@sysoev.ru     size_t size);
4001270Sigor@sysoev.ru void nxt_http_proxy_buf_mem_free(nxt_task_t *task, nxt_http_request_t *r,
4011270Sigor@sysoev.ru     nxt_buf_t *b);
4021270Sigor@sysoev.ru 
403740Sigor@sysoev.ru extern nxt_time_string_t  nxt_http_date_cache;
404740Sigor@sysoev.ru 
405431Sigor@sysoev.ru extern nxt_lvlhsh_t                        nxt_response_fields_hash;
406431Sigor@sysoev.ru 
4071112Sigor@sysoev.ru extern const nxt_http_proto_table_t  nxt_http_proto[];
408431Sigor@sysoev.ru 
4091131Smax.romanov@nginx.com void nxt_h1p_websocket_first_frame_start(nxt_task_t *task,
4101131Smax.romanov@nginx.com     nxt_http_request_t *r, nxt_buf_t *ws_frame);
4111131Smax.romanov@nginx.com void nxt_h1p_websocket_frame_start(nxt_task_t *task, nxt_http_request_t *r,
4121131Smax.romanov@nginx.com     nxt_buf_t *ws_frame);
4131417Smax.romanov@nginx.com void nxt_h1p_complete_buffers(nxt_task_t *task, nxt_h1proto_t *h1p,
4141417Smax.romanov@nginx.com     nxt_bool_t all);
4151131Smax.romanov@nginx.com nxt_msec_t nxt_h1p_conn_request_timer_value(nxt_conn_t *c, uintptr_t data);
4161131Smax.romanov@nginx.com 
4171131Smax.romanov@nginx.com extern const nxt_conn_state_t  nxt_h1p_idle_close_state;
418431Sigor@sysoev.ru 
419431Sigor@sysoev.ru #endif  /* _NXT_HTTP_H_INCLUDED_ */
420