blob: cac2a9c3ce2849eb8354bcbe17b4b1b871e9496a [file] [log] [blame]
Igor Sysoevd90282d2004-09-28 08:34:51 +00001
2/*
Igor Sysoevff8da912004-09-29 16:00:49 +00003 * Copyright (C) Igor Sysoev
Igor Sysoevd90282d2004-09-28 08:34:51 +00004 */
5
6
Igor Sysoev6de5c2c2002-08-06 16:39:45 +00007#ifndef _NGX_HTTP_H_INCLUDED_
8#define _NGX_HTTP_H_INCLUDED_
9
10
11#include <ngx_config.h>
Igor Sysoev1c104622003-06-03 15:42:58 +000012#include <ngx_core.h>
Igor Sysoev1b138ed2003-11-18 21:34:08 +000013#include <ngx_garbage_collector.h>
14
Igor Sysoev899b44e2005-05-12 14:58:06 +000015
16typedef struct ngx_http_request_s ngx_http_request_t;
17typedef struct ngx_http_upstream_s ngx_http_upstream_t;
18typedef struct ngx_http_log_ctx_s ngx_http_log_ctx_t;
Igor Sysoev899b44e2005-05-12 14:58:06 +000019
20typedef ngx_int_t (*ngx_http_header_handler_pt)(ngx_http_request_t *r,
21 ngx_table_elt_t *h, ngx_uint_t offset);
Igor Sysoevbb28b6d2006-07-11 13:20:19 +000022typedef u_char *(*ngx_http_log_handler_pt)(ngx_http_request_t *r,
23 ngx_http_request_t *sr, u_char *buf, size_t len);
Igor Sysoevc1571722005-03-19 12:38:37 +000024
Igor Sysoev0e499db2003-11-27 07:45:22 +000025
Igor Sysoev67f88e92004-03-12 16:57:08 +000026#if (NGX_HTTP_CACHE)
Igor Sysoev75569452004-07-08 15:17:47 +000027#include <ngx_http_cache.h>
Igor Sysoev67f88e92004-03-12 16:57:08 +000028#endif
Igor Sysoev75569452004-07-08 15:17:47 +000029/* STUB */
Igor Sysoev0e499db2003-11-27 07:45:22 +000030#include <ngx_http_cache.h>
Igor Sysoev67f88e92004-03-12 16:57:08 +000031
Igor Sysoev899b44e2005-05-12 14:58:06 +000032#include <ngx_http_variables.h>
Igor Sysoeva9830112003-05-19 16:39:14 +000033#include <ngx_http_request.h>
Igor Sysoev899b44e2005-05-12 14:58:06 +000034#include <ngx_http_upstream.h>
Igor Sysoev3d2fd182006-12-04 16:46:13 +000035#include <ngx_http_upstream_round_robin.h>
Igor Sysoev6253ca12003-05-27 12:18:54 +000036#include <ngx_http_config.h>
Igor Sysoev9cc1ace2003-11-04 22:12:39 +000037#include <ngx_http_busy_lock.h>
Igor Sysoev6253ca12003-05-27 12:18:54 +000038#include <ngx_http_core_module.h>
Igor Sysoev02f742b2005-04-08 15:18:55 +000039#include <ngx_http_script.h>
Igor Sysoev6de5c2c2002-08-06 16:39:45 +000040
Igor Sysoevdf3254a2006-01-11 15:26:57 +000041#if (NGX_HTTP_SSI)
42#include <ngx_http_ssi_filter_module.h>
43#endif
Igor Sysoevf38e0462004-07-16 17:11:43 +000044#if (NGX_HTTP_SSL)
45#include <ngx_http_ssl_module.h>
Igor Sysoev75569452004-07-08 15:17:47 +000046#endif
47
Igor Sysoev42feecb2002-12-15 06:25:09 +000048
Igor Sysoev02025fd2005-01-18 13:03:58 +000049struct ngx_http_log_ctx_s {
Igor Sysoevcc595672007-12-30 08:01:50 +000050 ngx_connection_t *connection;
Igor Sysoev1b735832004-11-11 14:07:14 +000051 ngx_http_request_t *request;
Igor Sysoevbb28b6d2006-07-11 13:20:19 +000052 ngx_http_request_t *current_request;
Igor Sysoev02025fd2005-01-18 13:03:58 +000053};
Igor Sysoev0ad17c02002-08-26 15:18:19 +000054
Igor Sysoev6de5c2c2002-08-06 16:39:45 +000055
Igor Sysoevef316432006-08-16 13:09:33 +000056#define ngx_http_get_module_ctx(r, module) (r)->ctx[module.ctx_index]
57#define ngx_http_set_ctx(r, c, module) r->ctx[module.ctx_index] = c;
Igor Sysoev96f83772002-09-07 10:14:25 +000058
59
Igor Sysoeve55988c2008-05-24 14:14:13 +000060ngx_int_t ngx_http_add_location(ngx_conf_t *cf, ngx_queue_t **locations,
61 ngx_http_core_loc_conf_t *clcf);
62
63
Igor Sysoev6b863e32003-05-12 15:52:24 +000064void ngx_http_init_connection(ngx_connection_t *c);
Igor Sysoevc2bba092003-11-28 17:41:47 +000065
Igor Sysoeve60303c2007-05-29 15:21:09 +000066#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
67int ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg);
68#endif
69
Igor Sysoevdd888c42004-09-21 05:38:28 +000070ngx_int_t ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b);
Igor Sysoev8decab32007-10-18 11:36:58 +000071ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r,
72 ngx_uint_t merge_slashes);
Igor Sysoev09c684b2005-11-09 17:25:55 +000073ngx_int_t ngx_http_parse_unsafe_uri(ngx_http_request_t *r, ngx_str_t *uri,
74 ngx_str_t *args, ngx_uint_t *flags);
Igor Sysoev753792e2008-09-24 14:02:50 +000075ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b,
76 ngx_uint_t allow_underscores);
Igor Sysoev899b44e2005-05-12 14:58:06 +000077ngx_int_t ngx_http_parse_multi_header_lines(ngx_array_t *headers,
78 ngx_str_t *name, ngx_str_t *value);
Igor Sysoev84d17bb2008-12-22 12:02:05 +000079ngx_int_t ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len,
80 ngx_str_t *value);
81
Igor Sysoevc2bba092003-11-28 17:41:47 +000082
Igor Sysoev2f657222004-06-16 15:32:11 +000083ngx_int_t ngx_http_find_server_conf(ngx_http_request_t *r);
Igor Sysoevb85fd592005-08-23 15:36:54 +000084void ngx_http_update_location_config(ngx_http_request_t *r);
Igor Sysoev79a80482003-05-14 17:13:13 +000085void ngx_http_handler(ngx_http_request_t *r);
Igor Sysoev851cd732008-12-08 14:23:20 +000086void ngx_http_run_posted_requests(ngx_connection_t *c);
87ngx_int_t ngx_http_post_request(ngx_http_request_t *r);
Igor Sysoev899b44e2005-05-12 14:58:06 +000088void ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
Igor Sysoevd581fd52003-05-13 16:02:32 +000089
Igor Sysoev160d7742003-11-19 16:26:41 +000090void ngx_http_empty_handler(ngx_event_t *wev);
Igor Sysoev899b44e2005-05-12 14:58:06 +000091void ngx_http_request_empty_handler(ngx_http_request_t *r);
Igor Sysoevd581fd52003-05-13 16:02:32 +000092
Igor Sysoev851cd732008-12-08 14:23:20 +000093
Igor Sysoevc31a9bb2005-11-26 10:11:11 +000094#define NGX_HTTP_LAST 1
95#define NGX_HTTP_FLUSH 2
96
97ngx_int_t ngx_http_send_special(ngx_http_request_t *r, ngx_uint_t flags);
98
Igor Sysoev73009772003-02-06 17:21:13 +000099
Igor Sysoev02025fd2005-01-18 13:03:58 +0000100ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r,
Igor Sysoev8184d1b2005-03-04 14:06:57 +0000101 ngx_http_client_body_handler_pt post_handler);
Igor Sysoev1d8d9ee2003-04-28 15:06:39 +0000102
Igor Sysoev2f657222004-06-16 15:32:11 +0000103ngx_int_t ngx_http_send_header(ngx_http_request_t *r);
Igor Sysoev8184d1b2005-03-04 14:06:57 +0000104ngx_int_t ngx_http_special_response_handler(ngx_http_request_t *r,
105 ngx_int_t error);
Igor Sysoev73009772003-02-06 17:21:13 +0000106
107
Igor Sysoev10a543a2004-03-16 07:10:12 +0000108time_t ngx_http_parse_time(u_char *value, size_t len);
Igor Sysoev73009772003-02-06 17:21:13 +0000109size_t ngx_http_get_time(char *buf, time_t t);
Igor Sysoevb5faed22003-10-29 08:30:44 +0000110
Igor Sysoev6de5c2c2002-08-06 16:39:45 +0000111
112
Igor Sysoev832571f2007-08-06 15:37:22 +0000113ngx_int_t ngx_http_discard_request_body(ngx_http_request_t *r);
Igor Sysoev7ab4d9c2007-08-06 15:22:40 +0000114void ngx_http_block_reading(ngx_http_request_t *r);
Igor Sysoevabe378e2008-11-10 15:22:33 +0000115void ngx_http_test_reading(ngx_http_request_t *r);
Igor Sysoev42feecb2002-12-15 06:25:09 +0000116
Igor Sysoev2a2d2b52003-01-30 18:21:39 +0000117
Igor Sysoevb5bc3f92008-08-04 11:29:09 +0000118char *ngx_http_types_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
119char *ngx_http_merge_types(ngx_conf_t *cf, ngx_array_t *keys,
120 ngx_hash_t *types_hash, ngx_array_t *prev_keys, ngx_hash_t *prev_types_hash,
121 ngx_str_t *default_types);
Igor Sysoevc71e3d82008-08-13 16:25:48 +0000122ngx_int_t ngx_http_set_default_types(ngx_conf_t *cf, ngx_array_t **types,
Igor Sysoevb5bc3f92008-08-04 11:29:09 +0000123 ngx_str_t *default_type);
124
125
Igor Sysoeva9830112003-05-19 16:39:14 +0000126extern ngx_module_t ngx_http_module;
127
Igor Sysoev390abe02008-08-12 13:11:36 +0000128extern ngx_str_t ngx_http_html_default_types[];
129
Igor Sysoev2a2d2b52003-01-30 18:21:39 +0000130
Igor Sysoev2f657222004-06-16 15:32:11 +0000131extern ngx_http_output_header_filter_pt ngx_http_top_header_filter;
132extern ngx_http_output_body_filter_pt ngx_http_top_body_filter;
133
Igor Sysoev4e9393a2003-01-09 05:36:00 +0000134
Igor Sysoev6de5c2c2002-08-06 16:39:45 +0000135#endif /* _NGX_HTTP_H_INCLUDED_ */