comparison src/http/modules/proxy/ngx_http_event_proxy_handler.h @ 71:59229033ae93

nginx-0.0.1-2003-04-08-19:40:10 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 08 Apr 2003 15:40:10 +0000
parents src/http/modules/ngx_http_event_proxy_handler.h@e43f406e4525
children 66de3f065886
comparison
equal deleted inserted replaced
70:e320bf51c4e3 71:59229033ae93
1 #ifndef _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_
2 #define _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_
3
4
5 #include <ngx_config.h>
6 #include <ngx_array.h>
7 #include <ngx_http.h>
8
9
10 #define NGX_HTTP_PROXY_PARSE_NO_HEADER 20
11 #define NGX_HTTP_PARSE_TOO_LONG_STATUS_LINE 21
12
13 typedef struct {
14 int dummy;
15 } ngx_http_proxy_headers_in_t;
16
17
18 typedef struct {
19 u_int32_t addr;
20 ngx_str_t host;
21 int port;
22 ngx_str_t addr_port_name;
23
24 int fails;
25 time_t accessed;
26 } ngx_http_proxy_upstream_t;
27
28
29 typedef struct {
30 int current;
31 int number;
32 int max_fails;
33 int fail_timeout;
34
35 /* ngx_mutex_t mutex; */
36 /* ngx_connection_t *cached; ??? */
37
38 ngx_http_proxy_upstream_t u[1];
39 } ngx_http_proxy_upstreams_t;
40
41
42 typedef struct {
43 ngx_str_t host;
44 ngx_str_t uri;
45 ngx_str_t *location;
46 ngx_str_t host_header;
47 ngx_str_t port_name;
48 int port;
49 } ngx_http_proxy_upstream_url_t;
50
51
52 typedef struct {
53 ngx_http_proxy_upstreams_t *upstreams;
54 ngx_http_proxy_upstream_url_t *upstream_url;
55
56 int rcvbuf;
57 int conn_pool_size;
58 int connect_timeout;
59 int send_timeout;
60 int read_timeout;
61 int header_size;
62 int large_header;
63
64 int block_size;
65 int max_block_size;
66
67 int retry_500_error;
68
69 } ngx_http_proxy_loc_conf_t;
70
71
72 #if 0
73 /* location /one/ { proxy_pass http://localhost:9000/two/; } */
74
75 typedef struct {
76 /* "/one/" */
77 /* "http://localhost:9000/two/" */
78 /* "/two/" */
79 *upstream_farm;
80 } ngx_http_proxy_pass_t;
81 #endif
82
83
84 typedef struct ngx_http_proxy_ctx_s ngx_http_proxy_ctx_t;
85
86 struct ngx_http_proxy_ctx_s {
87 ngx_chain_t *out;
88
89 int last_hunk;
90 ngx_array_t hunks;
91 int hunks_number;
92
93 int hunk_n;
94
95 ngx_connection_t *connection;
96 ngx_http_request_t *request;
97 ngx_http_proxy_headers_in_t *headers_in;
98
99 ngx_http_proxy_upstream_url_t *upstream_url;
100 ngx_http_proxy_upstreams_t *upstreams;
101 int cur_upstream;
102 int tries;
103
104 struct sockaddr *sockaddr;
105
106 ngx_http_proxy_loc_conf_t *lcf;
107
108 ngx_log_t *log;
109
110 int method;
111
112 ngx_hunk_t *header_in;
113 int status;
114 ngx_str_t status_line;
115 ngx_str_t full_status_line;
116
117 int state;
118 int status_count;
119 char *status_start;
120 char *status_end;
121 int (*state_write_upstream_handler) (ngx_http_proxy_ctx_t *p);
122 int (*state_read_upstream_handler) (ngx_http_proxy_ctx_t *p);
123 int (*state_handler)(ngx_http_proxy_ctx_t *p);
124
125 int last_error;
126
127 unsigned cached_connection:1;
128 };
129
130
131 typedef struct {
132 char *action;
133 char *upstream;
134 char *client;
135 char *url;
136 } ngx_http_proxy_log_ctx_t;
137
138
139 extern ngx_module_t ngx_http_proxy_module;
140
141
142 static int ngx_http_proxy_error(ngx_http_request_t *r, ngx_http_proxy_ctx_t *p,
143 int error);
144
145
146 #endif /* _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_ */