Mercurial > hg > nginx
comparison src/http/modules/proxy/ngx_http_proxy_handler.h @ 172:caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 03 Nov 2003 22:20:44 +0000 |
parents | aff0e5d32af8 |
children | ea464a6c0581 |
comparison
equal
deleted
inserted
replaced
171:aff0e5d32af8 | 172:caa57ddf6d77 |
---|---|
6 #include <ngx_core.h> | 6 #include <ngx_core.h> |
7 #include <ngx_event.h> | 7 #include <ngx_event.h> |
8 #include <ngx_event_connect.h> | 8 #include <ngx_event_connect.h> |
9 #include <ngx_event_pipe.h> | 9 #include <ngx_event_pipe.h> |
10 #include <ngx_http.h> | 10 #include <ngx_http.h> |
11 | |
12 | |
13 typedef enum { | |
14 NGX_HTTP_PROXY_CACHE_PASS = 1, | |
15 NGX_HTTP_PROXY_CACHE_BYPASS, | |
16 NGX_HTTP_PROXY_CACHE_AUTH, | |
17 NGX_HTTP_PROXY_CACHE_PGNC, | |
18 NGX_HTTP_PROXY_CACHE_MISS, | |
19 NGX_HTTP_PROXY_CACHE_EXPR, | |
20 NGX_HTTP_PROXY_CACHE_AGED, | |
21 NGX_HTTP_PROXY_CACHE_HIT | |
22 } ngx_http_proxy_state_e; | |
23 | |
24 | |
25 typedef enum { | |
26 NGX_HTTP_PROXY_CACHE_BPS = 1, | |
27 NGX_HTTP_PROXY_CACHE_XAE, | |
28 NGX_HTTP_PROXY_CACHE_CTL, | |
29 NGX_HTTP_PROXY_CACHE_EXP, | |
30 NGX_HTTP_PROXY_CACHE_MVD, | |
31 NGX_HTTP_PROXY_CACHE_LMF, | |
32 NGX_HTTP_PROXY_CACHE_PDE | |
33 } ngx_http_proxy_reason_e; | |
11 | 34 |
12 | 35 |
13 typedef struct { | 36 typedef struct { |
14 ngx_str_t url; | 37 ngx_str_t url; |
15 ngx_str_t host; | 38 ngx_str_t host; |
34 ssize_t max_temp_file_size; | 57 ssize_t max_temp_file_size; |
35 ssize_t temp_file_write_size; | 58 ssize_t temp_file_write_size; |
36 int cyclic_temp_file; | 59 int cyclic_temp_file; |
37 | 60 |
38 int cache; | 61 int cache; |
62 | |
39 int pass_server; | 63 int pass_server; |
64 int pass_x_accel_expires; | |
65 | |
66 int ignore_expires; | |
67 int lm_factor; | |
68 int default_expires; | |
40 | 69 |
41 int next_upstream; | 70 int next_upstream; |
42 int use_stale; | 71 int use_stale; |
43 | 72 |
44 ngx_path_t *cache_path; | 73 ngx_path_t *cache_path; |
48 ngx_peers_t *peers; | 77 ngx_peers_t *peers; |
49 } ngx_http_proxy_loc_conf_t; | 78 } ngx_http_proxy_loc_conf_t; |
50 | 79 |
51 | 80 |
52 typedef struct { | 81 typedef struct { |
82 ngx_http_proxy_state_e cache; | |
83 ngx_http_proxy_reason_e reason; | |
53 int status; | 84 int status; |
54 ngx_str_t *peer; | 85 ngx_str_t *peer; |
55 } ngx_http_proxy_state_t; | 86 } ngx_http_proxy_state_t; |
56 | 87 |
57 | 88 |
120 /* used to parse an upstream HTTP header */ | 151 /* used to parse an upstream HTTP header */ |
121 int status; | 152 int status; |
122 char *status_start; | 153 char *status_start; |
123 char *status_end; | 154 char *status_end; |
124 int status_count; | 155 int status_count; |
125 int state; | 156 int parse_state; |
126 | 157 |
158 ngx_http_proxy_state_t *state; | |
127 ngx_array_t states; /* of ngx_http_proxy_state_t */ | 159 ngx_array_t states; /* of ngx_http_proxy_state_t */ |
128 | 160 |
129 char *action; | 161 char *action; |
130 ngx_http_log_ctx_t *saved_ctx; | 162 ngx_http_log_ctx_t *saved_ctx; |
131 ngx_log_handler_pt saved_handler; | 163 ngx_log_handler_pt saved_handler; |
132 }; | 164 }; |
133 | 165 |
134 | 166 |
135 #define NGX_HTTP_PROXY_PARSE_NO_HEADER 20 | 167 #define NGX_HTTP_PROXY_PARSE_NO_HEADER 20 |
168 | |
136 | 169 |
137 #define NGX_HTTP_PROXY_FT_ERROR 2 | 170 #define NGX_HTTP_PROXY_FT_ERROR 2 |
138 #define NGX_HTTP_PROXY_FT_TIMEOUT 4 | 171 #define NGX_HTTP_PROXY_FT_TIMEOUT 4 |
139 #define NGX_HTTP_PROXY_FT_INVALID_HEADER 8 | 172 #define NGX_HTTP_PROXY_FT_INVALID_HEADER 8 |
140 #define NGX_HTTP_PROXY_FT_HTTP_500 16 | 173 #define NGX_HTTP_PROXY_FT_HTTP_500 16 |
145 | 178 |
146 int ngx_http_proxy_request_upstream(ngx_http_proxy_ctx_t *p); | 179 int ngx_http_proxy_request_upstream(ngx_http_proxy_ctx_t *p); |
147 | 180 |
148 int ngx_http_proxy_get_cached_response(ngx_http_proxy_ctx_t *p); | 181 int ngx_http_proxy_get_cached_response(ngx_http_proxy_ctx_t *p); |
149 int ngx_http_proxy_send_cached_response(ngx_http_proxy_ctx_t *p); | 182 int ngx_http_proxy_send_cached_response(ngx_http_proxy_ctx_t *p); |
183 int ngx_http_proxy_is_cachable(ngx_http_proxy_ctx_t *p); | |
150 int ngx_http_proxy_update_cache(ngx_http_proxy_ctx_t *p); | 184 int ngx_http_proxy_update_cache(ngx_http_proxy_ctx_t *p); |
151 | 185 |
152 int ngx_http_proxy_log_state(ngx_http_proxy_ctx_t *p, int status); | |
153 size_t ngx_http_proxy_log_error(void *data, char *buf, size_t len); | 186 size_t ngx_http_proxy_log_error(void *data, char *buf, size_t len); |
154 void ngx_http_proxy_finalize_request(ngx_http_proxy_ctx_t *p, int rc); | 187 void ngx_http_proxy_finalize_request(ngx_http_proxy_ctx_t *p, int rc); |
155 void ngx_http_proxy_close_connection(ngx_connection_t *c); | 188 void ngx_http_proxy_close_connection(ngx_connection_t *c); |
156 | 189 |
157 int ngx_http_proxy_parse_status_line(ngx_http_proxy_ctx_t *p); | 190 int ngx_http_proxy_parse_status_line(ngx_http_proxy_ctx_t *p); |