blob: 8b04b7a35583099e3ba6f5f1f47467edc3180929 [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 Sysoev1b735832004-11-11 14:07:14 +000050 ngx_str_t *client;
51 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 Sysoev6b863e32003-05-12 15:52:24 +000060void ngx_http_init_connection(ngx_connection_t *c);
Igor Sysoevc2bba092003-11-28 17:41:47 +000061
Igor Sysoeve60303c2007-05-29 15:21:09 +000062#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
63int ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg);
64#endif
65
Igor Sysoevdd888c42004-09-21 05:38:28 +000066ngx_int_t ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b);
Igor Sysoev2f657222004-06-16 15:32:11 +000067ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r);
Igor Sysoev09c684b2005-11-09 17:25:55 +000068ngx_int_t ngx_http_parse_unsafe_uri(ngx_http_request_t *r, ngx_str_t *uri,
69 ngx_str_t *args, ngx_uint_t *flags);
Igor Sysoev2f657222004-06-16 15:32:11 +000070ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b);
Igor Sysoev899b44e2005-05-12 14:58:06 +000071ngx_int_t ngx_http_parse_multi_header_lines(ngx_array_t *headers,
72 ngx_str_t *name, ngx_str_t *value);
Igor Sysoevc2bba092003-11-28 17:41:47 +000073
Igor Sysoev2f657222004-06-16 15:32:11 +000074ngx_int_t ngx_http_find_server_conf(ngx_http_request_t *r);
Igor Sysoevb85fd592005-08-23 15:36:54 +000075void ngx_http_update_location_config(ngx_http_request_t *r);
Igor Sysoev79a80482003-05-14 17:13:13 +000076void ngx_http_handler(ngx_http_request_t *r);
Igor Sysoev899b44e2005-05-12 14:58:06 +000077void ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
Igor Sysoevd581fd52003-05-13 16:02:32 +000078
Igor Sysoev160d7742003-11-19 16:26:41 +000079void ngx_http_empty_handler(ngx_event_t *wev);
Igor Sysoev899b44e2005-05-12 14:58:06 +000080void ngx_http_request_empty_handler(ngx_http_request_t *r);
Igor Sysoevd581fd52003-05-13 16:02:32 +000081
Igor Sysoevc31a9bb2005-11-26 10:11:11 +000082#define NGX_HTTP_LAST 1
83#define NGX_HTTP_FLUSH 2
84
85ngx_int_t ngx_http_send_special(ngx_http_request_t *r, ngx_uint_t flags);
86
Igor Sysoev73009772003-02-06 17:21:13 +000087
Igor Sysoev02025fd2005-01-18 13:03:58 +000088ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r,
Igor Sysoev8184d1b2005-03-04 14:06:57 +000089 ngx_http_client_body_handler_pt post_handler);
Igor Sysoev1d8d9ee2003-04-28 15:06:39 +000090
Igor Sysoev2f657222004-06-16 15:32:11 +000091ngx_int_t ngx_http_send_header(ngx_http_request_t *r);
Igor Sysoev8184d1b2005-03-04 14:06:57 +000092ngx_int_t ngx_http_special_response_handler(ngx_http_request_t *r,
93 ngx_int_t error);
Igor Sysoev73009772003-02-06 17:21:13 +000094
95
Igor Sysoev10a543a2004-03-16 07:10:12 +000096time_t ngx_http_parse_time(u_char *value, size_t len);
Igor Sysoev73009772003-02-06 17:21:13 +000097size_t ngx_http_get_time(char *buf, time_t t);
Igor Sysoevb5faed22003-10-29 08:30:44 +000098
Igor Sysoev6de5c2c2002-08-06 16:39:45 +000099
100
Igor Sysoev832571f2007-08-06 15:37:22 +0000101ngx_int_t ngx_http_discard_request_body(ngx_http_request_t *r);
Igor Sysoev7ab4d9c2007-08-06 15:22:40 +0000102void ngx_http_block_reading(ngx_http_request_t *r);
Igor Sysoev42feecb2002-12-15 06:25:09 +0000103
Igor Sysoev2a2d2b52003-01-30 18:21:39 +0000104
Igor Sysoeva9830112003-05-19 16:39:14 +0000105extern ngx_module_t ngx_http_module;
106
Igor Sysoev2a2d2b52003-01-30 18:21:39 +0000107
Igor Sysoeve89c4582003-12-19 08:15:11 +0000108extern ngx_uint_t ngx_http_total_requests;
109extern uint64_t ngx_http_total_sent;
110
Igor Sysoeve0268b92002-09-11 15:18:33 +0000111
Igor Sysoev2f657222004-06-16 15:32:11 +0000112extern ngx_http_output_header_filter_pt ngx_http_top_header_filter;
113extern ngx_http_output_body_filter_pt ngx_http_top_body_filter;
114
Igor Sysoev4e9393a2003-01-09 05:36:00 +0000115
Igor Sysoev73009772003-02-06 17:21:13 +0000116/* STUB */
Igor Sysoev2f657222004-06-16 15:32:11 +0000117ngx_int_t ngx_http_log_handler(ngx_http_request_t *r);
Igor Sysoev73009772003-02-06 17:21:13 +0000118/**/
119
Igor Sysoeve0268b92002-09-11 15:18:33 +0000120
Igor Sysoev6de5c2c2002-08-06 16:39:45 +0000121#endif /* _NGX_HTTP_H_INCLUDED_ */