Mercurial > hg > nginx-vendor-0-5
comparison src/http/modules/ngx_http_proxy_module.c @ 130:82d695e3d662 NGINX_0_3_12
nginx 0.3.12
*) Security: if nginx was built with the ngx_http_realip_module and the
"satisfy_any on" directive was used, then access and authorization
directives did not work. The ngx_http_realip_module was not built
and is not built by default.
*) Change: the "$time_gmt" variable name was changed to "$time_local".
*) Change: the "proxy_header_buffer_size" and
"fastcgi_header_buffer_size" directives was renamed to the
"proxy_buffer_size" and "fastcgi_buffer_size" directives.
*) Feature: the ngx_http_memcached_module.
*) Feature: the "proxy_buffering" directive.
*) Bugfix: the changes in accept mutex handling when the "rtsig" method
was used; bug appeared in 0.3.0.
*) Bugfix: if the client sent the "Transfer-Encoding: chunked" header
line, then nginx returns the 411 error.
*) Bugfix: if the "auth_basic" directive was inherited from the http
level, then the realm in the "WWW-Authenticate" header line was
without the "Basic realm" text.
*) Bugfix: if the "combined" format was explicitly specified in the
"access_log" directive, then the empty lines was written to the log;
bug appeared in 0.3.8.
*) Bugfix: nginx did not run on the sparc platform under any OS except
Solaris.
*) Bugfix: now it is not necessary to place space between the quoted
string and closing bracket in the "if" directive.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Sat, 26 Nov 2005 00:00:00 +0300 |
parents | f1ad9023c312 |
children | 91372f004adf |
comparison
equal
deleted
inserted
replaced
129:a27c77ef3ad8 | 130:82d695e3d662 |
---|---|
109 | 109 |
110 | 110 |
111 static ngx_conf_post_t ngx_http_proxy_lowat_post = | 111 static ngx_conf_post_t ngx_http_proxy_lowat_post = |
112 { ngx_http_proxy_lowat_check }; | 112 { ngx_http_proxy_lowat_check }; |
113 | 113 |
114 static ngx_conf_deprecated_t ngx_conf_deprecated_proxy_header_buffer_size = { | |
115 ngx_conf_deprecated, "proxy_header_buffer_size", "proxy_buffer_size" | |
116 }; | |
117 | |
114 | 118 |
115 static ngx_conf_bitmask_t ngx_http_proxy_next_upstream_masks[] = { | 119 static ngx_conf_bitmask_t ngx_http_proxy_next_upstream_masks[] = { |
116 { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR }, | 120 { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR }, |
117 { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT }, | 121 { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT }, |
118 { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER }, | 122 { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER }, |
136 ngx_http_proxy_redirect, | 140 ngx_http_proxy_redirect, |
137 NGX_HTTP_LOC_CONF_OFFSET, | 141 NGX_HTTP_LOC_CONF_OFFSET, |
138 0, | 142 0, |
139 NULL }, | 143 NULL }, |
140 | 144 |
145 { ngx_string("proxy_buffering"), | |
146 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
147 ngx_conf_set_flag_slot, | |
148 NGX_HTTP_LOC_CONF_OFFSET, | |
149 offsetof(ngx_http_proxy_loc_conf_t, upstream.buffering), | |
150 NULL }, | |
151 | |
141 { ngx_string("proxy_connect_timeout"), | 152 { ngx_string("proxy_connect_timeout"), |
142 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 153 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
143 ngx_conf_set_msec_slot, | 154 ngx_conf_set_msec_slot, |
144 NGX_HTTP_LOC_CONF_OFFSET, | 155 NGX_HTTP_LOC_CONF_OFFSET, |
145 offsetof(ngx_http_proxy_loc_conf_t, upstream.connect_timeout), | 156 offsetof(ngx_http_proxy_loc_conf_t, upstream.connect_timeout), |
199 ngx_conf_set_flag_slot, | 210 ngx_conf_set_flag_slot, |
200 NGX_HTTP_LOC_CONF_OFFSET, | 211 NGX_HTTP_LOC_CONF_OFFSET, |
201 offsetof(ngx_http_proxy_loc_conf_t, upstream.pass_request_body), | 212 offsetof(ngx_http_proxy_loc_conf_t, upstream.pass_request_body), |
202 NULL }, | 213 NULL }, |
203 | 214 |
215 { ngx_string("proxy_buffer_size"), | |
216 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
217 ngx_conf_set_size_slot, | |
218 NGX_HTTP_LOC_CONF_OFFSET, | |
219 offsetof(ngx_http_proxy_loc_conf_t, upstream.buffer_size), | |
220 NULL }, | |
221 | |
204 { ngx_string("proxy_header_buffer_size"), | 222 { ngx_string("proxy_header_buffer_size"), |
205 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 223 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
206 ngx_conf_set_size_slot, | 224 ngx_conf_set_size_slot, |
207 NGX_HTTP_LOC_CONF_OFFSET, | 225 NGX_HTTP_LOC_CONF_OFFSET, |
208 offsetof(ngx_http_proxy_loc_conf_t, upstream.header_buffer_size), | 226 offsetof(ngx_http_proxy_loc_conf_t, upstream.buffer_size), |
209 NULL }, | 227 &ngx_conf_deprecated_proxy_header_buffer_size }, |
210 | 228 |
211 { ngx_string("proxy_read_timeout"), | 229 { ngx_string("proxy_read_timeout"), |
212 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 230 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
213 ngx_conf_set_msec_slot, | 231 ngx_conf_set_msec_slot, |
214 NGX_HTTP_LOC_CONF_OFFSET, | 232 NGX_HTTP_LOC_CONF_OFFSET, |
331 | 349 |
332 | 350 |
333 static ngx_table_elt_t ngx_http_proxy_headers[] = { | 351 static ngx_table_elt_t ngx_http_proxy_headers[] = { |
334 { 0, ngx_string("Host"), ngx_string("$proxy_host") }, | 352 { 0, ngx_string("Host"), ngx_string("$proxy_host") }, |
335 { 0, ngx_string("Connection"), ngx_string("close") }, | 353 { 0, ngx_string("Connection"), ngx_string("close") }, |
354 { 0, ngx_string("Keep-Alive"), ngx_string("") }, | |
336 { 0, ngx_null_string, ngx_null_string } | 355 { 0, ngx_null_string, ngx_null_string } |
337 }; | 356 }; |
338 | 357 |
339 | 358 |
340 static ngx_http_variable_t ngx_http_proxy_vars[] = { | 359 static ngx_http_variable_t ngx_http_proxy_vars[] = { |
393 | 412 |
394 if (plcf->redirects) { | 413 if (plcf->redirects) { |
395 u->rewrite_redirect = ngx_http_proxy_rewrite_redirect; | 414 u->rewrite_redirect = ngx_http_proxy_rewrite_redirect; |
396 } | 415 } |
397 | 416 |
398 u->pipe.input_filter = ngx_event_pipe_copy_input_filter; | 417 if (plcf->upstream.buffering) { |
418 | |
419 u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t)); | |
420 if (u->pipe == NULL) { | |
421 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
422 } | |
423 | |
424 u->pipe->input_filter = ngx_event_pipe_copy_input_filter; | |
425 } | |
399 | 426 |
400 u->accel = 1; | 427 u->accel = 1; |
401 | 428 |
402 r->upstream = u; | 429 r->upstream = u; |
403 | 430 |
826 | 853 |
827 u = r->upstream; | 854 u = r->upstream; |
828 | 855 |
829 state = r->state; | 856 state = r->state; |
830 | 857 |
831 for (pos = u->header_in.pos; pos < u->header_in.last; pos++) { | 858 for (pos = u->buffer.pos; pos < u->buffer.last; pos++) { |
832 ch = *pos; | 859 ch = *pos; |
833 | 860 |
834 switch (state) { | 861 switch (state) { |
835 | 862 |
836 /* "HTTP/" */ | 863 /* "HTTP/" */ |
984 return NGX_HTTP_PROXY_PARSE_NO_HEADER; | 1011 return NGX_HTTP_PROXY_PARSE_NO_HEADER; |
985 } | 1012 } |
986 } | 1013 } |
987 } | 1014 } |
988 | 1015 |
989 u->header_in.pos = pos; | 1016 u->buffer.pos = pos; |
990 r->state = state; | 1017 r->state = state; |
991 | 1018 |
992 return NGX_AGAIN; | 1019 return NGX_AGAIN; |
993 | 1020 |
994 done: | 1021 done: |
995 | 1022 |
996 u->header_in.pos = pos + 1; | 1023 u->buffer.pos = pos + 1; |
997 | 1024 |
998 if (p->status_end == NULL) { | 1025 if (p->status_end == NULL) { |
999 p->status_end = pos; | 1026 p->status_end = pos; |
1000 } | 1027 } |
1001 | 1028 |
1017 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); | 1044 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); |
1018 hh = (ngx_http_upstream_header_t *) umcf->headers_in_hash.buckets; | 1045 hh = (ngx_http_upstream_header_t *) umcf->headers_in_hash.buckets; |
1019 | 1046 |
1020 for ( ;; ) { | 1047 for ( ;; ) { |
1021 | 1048 |
1022 rc = ngx_http_parse_header_line(r, &r->upstream->header_in); | 1049 rc = ngx_http_parse_header_line(r, &r->upstream->buffer); |
1023 | 1050 |
1024 if (rc == NGX_OK) { | 1051 if (rc == NGX_OK) { |
1025 | 1052 |
1026 /* a header line has been parsed successfully */ | 1053 /* a header line has been parsed successfully */ |
1027 | 1054 |
1357 | 1384 |
1358 /* | 1385 /* |
1359 * set by ngx_pcalloc(): | 1386 * set by ngx_pcalloc(): |
1360 * | 1387 * |
1361 * conf->upstream.bufs.num = 0; | 1388 * conf->upstream.bufs.num = 0; |
1362 * conf->upstream.path = NULL; | |
1363 * conf->upstream.next_upstream = 0; | 1389 * conf->upstream.next_upstream = 0; |
1364 * conf->upstream.temp_path = NULL; | 1390 * conf->upstream.temp_path = NULL; |
1365 * conf->upstream.schema = { 0, NULL }; | 1391 * conf->upstream.schema = { 0, NULL }; |
1366 * conf->upstream.uri = { 0, NULL }; | 1392 * conf->upstream.uri = { 0, NULL }; |
1367 * conf->upstream.location = NULL; | 1393 * conf->upstream.location = NULL; |
1375 * conf->body_set = NULL; | 1401 * conf->body_set = NULL; |
1376 * conf->body_source = { 0, NULL }; | 1402 * conf->body_source = { 0, NULL }; |
1377 * conf->rewrite_locations = NULL; | 1403 * conf->rewrite_locations = NULL; |
1378 */ | 1404 */ |
1379 | 1405 |
1406 conf->upstream.buffering = NGX_CONF_UNSET; | |
1407 | |
1380 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; | 1408 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; |
1381 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; | 1409 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; |
1382 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC; | 1410 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC; |
1383 | 1411 |
1384 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; | 1412 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; |
1385 conf->upstream.header_buffer_size = NGX_CONF_UNSET_SIZE; | 1413 conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE; |
1386 | 1414 |
1387 conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; | 1415 conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; |
1388 conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE; | 1416 conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE; |
1389 conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE; | 1417 conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE; |
1390 | 1418 |
1424 ngx_table_elt_t *src, *s, *h; | 1452 ngx_table_elt_t *src, *s, *h; |
1425 ngx_http_proxy_redirect_t *pr; | 1453 ngx_http_proxy_redirect_t *pr; |
1426 ngx_http_script_compile_t sc; | 1454 ngx_http_script_compile_t sc; |
1427 ngx_http_script_copy_code_t *copy; | 1455 ngx_http_script_copy_code_t *copy; |
1428 | 1456 |
1457 ngx_conf_merge_value(conf->upstream.buffering, | |
1458 prev->upstream.buffering, 1); | |
1459 | |
1429 ngx_conf_merge_msec_value(conf->upstream.connect_timeout, | 1460 ngx_conf_merge_msec_value(conf->upstream.connect_timeout, |
1430 prev->upstream.connect_timeout, 60000); | 1461 prev->upstream.connect_timeout, 60000); |
1431 | 1462 |
1432 ngx_conf_merge_msec_value(conf->upstream.send_timeout, | 1463 ngx_conf_merge_msec_value(conf->upstream.send_timeout, |
1433 prev->upstream.send_timeout, 60000); | 1464 prev->upstream.send_timeout, 60000); |
1436 prev->upstream.read_timeout, 60000); | 1467 prev->upstream.read_timeout, 60000); |
1437 | 1468 |
1438 ngx_conf_merge_size_value(conf->upstream.send_lowat, | 1469 ngx_conf_merge_size_value(conf->upstream.send_lowat, |
1439 prev->upstream.send_lowat, 0); | 1470 prev->upstream.send_lowat, 0); |
1440 | 1471 |
1441 ngx_conf_merge_size_value(conf->upstream.header_buffer_size, | 1472 ngx_conf_merge_size_value(conf->upstream.buffer_size, |
1442 prev->upstream.header_buffer_size, | 1473 prev->upstream.buffer_size, |
1443 (size_t) ngx_pagesize); | 1474 (size_t) ngx_pagesize); |
1444 | 1475 |
1445 ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs, | 1476 ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs, |
1446 8, ngx_pagesize); | 1477 8, ngx_pagesize); |
1447 | 1478 |
1450 "there must be at least 2 \"proxy_buffers\""); | 1481 "there must be at least 2 \"proxy_buffers\""); |
1451 return NGX_CONF_ERROR; | 1482 return NGX_CONF_ERROR; |
1452 } | 1483 } |
1453 | 1484 |
1454 | 1485 |
1455 size = conf->upstream.header_buffer_size; | 1486 size = conf->upstream.buffer_size; |
1456 if (size < conf->upstream.bufs.size) { | 1487 if (size < conf->upstream.bufs.size) { |
1457 size = conf->upstream.bufs.size; | 1488 size = conf->upstream.bufs.size; |
1458 } | 1489 } |
1459 | 1490 |
1460 | 1491 |