Mercurial > hg > nginx-quic
annotate src/http/modules/proxy/ngx_http_proxy_handler.c @ 507:cd3117ad9aab release-0.1.28
nginx-0.1.28-RELEASE import
*) Bugfix: nginx hogs CPU while proxying the huge files.
*) Bugfix: nginx could not be built by gcc 4.0 on Linux.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 08 Apr 2005 15:18:55 +0000 |
parents | ee66921ecd47 |
children | 9b8c906f6e63 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
437
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
437
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
437
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
437
diff
changeset
|
5 |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #include <ngx_config.h> |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_core.h> |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #include <ngx_http.h> |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 #include <ngx_http_proxy_handler.h> |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
336
diff
changeset
|
13 static ngx_int_t ngx_http_proxy_handler(ngx_http_request_t *r); |
501 | 14 #if 0 |
477 | 15 static ngx_int_t ngx_http_proxy_cache_get(ngx_http_proxy_ctx_t *p); |
501 | 16 #endif |
159
981e4af2a425
nginx-0.0.1-2003-10-24-20:10:38 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
17 |
479 | 18 static size_t ngx_http_proxy_log_proxy_state_getlen(ngx_http_request_t *r, |
19 uintptr_t data); | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
20 static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, |
479 | 21 u_char *buf, |
22 ngx_http_log_op_t *op); | |
23 | |
24 #if 0 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
25 static u_char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
26 u_char *buf, uintptr_t data); |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
27 static u_char *ngx_http_proxy_log_reason(ngx_http_request_t *r, u_char *buf, |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
28 uintptr_t data); |
479 | 29 #endif |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
30 |
479 | 31 static ngx_int_t ngx_http_proxy_add_log_formats(ngx_conf_t *cf); |
131
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
32 static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf); |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
33 static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
34 void *parent, void *child); |
131
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
35 |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
36 static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd, |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
37 void *conf); |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
38 |
485 | 39 static char *ngx_http_proxy_set_x_var(ngx_conf_t *cf, ngx_command_t *cmd, |
40 void *conf); | |
452 | 41 static char *ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data); |
42 | |
43 static ngx_conf_post_t ngx_http_proxy_lowat_post = | |
44 { ngx_http_proxy_lowat_check } ; | |
45 | |
131
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
46 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
47 static ngx_conf_bitmask_t next_upstream_masks[] = { |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
48 { ngx_string("error"), NGX_HTTP_PROXY_FT_ERROR }, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
49 { ngx_string("timeout"), NGX_HTTP_PROXY_FT_TIMEOUT }, |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
50 { ngx_string("invalid_header"), NGX_HTTP_PROXY_FT_INVALID_HEADER }, |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
51 { ngx_string("http_500"), NGX_HTTP_PROXY_FT_HTTP_500 }, |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
52 { ngx_string("http_404"), NGX_HTTP_PROXY_FT_HTTP_404 }, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
53 { ngx_null_string, 0 } |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
54 }; |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
55 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
56 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
57 static ngx_conf_bitmask_t use_stale_masks[] = { |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
58 { ngx_string("error"), NGX_HTTP_PROXY_FT_ERROR }, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
59 { ngx_string("timeout"), NGX_HTTP_PROXY_FT_TIMEOUT }, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
60 { ngx_string("invalid_header"), NGX_HTTP_PROXY_FT_INVALID_HEADER }, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
61 { ngx_string("http_500"), NGX_HTTP_PROXY_FT_HTTP_500 }, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
62 { ngx_string("busy_lock"), NGX_HTTP_PROXY_FT_BUSY_LOCK }, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
63 { ngx_string("max_waiting"), NGX_HTTP_PROXY_FT_MAX_WAITING }, |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
64 { ngx_null_string, 0 } |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
65 }; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
66 |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
67 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
68 static ngx_conf_num_bounds_t ngx_http_proxy_lm_factor_bounds = { |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
69 ngx_conf_check_num_bounds, 0, 100 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
70 }; |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
71 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
72 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
73 static ngx_command_t ngx_http_proxy_commands[] = { |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
74 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
75 { ngx_string("proxy_pass"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
76 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
77 ngx_http_proxy_set_pass, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
78 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
79 0, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
80 NULL }, |
160
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
159
diff
changeset
|
81 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
82 { ngx_string("proxy_connect_timeout"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
83 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
84 ngx_conf_set_msec_slot, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
85 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
86 offsetof(ngx_http_proxy_loc_conf_t, connect_timeout), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
87 NULL }, |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
88 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
89 { ngx_string("proxy_send_timeout"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
90 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
91 ngx_conf_set_msec_slot, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
92 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
93 offsetof(ngx_http_proxy_loc_conf_t, send_timeout), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
94 NULL }, |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
95 |
452 | 96 { ngx_string("proxy_send_lowat"), |
97 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
98 ngx_conf_set_size_slot, | |
99 NGX_HTTP_LOC_CONF_OFFSET, | |
100 offsetof(ngx_http_proxy_loc_conf_t, send_lowat), | |
101 &ngx_http_proxy_lowat_post }, | |
102 | |
288
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
103 { ngx_string("proxy_preserve_host"), |
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
104 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
105 ngx_conf_set_flag_slot, |
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
106 NGX_HTTP_LOC_CONF_OFFSET, |
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
107 offsetof(ngx_http_proxy_loc_conf_t, preserve_host), |
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
108 NULL }, |
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
109 |
505 | 110 { ngx_string("proxy_pass_unparsed_uri"), |
111 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
112 ngx_conf_set_flag_slot, | |
113 NGX_HTTP_LOC_CONF_OFFSET, | |
114 offsetof(ngx_http_proxy_loc_conf_t, pass_unparsed_uri), | |
115 NULL }, | |
116 | |
457 | 117 { ngx_string("proxy_set_x_url"), |
118 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
119 ngx_conf_set_flag_slot, | |
120 NGX_HTTP_LOC_CONF_OFFSET, | |
121 offsetof(ngx_http_proxy_loc_conf_t, set_x_url), | |
122 NULL }, | |
123 | |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
124 { ngx_string("proxy_set_x_real_ip"), |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
125 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
126 ngx_conf_set_flag_slot, |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
127 NGX_HTTP_LOC_CONF_OFFSET, |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
128 offsetof(ngx_http_proxy_loc_conf_t, set_x_real_ip), |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
129 NULL }, |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
130 |
485 | 131 { ngx_string("proxy_set_x_var"), |
132 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
133 ngx_http_proxy_set_x_var, | |
134 NGX_HTTP_LOC_CONF_OFFSET, | |
135 0, | |
136 NULL }, | |
137 | |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
138 { ngx_string("proxy_add_x_forwarded_for"), |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
139 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
140 ngx_conf_set_flag_slot, |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
141 NGX_HTTP_LOC_CONF_OFFSET, |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
142 offsetof(ngx_http_proxy_loc_conf_t, add_x_forwarded_for), |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
143 NULL }, |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
144 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
145 { ngx_string("proxy_header_buffer_size"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
146 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
147 ngx_conf_set_size_slot, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
148 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
149 offsetof(ngx_http_proxy_loc_conf_t, header_buffer_size), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
150 NULL }, |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
151 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
152 { ngx_string("proxy_read_timeout"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
153 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
154 ngx_conf_set_msec_slot, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
155 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
156 offsetof(ngx_http_proxy_loc_conf_t, read_timeout), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
157 NULL }, |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
158 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
159 { ngx_string("proxy_buffers"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
160 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
161 ngx_conf_set_bufs_slot, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
162 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
163 offsetof(ngx_http_proxy_loc_conf_t, bufs), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
164 NULL }, |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
165 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
166 { ngx_string("proxy_busy_buffers_size"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
167 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
168 ngx_conf_set_size_slot, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
169 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
170 offsetof(ngx_http_proxy_loc_conf_t, busy_buffers_size), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
171 NULL }, |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
172 |
477 | 173 #if 0 |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
174 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
175 { ngx_string("proxy_cache_path"), |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
176 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
177 ngx_conf_set_path_slot, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
178 NGX_HTTP_LOC_CONF_OFFSET, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
179 offsetof(ngx_http_proxy_loc_conf_t, cache_path), |
477 | 180 (void *) ngx_http_cache_cleaner_handler }, |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
181 |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
182 #endif |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
183 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
184 { ngx_string("proxy_temp_path"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
185 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
186 ngx_conf_set_path_slot, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
187 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
188 offsetof(ngx_http_proxy_loc_conf_t, temp_path), |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
189 (void *) ngx_garbage_collector_temp_handler }, |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
190 |
467 | 191 { ngx_string("proxy_max_temp_file_size"), |
192 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
193 ngx_conf_set_size_slot, | |
194 NGX_HTTP_LOC_CONF_OFFSET, | |
195 offsetof(ngx_http_proxy_loc_conf_t, max_temp_file_size), | |
196 NULL }, | |
197 | |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
198 { ngx_string("proxy_temp_file_write_size"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
199 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
200 ngx_conf_set_size_slot, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
201 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
202 offsetof(ngx_http_proxy_loc_conf_t, temp_file_write_size), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
203 NULL }, |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
204 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
205 { ngx_string("proxy_cache"), |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
206 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
207 ngx_conf_set_flag_slot, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
208 NGX_HTTP_LOC_CONF_OFFSET, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
209 offsetof(ngx_http_proxy_loc_conf_t, cache), |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
210 NULL }, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
211 |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
212 |
174
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
213 { ngx_string("proxy_busy_lock"), |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
214 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE13, |
174
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
215 ngx_http_set_busy_lock_slot, |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
216 NGX_HTTP_LOC_CONF_OFFSET, |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
217 offsetof(ngx_http_proxy_loc_conf_t, busy_lock), |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
218 NULL }, |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
219 |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
220 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
221 { ngx_string("proxy_pass_server"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
222 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
223 ngx_conf_set_flag_slot, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
224 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
225 offsetof(ngx_http_proxy_loc_conf_t, pass_server), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
226 NULL }, |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
227 |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
228 { ngx_string("proxy_pass_x_accel_expires"), |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
229 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
230 ngx_conf_set_flag_slot, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
231 NGX_HTTP_LOC_CONF_OFFSET, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
232 offsetof(ngx_http_proxy_loc_conf_t, pass_x_accel_expires), |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
233 NULL }, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
234 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
235 { ngx_string("proxy_ignore_expires"), |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
236 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
237 ngx_conf_set_flag_slot, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
238 NGX_HTTP_LOC_CONF_OFFSET, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
239 offsetof(ngx_http_proxy_loc_conf_t, ignore_expires), |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
240 NULL }, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
241 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
242 { ngx_string("proxy_lm_factor"), |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
243 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
244 ngx_conf_set_num_slot, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
245 NGX_HTTP_LOC_CONF_OFFSET, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
246 offsetof(ngx_http_proxy_loc_conf_t, lm_factor), |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
247 &ngx_http_proxy_lm_factor_bounds }, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
248 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
249 { ngx_string("proxy_default_expires"), |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
250 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
251 ngx_conf_set_sec_slot, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
252 NGX_HTTP_LOC_CONF_OFFSET, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
253 offsetof(ngx_http_proxy_loc_conf_t, default_expires), |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
254 NULL }, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
255 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
256 { ngx_string("proxy_next_upstream"), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
257 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_ANY, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
258 ngx_conf_set_bitmask_slot, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
259 NGX_HTTP_LOC_CONF_OFFSET, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
260 offsetof(ngx_http_proxy_loc_conf_t, next_upstream), |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
261 &next_upstream_masks }, |
163
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
162
diff
changeset
|
262 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
263 { ngx_string("proxy_use_stale"), |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
264 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_ANY, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
265 ngx_conf_set_bitmask_slot, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
266 NGX_HTTP_LOC_CONF_OFFSET, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
267 offsetof(ngx_http_proxy_loc_conf_t, use_stale), |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
268 &use_stale_masks }, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
269 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
270 ngx_null_command |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
271 }; |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
272 |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
273 |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
274 ngx_http_module_t ngx_http_proxy_module_ctx = { |
479 | 275 ngx_http_proxy_add_log_formats, /* pre conf */ |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
276 |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
277 NULL, /* create main configuration */ |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
278 NULL, /* init main configuration */ |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
279 |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
280 NULL, /* create server configuration */ |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
281 NULL, /* merge server configuration */ |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
282 |
131
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
283 ngx_http_proxy_create_loc_conf, /* create location configration */ |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
284 ngx_http_proxy_merge_loc_conf /* merge location configration */ |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
285 }; |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
286 |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
287 |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
288 ngx_module_t ngx_http_proxy_module = { |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
289 NGX_MODULE, |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
290 &ngx_http_proxy_module_ctx, /* module context */ |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
291 ngx_http_proxy_commands, /* module directives */ |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
292 NGX_HTTP_MODULE, /* module type */ |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
293 NULL, /* init module */ |
479 | 294 NULL /* init process */ |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
295 }; |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
296 |
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
297 |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
298 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
299 static ngx_http_log_op_name_t ngx_http_proxy_log_fmt_ops[] = { |
479 | 300 { ngx_string("proxy"), 0, NULL, |
301 ngx_http_proxy_log_proxy_state_getlen, | |
302 ngx_http_proxy_log_proxy_state }, | |
303 | |
304 #if 0 | |
473 | 305 { ngx_string("proxy_cache_state"), 0, ngx_http_proxy_log_cache_state }, |
306 { ngx_string("proxy_reason"), 0, ngx_http_proxy_log_reason }, | |
479 | 307 #endif |
308 | |
309 { ngx_null_string, 0, NULL, NULL, NULL } | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
310 }; |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
311 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
312 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
313 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
314 ngx_http_header_t ngx_http_proxy_headers_in[] = { |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
315 { ngx_string("Date"), offsetof(ngx_http_proxy_headers_in_t, date) }, |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
316 { ngx_string("Server"), offsetof(ngx_http_proxy_headers_in_t, server) }, |
171
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
317 |
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
318 { ngx_string("Expires"), offsetof(ngx_http_proxy_headers_in_t, expires) }, |
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
319 { ngx_string("Cache-Control"), |
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
320 offsetof(ngx_http_proxy_headers_in_t, cache_control) }, |
315
39b6f2df45c0
nginx-0.0.3-2004-04-14-21:44:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
313
diff
changeset
|
321 { ngx_string("ETag"), offsetof(ngx_http_proxy_headers_in_t, etag) }, |
171
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
322 { ngx_string("X-Accel-Expires"), |
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
323 offsetof(ngx_http_proxy_headers_in_t, x_accel_expires) }, |
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
324 |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
325 { ngx_string("Connection"), |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
326 offsetof(ngx_http_proxy_headers_in_t, connection) }, |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
327 { ngx_string("Content-Type"), |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
328 offsetof(ngx_http_proxy_headers_in_t, content_type) }, |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
329 { ngx_string("Content-Length"), |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
330 offsetof(ngx_http_proxy_headers_in_t, content_length) }, |
479 | 331 |
332 #if (NGX_HTTP_GZIP) | |
455 | 333 { ngx_string("Content-Encoding"), |
334 offsetof(ngx_http_proxy_headers_in_t, content_encoding) }, | |
479 | 335 #endif |
336 | |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
337 { ngx_string("Last-Modified"), |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
338 offsetof(ngx_http_proxy_headers_in_t, last_modified) }, |
190
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
189
diff
changeset
|
339 { ngx_string("Location"), |
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
189
diff
changeset
|
340 offsetof(ngx_http_proxy_headers_in_t, location) }, |
139
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
341 { ngx_string("Accept-Ranges"), |
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
342 offsetof(ngx_http_proxy_headers_in_t, accept_ranges) }, |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
332
diff
changeset
|
343 { ngx_string("X-Pad"), offsetof(ngx_http_proxy_headers_in_t, x_pad) }, |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
344 |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
345 { ngx_null_string, 0 } |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
346 }; |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
347 |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
348 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
349 static ngx_str_t cache_states[] = { |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
350 ngx_string("PASS"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
351 ngx_string("BYPASS"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
352 ngx_string("AUTH"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
353 ngx_string("PGNC"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
354 ngx_string("MISS"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
355 ngx_string("EXPR"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
356 ngx_string("AGED"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
357 ngx_string("HIT") |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
358 }; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
359 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
360 |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
361 static ngx_str_t cache_reasons[] = { |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
362 ngx_string("BPS"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
363 ngx_string("XAE"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
364 ngx_string("CTL"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
365 ngx_string("EXP"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
366 ngx_string("MVD"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
367 ngx_string("LMF"), |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
368 ngx_string("PDE") |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
369 }; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
370 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
371 |
503 | 372 #if (NGX_PCRE) |
501 | 373 static ngx_str_t ngx_http_proxy_uri = ngx_string("/"); |
503 | 374 #endif |
501 | 375 |
376 | |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
336
diff
changeset
|
377 static ngx_int_t ngx_http_proxy_handler(ngx_http_request_t *r) |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
378 { |
171
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
379 ngx_http_proxy_ctx_t *p; |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
380 |
501 | 381 p = ngx_pcalloc(r->pool, sizeof(ngx_http_proxy_ctx_t)); |
382 if (p == NULL) { | |
383 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
384 } | |
385 | |
386 ngx_http_set_ctx(r, p, ngx_http_proxy_module); | |
387 | |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
388 |
131
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
389 p->lcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
390 p->request = r; |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
391 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
392 /* TODO: we currently support reverse proxy only */ |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
393 p->accel = 1; |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
394 |
477 | 395 if (ngx_array_init(&p->states, r->pool, p->lcf->peers->number, |
396 sizeof(ngx_http_proxy_state_t)) == NGX_ERROR) | |
397 { | |
398 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
399 } | |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
400 |
501 | 401 p->state = ngx_array_push(&p->states); |
402 if (p->state == NULL) { | |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
403 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
404 } |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
405 |
174
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
406 ngx_memzero(p->state, sizeof(ngx_http_proxy_state_t)); |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
407 |
477 | 408 #if 0 |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
409 |
175
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
410 if (!p->lcf->cache |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
411 || (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD)) |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
412 { |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
413 p->state->cache_state = NGX_HTTP_PROXY_CACHE_PASS; |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
414 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
415 } else if (r->bypass_cache) { |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
416 p->state->cache_state = NGX_HTTP_PROXY_CACHE_BYPASS; |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
417 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
418 } else if (r->headers_in.authorization) { |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
419 p->state->cache_state = NGX_HTTP_PROXY_CACHE_AUTH; |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
420 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
421 } else if (r->no_cache) { |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
422 p->state->cache_state = NGX_HTTP_PROXY_CACHE_PGNC; |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
423 p->cachable = 1; |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
424 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
425 } else { |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
426 p->cachable = 1; |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
427 } |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
428 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
429 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
430 if (p->state->cache_state != 0) { |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
431 return ngx_http_proxy_request_upstream(p); |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
432 } |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
433 |
477 | 434 return ngx_http_proxy_cache_get(p); |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
435 |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
436 #else |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
437 |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
438 p->state->cache_state = NGX_HTTP_PROXY_CACHE_PASS; |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
439 |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
440 return ngx_http_proxy_request_upstream(p); |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
441 |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
442 #endif |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
443 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
444 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
445 |
477 | 446 #if 0 |
447 | |
448 static ngx_int_t ngx_http_proxy_cache_get(ngx_http_proxy_ctx_t *p) | |
449 { | |
450 u_char *last; | |
451 ngx_http_request_t *r; | |
452 ngx_http_cache_ctx_t ctx; | |
453 ngx_http_proxy_upstream_conf_t *u; | |
454 | |
455 r = p->request; | |
456 u = p->lcf->upstream; | |
457 | |
458 ctx.key.len = u->url.len + r->uri.len - u->location->len + r->args.len; | |
501 | 459 ctx.key.data = ngx_palloc(r->pool, ctx.key.len); |
460 if (ctx.key.data == NULL) { | |
477 | 461 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
462 } | |
463 | |
464 last = ngx_cpymem(ctx.key.data, u->url.data, u->url.len); | |
465 | |
466 last = ngx_cpymem(last, r->uri.data + u->location->len, | |
467 r->uri.len - u->location->len); | |
468 | |
469 if (r->args.len > 0) { | |
470 *(last++) = '?'; | |
471 last = ngx_cpymem(last, r->args.data, r->args.len); | |
472 } | |
473 | |
474 p->header_in = ngx_create_temp_buf(r->pool, p->lcf->header_buffer_size); | |
475 if (p->header_in == NULL) { | |
476 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
477 } | |
478 p->header_in->tag = (ngx_buf_tag_t) &ngx_http_proxy_module; | |
479 | |
480 ctx.buf = p->header_in; | |
481 ctx.path = p->lcf->cache_path; | |
482 ctx.file = 1; | |
483 ctx.primary = 1; | |
484 | |
485 ngx_http_cache_get(r, &ctx); | |
486 | |
487 return ngx_http_proxy_request_upstream(p); | |
488 } | |
489 | |
490 #endif | |
491 | |
492 | |
298
4a3f18406832
nginx-0.0.3-2004-03-30-10:27:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
493 void ngx_http_proxy_check_broken_connection(ngx_event_t *ev) |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
494 { |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
495 int n; |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
496 char buf[1]; |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
497 ngx_err_t err; |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
498 ngx_connection_t *c; |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
499 ngx_http_request_t *r; |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
500 ngx_http_proxy_ctx_t *p; |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
501 |
298
4a3f18406832
nginx-0.0.3-2004-03-30-10:27:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
502 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ev->log, 0, |
4a3f18406832
nginx-0.0.3-2004-03-30-10:27:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
503 "http proxy check client, write event:%d", ev->write); |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
504 |
469 | 505 #if (NGX_HAVE_KQUEUE) |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
506 |
455 | 507 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
508 |
375
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
509 if (!ev->pending_eof) { |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
510 return; |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
511 } |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
512 |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
513 c = ev->data; |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
514 r = c->data; |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
515 p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
516 |
298
4a3f18406832
nginx-0.0.3-2004-03-30-10:27:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
517 ev->eof = 1; |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
518 |
298
4a3f18406832
nginx-0.0.3-2004-03-30-10:27:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
519 if (ev->kq_errno) { |
4a3f18406832
nginx-0.0.3-2004-03-30-10:27:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
520 ev->error = 1; |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
521 } |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
522 |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
523 if (!p->cachable && p->upstream->peer.connection) { |
298
4a3f18406832
nginx-0.0.3-2004-03-30-10:27:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
524 ngx_log_error(NGX_LOG_INFO, ev->log, ev->kq_errno, |
437
470270fa84d2
nginx-0.0.12-2004-09-23-20:39:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
525 "kevent() reported that client closed " |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
526 "prematurely connection, " |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
527 "so upstream connection is closed too"); |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
528 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
529 return; |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
530 } |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
531 |
298
4a3f18406832
nginx-0.0.3-2004-03-30-10:27:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
532 ngx_log_error(NGX_LOG_INFO, ev->log, ev->kq_errno, |
437
470270fa84d2
nginx-0.0.12-2004-09-23-20:39:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
533 "kevent() reported that client closed " |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
534 "prematurely connection"); |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
535 |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
536 if (p->upstream == NULL || p->upstream->peer.connection == NULL) { |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
537 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
538 } |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
539 |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
540 return; |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
541 } |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
542 |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
543 #endif |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
544 |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
545 c = ev->data; |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
546 r = c->data; |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
547 p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
548 |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
549 n = recv(c->fd, buf, 1, MSG_PEEK); |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
550 |
313
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
312
diff
changeset
|
551 err = ngx_socket_errno; |
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
312
diff
changeset
|
552 |
317
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
553 /* |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
554 * we do not need to disable the write event because |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
555 * that event has NGX_USE_CLEAR_EVENT type |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
556 */ |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
557 |
313
98f1a8028067
nginx-0.0.3-2004-04-13-19:08:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
312
diff
changeset
|
558 if (ev->write && (n >= 0 || err == NGX_EAGAIN)) { |
312
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
559 return; |
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
560 } |
f5431a4bbc7d
nginx-0.0.3-2004-04-13-09:27:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
306
diff
changeset
|
561 |
317
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
562 if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && ev->active) { |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
563 if (ngx_del_event(ev, NGX_READ_EVENT, 0) == NGX_ERROR) { |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
564 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR); |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
565 } |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
566 } |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
315
diff
changeset
|
567 |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
568 if (n > 0) { |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
569 return; |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
570 } |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
571 |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
572 ev->eof = 1; |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
573 |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
574 if (n == -1) { |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
575 if (err == NGX_EAGAIN) { |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
576 return; |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
577 } |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
578 |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
579 ev->error = 1; |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
580 |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
581 } else { |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
582 /* n == 0 */ |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
583 err = 0; |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
584 } |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
585 |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
586 if (!p->cachable && p->upstream->peer.connection) { |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
587 ngx_log_error(NGX_LOG_INFO, ev->log, err, |
437
470270fa84d2
nginx-0.0.12-2004-09-23-20:39:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
588 "client closed prematurely connection, " |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
589 "so upstream connection is closed too"); |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
590 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
591 return; |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
592 } |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
593 |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
594 ngx_log_error(NGX_LOG_INFO, ev->log, err, |
437
470270fa84d2
nginx-0.0.12-2004-09-23-20:39:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
595 "client closed prematurely connection"); |
305
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
596 |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
597 if (p->upstream == NULL || p->upstream->peer.connection == NULL) { |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
598 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
4b1a3a4acc60
nginx-0.0.3-2004-04-02-19:13:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
304
diff
changeset
|
599 } |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
600 } |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
601 |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
602 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
603 void ngx_http_proxy_busy_lock_handler(ngx_event_t *rev) |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
604 { |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
605 ngx_connection_t *c; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
606 ngx_http_request_t *r; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
607 ngx_http_proxy_ctx_t *p; |
208
0b67be7d4489
nginx-0.0.1-2003-12-08-23:48:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
608 |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
609 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http proxy busy lock"); |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
610 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
611 c = rev->data; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
612 r = c->data; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
613 p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
614 p->action = "waiting upstream in busy lock"; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
615 |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
616 if (p->request->connection->write->eof) { |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
617 ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
618 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
619 return; |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
620 } |
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
621 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
622 if (rev->timedout) { |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
623 rev->timedout = 0; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
624 p->busy_lock.time++; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
625 p->state->bl_time = p->busy_lock.time; |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
626 |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
627 #if (NGX_HTTP_FILE_CACHE) |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
628 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
629 if (p->state->cache_state < NGX_HTTP_PROXY_CACHE_MISS) { |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
630 ngx_http_proxy_upstream_busy_lock(p); |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
631 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
632 } else { |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
633 ngx_http_proxy_cache_busy_lock(p); |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
634 } |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
635 #else |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
636 |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
637 ngx_http_proxy_upstream_busy_lock(p); |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
638 |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
639 #endif |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
640 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
641 return; |
175
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
642 } |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
643 |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
644 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
645 "http proxy: client sent while busy lock"); |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
646 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
647 /* |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
648 * TODO: kevent() notify about error, otherwise we need to |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
649 * call ngx_peek(): recv(MSG_PEEK) to get errno. THINK about aio. |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
650 * if there's no error we need to disable event. |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
651 */ |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
652 |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
653 #if 0 |
469 | 654 #if (NGX_HAVE_KQUEUE) |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
655 |
469 | 656 if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && rev->kq_eof) { |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
657 ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); |
174
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
658 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
659 ngx_del_timer(rev); |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
660 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
661 ngx_log_error(NGX_LOG_ERR, c->log, rev->kq_errno, |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
662 "client() closed connection"); |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
663 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
664 if (ngx_del_event(rev, NGX_READ_EVENT, NGX_CLOSE_EVENT) == NGX_ERROR) { |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
665 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR); |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
666 return; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
667 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
668 |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
669 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
670 return; |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
671 } |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
672 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
673 #endif |
189
c966c09be66b
nginx-0.0.1-2003-11-18-19:49:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
178
diff
changeset
|
674 #endif |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
675 |
169
edf29bb717da
nginx-0.0.1-2003-10-31-19:05:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
168
diff
changeset
|
676 } |
edf29bb717da
nginx-0.0.1-2003-10-31-19:05:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
168
diff
changeset
|
677 |
edf29bb717da
nginx-0.0.1-2003-10-31-19:05:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
168
diff
changeset
|
678 |
171
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
679 void ngx_http_proxy_finalize_request(ngx_http_proxy_ctx_t *p, int rc) |
139
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
680 { |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
681 ngx_http_request_t *r; |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
682 |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
683 r = p->request; |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
684 |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
685 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
686 "finalize http proxy request"); |
162
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
687 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
688 if (p->upstream && p->upstream->peer.connection) { |
175
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
689 ngx_http_proxy_close_connection(p); |
139
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
690 } |
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
691 |
152
fb48bf4fea1c
nginx-0.0.1-2003-10-21-11:47:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
151
diff
changeset
|
692 if (p->header_sent |
fb48bf4fea1c
nginx-0.0.1-2003-10-21-11:47:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
151
diff
changeset
|
693 && (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE)) |
fb48bf4fea1c
nginx-0.0.1-2003-10-21-11:47:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
151
diff
changeset
|
694 { |
139
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
695 rc = 0; |
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
696 } |
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
697 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
698 if (p->saved_ctx) { |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
699 r->connection->log->data = p->saved_ctx; |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
700 r->connection->log->handler = p->saved_handler; |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
701 } |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
702 |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
703 if (p->upstream && p->upstream->event_pipe) { |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
704 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
705 "http proxy temp fd: %d", |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
706 p->upstream->event_pipe->temp_file->file.fd); |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
707 } |
160
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
159
diff
changeset
|
708 |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
709 if (p->cache) { |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
710 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
711 "http proxy cache fd: %d", |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
712 p->cache->ctx.file.fd); |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
713 } |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
714 |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
715 if (p->upstream && p->upstream->event_pipe) { |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
716 r->file.fd = p->upstream->event_pipe->temp_file->file.fd; |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
717 |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
718 } else if (p->cache) { |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
719 r->file.fd = p->cache->ctx.file.fd; |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
720 } |
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
721 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
722 if (rc == 0 && r->main == NULL) { |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
723 rc = ngx_http_send_last(r); |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
724 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
725 |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
726 ngx_http_finalize_request(r, rc); |
139
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
727 } |
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
728 |
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
729 |
175
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
730 void ngx_http_proxy_close_connection(ngx_http_proxy_ctx_t *p) |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
731 { |
377
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
732 ngx_socket_t fd; |
175
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
733 ngx_connection_t *c; |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
734 |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
735 c = p->upstream->peer.connection; |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
736 p->upstream->peer.connection = NULL; |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
737 |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
738 if (p->lcf->busy_lock) { |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
739 p->lcf->busy_lock->busy--; |
175
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
740 } |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
741 |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
742 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
743 "http proxy close connection: %d", c->fd); |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
744 |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
745 if (c->fd == -1) { |
139
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
746 #if 0 |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
747 ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed"); |
139
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
748 #endif |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
749 return; |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
750 } |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
751 |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
752 if (c->read->timer_set) { |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
753 ngx_del_timer(c->read); |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
754 } |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
755 |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
756 if (c->write->timer_set) { |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
757 ngx_del_timer(c->write); |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
758 } |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
759 |
140
e32405df0e77
nginx-0.0.1-2003-10-08-08:34:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
139
diff
changeset
|
760 /* TODO: move connection to the connection pool */ |
e32405df0e77
nginx-0.0.1-2003-10-08-08:34:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
139
diff
changeset
|
761 |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
762 if (ngx_del_conn) { |
261
bdd631bf1a1c
nginx-0.0.2-2004-02-18-00:11:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
763 ngx_del_conn(c, NGX_CLOSE_EVENT); |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
764 |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
765 } else { |
375
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
766 if (c->read->active || c->read->disabled) { |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
767 ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
768 } |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
769 |
375
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
770 if (c->write->active || c->read->disabled) { |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
771 ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT); |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
772 } |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
773 } |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
774 |
377
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
775 /* |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
776 * we have to clean the connection information before the closing |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
777 * because another thread may reopen the same file descriptor |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
778 * before we clean the connection |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
779 */ |
379
73688d5d7fc3
nginx-0.0.7-2004-07-06-20:12:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
377
diff
changeset
|
780 |
377
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
781 if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_OK) { |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
782 |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
783 if (c->read->prev) { |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
784 ngx_delete_posted_event(c->read); |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
785 } |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
786 |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
787 if (c->write->prev) { |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
788 ngx_delete_posted_event(c->write); |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
789 } |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
790 |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
791 c->read->closed = 1; |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
792 c->write->closed = 1; |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
793 |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
794 ngx_mutex_unlock(ngx_posted_events_mutex); |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
795 } |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
796 |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
797 fd = c->fd; |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
798 c->fd = (ngx_socket_t) -1; |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
799 c->data = NULL; |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
800 |
41437e4fd9b4
nginx-0.0.7-2004-07-05-19:08:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
801 if (ngx_close_socket(fd) == -1) { |
137
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
802 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_socket_errno, |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
803 ngx_close_socket_n " failed"); |
2a615b036870
nginx-0.0.1-2003-10-03-19:50:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
136
diff
changeset
|
804 } |
136
da00cde00e8a
nginx-0.0.1-2003-10-02-09:39:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
135
diff
changeset
|
805 } |
da00cde00e8a
nginx-0.0.1-2003-10-02-09:39:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
135
diff
changeset
|
806 |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
807 |
483 | 808 u_char *ngx_http_proxy_log_error(ngx_log_t *log, u_char *buf, size_t len) |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
809 { |
461 | 810 u_char *p; |
811 ngx_int_t escape; | |
812 ngx_http_request_t *r; | |
813 ngx_peer_connection_t *peer; | |
483 | 814 ngx_http_proxy_log_ctx_t *ctx; |
461 | 815 ngx_http_proxy_upstream_conf_t *uc; |
171
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
816 |
483 | 817 ctx = log->data; |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
190
diff
changeset
|
818 r = ctx->proxy->request; |
461 | 819 uc = ctx->proxy->lcf->upstream; |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
190
diff
changeset
|
820 peer = &ctx->proxy->upstream->peer; |
171
aff0e5d32af8
nginx-0.0.1-2003-11-03-20:33:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
821 |
461 | 822 p = ngx_snprintf(buf, len, |
505 | 823 " while %s, client: %V, server: %V, URL: \"%V\"," |
503 | 824 " upstream: http://%V%s%V", |
461 | 825 ctx->proxy->action, |
826 &r->connection->addr_text, | |
503 | 827 &r->server_name, |
461 | 828 &r->unparsed_uri, |
479 | 829 &peer->peers->peer[peer->cur_peer].name, |
830 ctx->proxy->lcf->upstream->uri_separator, | |
461 | 831 &ctx->proxy->lcf->upstream->uri); |
832 len -= p - buf; | |
833 buf = p; | |
834 | |
505 | 835 if (ctx->proxy->lcf->pass_unparsed_uri && r->valid_unparsed_uri) { |
836 p = ngx_cpymem(buf, r->unparsed_uri.data + 1, r->unparsed_uri.len - 1); | |
837 len -= p - buf; | |
838 | |
839 return ngx_http_log_error_info(r, p, len); | |
840 } | |
841 | |
461 | 842 if (r->quoted_uri) { |
843 escape = 2 * ngx_escape_uri(NULL, r->uri.data + uc->location->len, | |
844 r->uri.len - uc->location->len, | |
845 NGX_ESCAPE_URI); | |
846 } else { | |
847 escape = 0; | |
848 } | |
849 | |
850 if (escape) { | |
851 if (len >= r->uri.len - uc->location->len + escape) { | |
852 | |
853 ngx_escape_uri(buf, r->uri.data + uc->location->len, | |
854 r->uri.len - uc->location->len, NGX_ESCAPE_URI); | |
855 | |
856 buf += r->uri.len - uc->location->len + escape; | |
505 | 857 len -= r->uri.len - uc->location->len + escape; |
461 | 858 |
505 | 859 if (r->args.len) { |
860 p = ngx_snprintf(buf, len, "?%V", &r->args); | |
861 len -= p - buf; | |
862 buf = p; | |
461 | 863 } |
864 | |
505 | 865 return ngx_http_log_error_info(r, buf, len); |
461 | 866 } |
867 | |
868 p = ngx_palloc(r->pool, r->uri.len - uc->location->len + escape); | |
869 if (p == NULL) { | |
870 return buf; | |
871 } | |
872 | |
873 ngx_escape_uri(p, r->uri.data + uc->location->len, | |
874 r->uri.len - uc->location->len, NGX_ESCAPE_URI); | |
875 | |
505 | 876 p = ngx_cpymem(buf, p, r->uri.len - uc->location->len + escape); |
461 | 877 |
878 } else { | |
505 | 879 p = ngx_cpymem(buf, r->uri.data + uc->location->len, |
880 r->uri.len - uc->location->len); | |
461 | 881 } |
882 | |
505 | 883 len -= p - buf; |
884 buf = p; | |
885 | |
886 if (r->args.len) { | |
887 p = ngx_snprintf(buf, len, "?%V", &r->args); | |
888 len -= p - buf; | |
889 buf = p; | |
890 } | |
891 | |
892 return ngx_http_log_error_info(r, buf, len); | |
124
842a78cebbb7
nginx-0.0.1-2003-08-01-18:56:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
893 } |
131
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
894 |
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
895 |
479 | 896 static size_t ngx_http_proxy_log_proxy_state_getlen(ngx_http_request_t *r, |
897 uintptr_t data) | |
898 { | |
899 ngx_http_proxy_ctx_t *p; | |
900 | |
901 p = ngx_http_get_module_err_ctx(r, ngx_http_proxy_module); | |
902 | |
903 if (p == NULL) { | |
904 return 1; | |
905 } | |
906 | |
907 return p->states.nelts * /* STUB */ 100; | |
908 } | |
909 | |
910 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
911 static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, |
479 | 912 u_char *buf, |
913 ngx_http_log_op_t *op) | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
914 { |
473 | 915 ngx_uint_t i; |
916 ngx_http_proxy_ctx_t *p; | |
917 ngx_http_proxy_state_t *state; | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
918 |
178
a8ff48d26cca
nginx-0.0.1-2003-11-11-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
177
diff
changeset
|
919 p = ngx_http_get_module_err_ctx(r, ngx_http_proxy_module); |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
920 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
921 if (p == NULL) { |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
922 *buf = '-'; |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
923 return buf + 1; |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
924 } |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
925 |
473 | 926 i = 0; |
927 state = p->states.elts; | |
178
a8ff48d26cca
nginx-0.0.1-2003-11-11-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
177
diff
changeset
|
928 |
473 | 929 for ( ;; ) { |
930 if (state[i].cache_state == 0) { | |
931 *buf++ = '-'; | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
932 |
473 | 933 } else { |
934 buf = ngx_cpymem(buf, cache_states[state[i].cache_state - 1].data, | |
935 cache_states[state[i].cache_state - 1].len); | |
936 } | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
937 |
473 | 938 *buf++ = '/'; |
939 | |
940 if (state[i].expired == 0) { | |
941 *buf++ = '-'; | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
942 |
473 | 943 } else { |
944 buf = ngx_sprintf(buf, "%T", state[i].expired); | |
945 } | |
946 | |
947 *buf++ = '/'; | |
948 | |
949 if (state[i].bl_time == 0) { | |
950 *buf++ = '-'; | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
951 |
473 | 952 } else { |
953 buf = ngx_sprintf(buf, "%T", state[i].bl_time); | |
954 } | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
955 |
473 | 956 *buf++ = '/'; |
957 | |
958 *buf++ = '*'; | |
959 | |
960 *buf++ = ' '; | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
961 |
473 | 962 if (state[i].status == 0) { |
963 *buf++ = '-'; | |
964 | |
965 } else { | |
966 buf = ngx_sprintf(buf, "%ui", state[i].status); | |
967 } | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
968 |
473 | 969 *buf++ = '/'; |
970 | |
971 if (state[i].reason == 0) { | |
972 *buf++ = '-'; | |
973 | |
974 } else { | |
975 buf = ngx_cpymem(buf, cache_reasons[state[i].reason - 1].data, | |
976 cache_reasons[state[i].reason - 1].len); | |
977 } | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
978 |
473 | 979 *buf++ = '/'; |
980 | |
981 if (state[i].reason < NGX_HTTP_PROXY_CACHE_XAE) { | |
982 *buf++ = '-'; | |
983 | |
984 } else { | |
985 buf = ngx_sprintf(buf, "%T", state[i].expires); | |
986 } | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
987 |
473 | 988 *buf++ = ' '; |
989 *buf++ = '*'; | |
990 | |
991 if (++i == p->states.nelts) { | |
992 return buf; | |
993 } | |
994 | |
995 *buf++ = ','; | |
996 *buf++ = ' '; | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
997 } |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
998 } |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
999 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1000 |
479 | 1001 #if 0 |
1002 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
1003 static u_char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
1004 u_char *buf, uintptr_t data) |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1005 { |
473 | 1006 ngx_uint_t i; |
1007 ngx_http_proxy_ctx_t *p; | |
1008 ngx_http_proxy_state_t *state; | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1009 |
178
a8ff48d26cca
nginx-0.0.1-2003-11-11-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
177
diff
changeset
|
1010 p = ngx_http_get_module_err_ctx(r, ngx_http_proxy_module); |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1011 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1012 if (p == NULL || p->state->cache_state == 0) { |
473 | 1013 if (buf == NULL) { |
1014 return (u_char *) 1; | |
1015 } | |
1016 | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1017 *buf = '-'; |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1018 return buf + 1; |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1019 } |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1020 |
473 | 1021 if (buf == NULL) { |
1022 /* find the request line length */ | |
1023 return (u_char *) (p->states.nelts * sizeof("BYPASS") - 1); | |
1024 } | |
1025 | |
1026 i = 0; | |
1027 state = p->states.elts; | |
1028 | |
1029 for ( ;; ) { | |
1030 buf = ngx_cpymem(buf, cache_states[state[i].cache_state - 1].data, | |
1031 cache_states[state[i].cache_state - 1].len); | |
1032 | |
1033 if (++i == p->states.nelts) { | |
1034 return buf; | |
1035 } | |
1036 | |
1037 *buf++ = ','; | |
1038 *buf++ = ' '; | |
1039 } | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1040 } |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1041 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1042 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
1043 static u_char *ngx_http_proxy_log_reason(ngx_http_request_t *r, u_char *buf, |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
1044 uintptr_t data) |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1045 { |
473 | 1046 ngx_uint_t i; |
1047 ngx_http_proxy_ctx_t *p; | |
1048 ngx_http_proxy_state_t *state; | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1049 |
178
a8ff48d26cca
nginx-0.0.1-2003-11-11-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
177
diff
changeset
|
1050 p = ngx_http_get_module_err_ctx(r, ngx_http_proxy_module); |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1051 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1052 if (p == NULL || p->state->reason == 0) { |
473 | 1053 if (buf == NULL) { |
1054 return (u_char *) 1; | |
1055 } | |
1056 | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1057 *buf = '-'; |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1058 return buf + 1; |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1059 } |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1060 |
473 | 1061 if (buf == NULL) { |
1062 /* find the request line length */ | |
1063 return (u_char *) (p->states.nelts * sizeof("BPS") - 1); | |
1064 } | |
1065 | |
1066 i = 0; | |
1067 state = p->states.elts; | |
1068 | |
1069 for ( ;; ) { | |
1070 buf = ngx_cpymem(buf, cache_reasons[state[i].reason - 1].data, | |
1071 cache_reasons[state[i].reason - 1].len); | |
1072 | |
1073 if (++i == p->states.nelts) { | |
1074 return buf; | |
1075 } | |
1076 | |
1077 *buf++ = ','; | |
1078 *buf++ = ' '; | |
1079 } | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1080 } |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1081 |
479 | 1082 #endif |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1083 |
479 | 1084 |
1085 static ngx_int_t ngx_http_proxy_add_log_formats(ngx_conf_t *cf) | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1086 { |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1087 ngx_http_log_op_name_t *op; |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1088 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1089 for (op = ngx_http_proxy_log_fmt_ops; op->name.len; op++) { /* void */ } |
479 | 1090 op->run = NULL; |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1091 |
479 | 1092 for (op = ngx_http_log_fmt_ops; op->run; op++) { |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1093 if (op->name.len == 0) { |
479 | 1094 op = (ngx_http_log_op_name_t *) op->run; |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1095 } |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1096 } |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1097 |
479 | 1098 op->run = (ngx_http_log_op_run_pt) ngx_http_proxy_log_fmt_ops; |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1099 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1100 return NGX_OK; |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1101 } |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1102 |
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
1103 |
131
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
1104 static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) |
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
1105 { |
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
1106 ngx_http_proxy_loc_conf_t *conf; |
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
1107 |
501 | 1108 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_loc_conf_t)); |
1109 if (conf == NULL) { | |
485 | 1110 return NGX_CONF_ERROR; |
1111 } | |
131
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
1112 |
479 | 1113 /* |
1114 * set by ngx_pcalloc(): | |
1115 * | |
1116 * conf->bufs.num = 0; | |
1117 * conf->path = NULL; | |
1118 * conf->next_upstream = 0; | |
1119 * conf->use_stale = 0; | |
1120 * conf->upstreams = NULL; | |
1121 * conf->peers = NULL; | |
1122 * conf->cache_path = NULL; | |
1123 * conf->temp_path = NULL; | |
485 | 1124 * conf->x_vars; |
479 | 1125 * conf->busy_lock = NULL; |
1126 */ | |
152
fb48bf4fea1c
nginx-0.0.1-2003-10-21-11:47:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
151
diff
changeset
|
1127 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
1128 conf->connect_timeout = NGX_CONF_UNSET_MSEC; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
1129 conf->send_timeout = NGX_CONF_UNSET_MSEC; |
452 | 1130 conf->send_lowat = NGX_CONF_UNSET_SIZE; |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
1131 |
505 | 1132 conf->pass_unparsed_uri = NGX_CONF_UNSET; |
288
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
1133 conf->preserve_host = NGX_CONF_UNSET; |
457 | 1134 conf->set_x_url = NGX_CONF_UNSET; |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
1135 conf->set_x_real_ip = NGX_CONF_UNSET; |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
1136 conf->add_x_forwarded_for = NGX_CONF_UNSET; |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
1137 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
1138 conf->header_buffer_size = NGX_CONF_UNSET_SIZE; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
1139 conf->read_timeout = NGX_CONF_UNSET_MSEC; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
1140 conf->busy_buffers_size = NGX_CONF_UNSET_SIZE; |
139
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
1141 |
467 | 1142 conf->max_temp_file_size = NGX_CONF_UNSET_SIZE; |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
288
diff
changeset
|
1143 conf->temp_file_write_size = NGX_CONF_UNSET_SIZE; |
139
54307053f185
nginx-0.0.1-2003-10-07-19:30:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
138
diff
changeset
|
1144 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1145 /* "proxy_cyclic_temp_file" is disabled */ |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1146 conf->cyclic_temp_file = 0; |
131
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
1147 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1148 conf->cache = NGX_CONF_UNSET; |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1149 |
163
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
162
diff
changeset
|
1150 conf->pass_server = NGX_CONF_UNSET; |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
1151 conf->pass_x_accel_expires = NGX_CONF_UNSET; |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
1152 conf->ignore_expires = NGX_CONF_UNSET; |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
1153 conf->lm_factor = NGX_CONF_UNSET; |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
1154 conf->default_expires = NGX_CONF_UNSET; |
163
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
162
diff
changeset
|
1155 |
131
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
1156 return conf; |
049e78b1f852
nginx-0.0.1-2003-08-14-10:00:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
124
diff
changeset
|
1157 } |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1158 |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1159 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1160 static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1161 void *parent, void *child) |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1162 { |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1163 ngx_http_proxy_loc_conf_t *prev = parent; |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1164 ngx_http_proxy_loc_conf_t *conf = child; |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1165 |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1166 size_t size; |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1167 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1168 ngx_conf_merge_msec_value(conf->connect_timeout, |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1169 prev->connect_timeout, 60000); |
448
241dc8092a33
nginx-0.1.0-2004-10-01-19:53:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
1170 ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 60000); |
452 | 1171 ngx_conf_merge_size_value(conf->send_lowat, prev->send_lowat, 0); |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
1172 |
505 | 1173 ngx_conf_merge_value(conf->pass_unparsed_uri, prev->pass_unparsed_uri, 0); |
1174 | |
1175 if (conf->pass_unparsed_uri && conf->upstream->location->len > 1) { | |
1176 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | |
1177 "\"proxy_pass_unparsed_uri\" can be set for " | |
1178 "location \"/\" or given by regular expression."); | |
1179 return NGX_CONF_ERROR; | |
1180 } | |
1181 | |
288
f81d075ad172
nginx-0.0.2-2004-03-14-23:46:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
1182 ngx_conf_merge_value(conf->preserve_host, prev->preserve_host, 0); |
457 | 1183 ngx_conf_merge_value(conf->set_x_url, prev->set_x_url, 0); |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
1184 ngx_conf_merge_value(conf->set_x_real_ip, prev->set_x_real_ip, 0); |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
1185 ngx_conf_merge_value(conf->add_x_forwarded_for, |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
1186 prev->add_x_forwarded_for, 0); |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
261
diff
changeset
|
1187 |
448
241dc8092a33
nginx-0.1.0-2004-10-01-19:53:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
1188 ngx_conf_merge_msec_value(conf->read_timeout, prev->read_timeout, 60000); |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1189 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1190 ngx_conf_merge_size_value(conf->header_buffer_size, |
448
241dc8092a33
nginx-0.1.0-2004-10-01-19:53:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
1191 prev->header_buffer_size, (size_t) ngx_pagesize); |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1192 |
448
241dc8092a33
nginx-0.1.0-2004-10-01-19:53:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
1193 ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 8, ngx_pagesize); |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1194 |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1195 if (conf->bufs.num < 2) { |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1196 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1197 "there must be at least 2 \"proxy_buffers\""); |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1198 return NGX_CONF_ERROR; |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1199 } |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1200 |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1201 size = conf->header_buffer_size; |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1202 if (size < conf->bufs.size) { |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1203 size = conf->bufs.size; |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1204 } |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1205 |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1206 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1207 ngx_conf_merge_size_value(conf->busy_buffers_size, |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1208 prev->busy_buffers_size, NGX_CONF_UNSET_SIZE); |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1209 |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1210 if (conf->busy_buffers_size == NGX_CONF_UNSET_SIZE) { |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1211 conf->busy_buffers_size = 2 * size; |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1212 |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1213 } else if (conf->busy_buffers_size < size) { |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1214 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1215 "\"proxy_busy_buffers_size\" must be equal or bigger than " |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1216 "maximum of the value of \"proxy_header_buffer_size\" and " |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1217 "one of the \"proxy_buffers\""); |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1218 |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1219 return NGX_CONF_ERROR; |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1220 |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1221 } else if (conf->busy_buffers_size > (conf->bufs.num - 1) * conf->bufs.size) |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1222 { |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1223 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1224 "\"proxy_busy_buffers_size\" must be less than " |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1225 "the size of all \"proxy_buffers\" minus one buffer"); |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1226 |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
305
diff
changeset
|
1227 return NGX_CONF_ERROR; |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1228 } |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1229 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1230 |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1231 ngx_conf_merge_size_value(conf->temp_file_write_size, |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1232 prev->temp_file_write_size, NGX_CONF_UNSET_SIZE); |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1233 |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1234 if (conf->temp_file_write_size == NGX_CONF_UNSET_SIZE) { |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1235 conf->temp_file_write_size = 2 * size; |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1236 |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1237 } else if (conf->temp_file_write_size < size) { |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1238 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1239 "\"proxy_temp_file_write_size\" must be equal or bigger than " |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1240 "maximum of the value of \"proxy_header_buffer_size\" and " |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1241 "one of the \"proxy_buffers\""); |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1242 |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1243 return NGX_CONF_ERROR; |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1244 } |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1245 |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1246 |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1247 ngx_conf_merge_size_value(conf->max_temp_file_size, |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1248 prev->max_temp_file_size, NGX_CONF_UNSET_SIZE); |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1249 |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1250 if (conf->max_temp_file_size == NGX_CONF_UNSET_SIZE) { |
467 | 1251 |
1252 /* | |
1253 * "proxy_max_temp_file_size" is set to 1G for reverse proxy, | |
1254 * it should be much less in the generic proxy | |
1255 */ | |
1256 | |
1257 conf->max_temp_file_size = 1024 * 1024 * 1024; | |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1258 |
467 | 1259 #if 0 |
1260 conf->max_temp_file_size = 2 * size; | |
1261 #endif | |
1262 | |
1263 | |
1264 } else if (conf->max_temp_file_size != 0 | |
1265 && conf->max_temp_file_size < size) | |
1266 { | |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1267 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
467 | 1268 "\"proxy_max_temp_file_size\" must be equal to zero to disable " |
1269 "the temporary files usage or must be equal or bigger than " | |
304
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1270 "maximum of the value of \"proxy_header_buffer_size\" and " |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1271 "one of the \"proxy_buffers\""); |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1272 |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1273 return NGX_CONF_ERROR; |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1274 } |
bcbe876f4262
nginx-0.0.3-2004-04-02-09:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
303
diff
changeset
|
1275 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1276 |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
1277 ngx_conf_merge_bitmask_value(conf->next_upstream, prev->next_upstream, |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1278 (NGX_CONF_BITMASK_SET |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1279 |NGX_HTTP_PROXY_FT_ERROR |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1280 |NGX_HTTP_PROXY_FT_TIMEOUT)); |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1281 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1282 ngx_conf_merge_bitmask_value(conf->use_stale, prev->use_stale, |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1283 NGX_CONF_BITMASK_SET); |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1284 |
479 | 1285 #if 0 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1286 ngx_conf_merge_path_value(conf->cache_path, prev->cache_path, |
479 | 1287 NGX_HTTP_PROXY_CACHE_PATH, 1, 2, 0, |
1288 ngx_garbage_collector_temp_handler, cf); | |
1289 #endif | |
160
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
159
diff
changeset
|
1290 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1291 ngx_conf_merge_path_value(conf->temp_path, prev->temp_path, |
479 | 1292 NGX_HTTP_PROXY_TEMP_PATH, 1, 2, 0, |
1293 ngx_garbage_collector_temp_handler, cf); | |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1294 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1295 ngx_conf_merge_value(conf->cache, prev->cache, 0); |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
169
diff
changeset
|
1296 |
174
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1297 |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1298 /* conf->cache must be merged */ |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1299 |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1300 if (conf->busy_lock == NULL) { |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1301 conf->busy_lock = prev->busy_lock; |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1302 } |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1303 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
1304 if (conf->busy_lock && conf->cache && conf->busy_lock->md5 == NULL) { |
174
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1305 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
1306 /* ngx_calloc_shared() */ |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
1307 conf->busy_lock->md5_mask = |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
1308 ngx_pcalloc(cf->pool, (conf->busy_lock->max_busy + 7) / 8); |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
1309 if (conf->busy_lock->md5_mask == NULL) { |
175
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
1310 return NGX_CONF_ERROR; |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
1311 } |
e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
174
diff
changeset
|
1312 |
174
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1313 /* 16 bytes are 128 bits of the md5 */ |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1314 |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1315 /* ngx_alloc_shared() */ |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
1316 conf->busy_lock->md5 = ngx_palloc(cf->pool, |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
1317 16 * conf->busy_lock->max_busy); |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
175
diff
changeset
|
1318 if (conf->busy_lock->md5 == NULL) { |
174
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1319 return NGX_CONF_ERROR; |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1320 } |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1321 } |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1322 |
ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
172
diff
changeset
|
1323 |
163
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
162
diff
changeset
|
1324 ngx_conf_merge_value(conf->pass_server, prev->pass_server, 0); |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
1325 ngx_conf_merge_value(conf->pass_x_accel_expires, |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
1326 prev->pass_x_accel_expires, 0); |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
1327 ngx_conf_merge_value(conf->ignore_expires, prev->ignore_expires, 0); |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
1328 ngx_conf_merge_value(conf->lm_factor, prev->lm_factor, 0); |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
171
diff
changeset
|
1329 ngx_conf_merge_sec_value(conf->default_expires, prev->default_expires, 0); |
163
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
162
diff
changeset
|
1330 |
487 | 1331 if (conf->x_vars == NULL) { |
1332 conf->x_vars = prev->x_vars; | |
1333 } | |
1334 | |
507 | 1335 if (conf->peers == NULL) { |
1336 conf->peers = prev->peers; | |
1337 conf->upstream = prev->upstream; | |
1338 } | |
1339 | |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1340 return NULL; |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1341 } |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1342 |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
154
diff
changeset
|
1343 |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1344 static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd, |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1345 void *conf) |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1346 { |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1347 ngx_http_proxy_loc_conf_t *lcf = conf; |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1348 |
479 | 1349 ngx_str_t *value, *url; |
1350 ngx_inet_upstream_t inet_upstream; | |
1351 ngx_http_core_loc_conf_t *clcf; | |
1352 #if (NGX_HAVE_UNIX_DOMAIN) | |
1353 ngx_unix_domain_upstream_t unix_upstream; | |
1354 #endif | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1355 |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1356 value = cf->args->elts; |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1357 |
479 | 1358 url = &value[1]; |
1359 | |
1360 if (ngx_strncasecmp(url->data, "http://", 7) != 0) { | |
452 | 1361 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid URL prefix"); |
1362 return NGX_CONF_ERROR; | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1363 } |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1364 |
452 | 1365 lcf->upstream = ngx_pcalloc(cf->pool, |
1366 sizeof(ngx_http_proxy_upstream_conf_t)); | |
1367 if (lcf->upstream == NULL) { | |
1368 return NGX_CONF_ERROR; | |
1369 } | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1370 |
485 | 1371 lcf->upstream->url = *url; |
1372 | |
479 | 1373 if (ngx_strncasecmp(url->data + 7, "unix:", 5) == 0) { |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1374 |
479 | 1375 #if (NGX_HAVE_UNIX_DOMAIN) |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1376 |
479 | 1377 ngx_memzero(&unix_upstream, sizeof(ngx_unix_domain_upstream_t)); |
452 | 1378 |
479 | 1379 unix_upstream.name = *url; |
1380 unix_upstream.url.len = url->len - 7; | |
1381 unix_upstream.url.data = url->data + 7; | |
1382 unix_upstream.uri_part = 1; | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1383 |
501 | 1384 lcf->peers = ngx_unix_upstream_parse(cf, &unix_upstream); |
1385 if (lcf->peers == NULL) { | |
452 | 1386 return NGX_CONF_ERROR; |
1387 } | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1388 |
479 | 1389 lcf->upstream->host_header.len = sizeof("localhost") - 1; |
1390 lcf->upstream->host_header.data = (u_char *) "localhost"; | |
1391 lcf->upstream->uri = unix_upstream.uri; | |
1392 lcf->upstream->uri_separator = ":"; | |
1393 lcf->upstream->default_port = 1; | |
452 | 1394 |
479 | 1395 #else |
1396 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1397 "the unix domain sockets are not supported " | |
1398 "on this platform"); | |
1399 return NGX_CONF_ERROR; | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1400 |
479 | 1401 #endif |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1402 |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1403 } else { |
479 | 1404 ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t)); |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1405 |
479 | 1406 inet_upstream.name = *url; |
1407 inet_upstream.url.len = url->len - 7; | |
1408 inet_upstream.url.data = url->data + 7; | |
1409 inet_upstream.default_port_value = 80; | |
1410 inet_upstream.uri_part = 1; | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1411 |
501 | 1412 lcf->peers = ngx_inet_upstream_parse(cf, &inet_upstream); |
1413 if (lcf->peers == NULL) { | |
452 | 1414 return NGX_CONF_ERROR; |
1415 } | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1416 |
479 | 1417 lcf->upstream->host_header = inet_upstream.host_header; |
1418 lcf->upstream->port_text = inet_upstream.port_text; | |
1419 lcf->upstream->uri = inet_upstream.uri; | |
1420 lcf->upstream->uri_separator = ""; | |
481 | 1421 lcf->upstream->default_port = inet_upstream.default_port; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1422 } |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1423 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
379
diff
changeset
|
1424 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
379
diff
changeset
|
1425 |
501 | 1426 clcf->handler = ngx_http_proxy_handler; |
1427 | |
1428 #if (NGX_PCRE) | |
1429 lcf->upstream->location = clcf->regex ? &ngx_http_proxy_uri : &clcf->name; | |
1430 #else | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1431 lcf->upstream->location = &clcf->name; |
501 | 1432 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
379
diff
changeset
|
1433 |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
190
diff
changeset
|
1434 if (clcf->name.data[clcf->name.len - 1] == '/') { |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
190
diff
changeset
|
1435 clcf->auto_redirect = 1; |
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
190
diff
changeset
|
1436 } |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1437 |
479 | 1438 return NGX_CONF_OK; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1439 } |
452 | 1440 |
1441 | |
485 | 1442 static char *ngx_http_proxy_set_x_var(ngx_conf_t *cf, ngx_command_t *cmd, |
1443 void *conf) | |
1444 { | |
1445 ngx_http_proxy_loc_conf_t *lcf = conf; | |
1446 | |
1447 ngx_uint_t i, *index; | |
1448 ngx_str_t *value; | |
1449 ngx_http_variable_t *var; | |
1450 ngx_http_core_main_conf_t *cmcf; | |
1451 | |
487 | 1452 if (lcf->x_vars == NULL) { |
1453 lcf->x_vars = ngx_array_create(cf->pool, 4, | |
1454 sizeof(ngx_http_variable_t *)); | |
1455 if (lcf->x_vars == NULL) { | |
485 | 1456 return NGX_CONF_ERROR; |
1457 } | |
1458 } | |
1459 | |
1460 cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); | |
1461 | |
1462 value = cf->args->elts; | |
1463 | |
1464 var = cmcf->variables.elts; | |
1465 for (i = 0; i < cmcf->variables.nelts; i++) { | |
1466 if (ngx_strcasecmp(var[i].name.data, value[1].data) == 0) { | |
1467 | |
501 | 1468 index = ngx_array_push(lcf->x_vars); |
1469 if (index == NULL) { | |
485 | 1470 return NGX_CONF_ERROR; |
1471 } | |
1472 | |
1473 *index = var[i].index; | |
1474 return NGX_CONF_OK; | |
1475 } | |
1476 } | |
1477 | |
1478 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1479 "unknown variable name \"%V\"", &value[1]); | |
1480 return NGX_CONF_ERROR; | |
1481 } | |
1482 | |
1483 | |
452 | 1484 static char *ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data) |
1485 { | |
473 | 1486 #if (NGX_FREEBSD) |
455 | 1487 ssize_t *np = data; |
452 | 1488 |
1489 if (*np >= ngx_freebsd_net_inet_tcp_sendspace) { | |
1490 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1491 "\"proxy_send_lowat\" must be less than %d " | |
1492 "(sysctl net.inet.tcp.sendspace)", | |
1493 ngx_freebsd_net_inet_tcp_sendspace); | |
1494 | |
1495 return NGX_CONF_ERROR; | |
1496 } | |
1497 | |
469 | 1498 #elif !(NGX_HAVE_SO_SNDLOWAT) |
473 | 1499 ssize_t *np = data; |
452 | 1500 |
1501 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
1502 "\"proxy_send_lowat\" is not supported, ignored"); | |
1503 | |
1504 *np = 0; | |
1505 | |
1506 #endif | |
1507 | |
1508 return NGX_CONF_OK; | |
1509 } |