comparison src/http/modules/ngx_http_proxy_module.c @ 78:9db7e0b5b27f NGINX_0_1_39

nginx 0.1.39 *) The changes in the ngx_http_charset_module: the "default_charset" directive was canceled; the "charset" directive sets the response charset; the "source_charset" directive sets the source charset only. *) Bugfix: the backend "WWW-Authenticate" header line did not transferred while the 401 response code redirecting. *) Bugfix: the ngx_http_proxy_module and ngx_http_fastcgi_module may close a connection before anything was transferred to a client; bug appeared in 0.1.38. *) Workaround: the Linux glibc crypt_r() initialization bug. *) Bugfix: the ngx_http_ssi_module did not support the relative URI in the "include virtual" command. *) Bugfix: if the backend response had the "Location" header line and nginx should not rewrite this line, then the 500 code response body was transferred; bug appeared in 0.1.29. *) Bugfix: some directives of the ngx_http_proxy_module and ngx_http_fastcgi_module were not inherited from the server to the location level; bug appeared in 0.1.29. *) Bugfix: the ngx_http_ssl_module did not support the certificate chain. *) Bugfix: the ngx_http_autoindex_module did not show correctly the long file names; bug appeared in 0.1.38. *) Bugfixes in IMAP/POP3 proxy in interaction with a backend at the login state.
author Igor Sysoev <http://sysoev.ru>
date Thu, 14 Jul 2005 00:00:00 +0400
parents da9a3b14312d
children 2aa14f638cf0
comparison
equal deleted inserted replaced
77:e6b3de2dc637 78:9db7e0b5b27f
217 217
218 { ngx_string("proxy_busy_buffers_size"), 218 { ngx_string("proxy_busy_buffers_size"),
219 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 219 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
220 ngx_conf_set_size_slot, 220 ngx_conf_set_size_slot,
221 NGX_HTTP_LOC_CONF_OFFSET, 221 NGX_HTTP_LOC_CONF_OFFSET,
222 offsetof(ngx_http_proxy_loc_conf_t, upstream.busy_buffers_size), 222 offsetof(ngx_http_proxy_loc_conf_t, upstream.busy_buffers_size_conf),
223 NULL }, 223 NULL },
224 224
225 { ngx_string("proxy_temp_path"), 225 { ngx_string("proxy_temp_path"),
226 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, 226 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234,
227 ngx_conf_set_path_slot, 227 ngx_conf_set_path_slot,
231 231
232 { ngx_string("proxy_max_temp_file_size"), 232 { ngx_string("proxy_max_temp_file_size"),
233 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 233 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
234 ngx_conf_set_size_slot, 234 ngx_conf_set_size_slot,
235 NGX_HTTP_LOC_CONF_OFFSET, 235 NGX_HTTP_LOC_CONF_OFFSET,
236 offsetof(ngx_http_proxy_loc_conf_t, upstream.max_temp_file_size), 236 offsetof(ngx_http_proxy_loc_conf_t, upstream.max_temp_file_size_conf),
237 NULL }, 237 NULL },
238 238
239 { ngx_string("proxy_temp_file_write_size"), 239 { ngx_string("proxy_temp_file_write_size"),
240 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 240 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
241 ngx_conf_set_size_slot, 241 ngx_conf_set_size_slot,
242 NGX_HTTP_LOC_CONF_OFFSET, 242 NGX_HTTP_LOC_CONF_OFFSET,
243 offsetof(ngx_http_proxy_loc_conf_t, upstream.temp_file_write_size), 243 offsetof(ngx_http_proxy_loc_conf_t, upstream.temp_file_write_size_conf),
244 NULL }, 244 NULL },
245 245
246 { ngx_string("proxy_next_upstream"), 246 { ngx_string("proxy_next_upstream"),
247 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_ANY, 247 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_ANY,
248 ngx_conf_set_bitmask_slot, 248 ngx_conf_set_bitmask_slot,
718 p->status = NGX_HTTP_OK; 718 p->status = NGX_HTTP_OK;
719 719
720 return NGX_OK; 720 return NGX_OK;
721 } 721 }
722 722
723 r->headers_out.status = p->status; 723 u->headers_in.status_n = p->status;
724 u->state->status = p->status; 724 u->state->status = p->status;
725 725
726 r->headers_out.status_line.len = p->status_end - p->status_start; 726 u->headers_in.status_line.len = p->status_end - p->status_start;
727 r->headers_out.status_line.data = ngx_palloc(r->pool, 727 u->headers_in.status_line.data = ngx_palloc(r->pool,
728 r->headers_out.status_line.len); 728 u->headers_in.status_line.len);
729 if (r->headers_out.status_line.data == NULL) { 729 if (u->headers_in.status_line.data == NULL) {
730 return NGX_HTTP_INTERNAL_SERVER_ERROR; 730 return NGX_HTTP_INTERNAL_SERVER_ERROR;
731 } 731 }
732 ngx_memcpy(r->headers_out.status_line.data, p->status_start, 732 ngx_memcpy(u->headers_in.status_line.data, p->status_start,
733 r->headers_out.status_line.len); 733 u->headers_in.status_line.len);
734 734
735 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 735 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
736 "http proxy status %ui \"%V\"", 736 "http proxy status %ui \"%V\"",
737 r->headers_out.status, &r->headers_out.status_line); 737 u->headers_in.status, &u->headers_in.status_line);
738 738
739 u->process_header = ngx_http_proxy_process_header; 739 u->process_header = ngx_http_proxy_process_header;
740 740
741 return ngx_http_proxy_process_header(r); 741 return ngx_http_proxy_process_header(r);
742 } 742 }
1299 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; 1299 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
1300 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC; 1300 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
1301 1301
1302 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; 1302 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
1303 conf->upstream.header_buffer_size = NGX_CONF_UNSET_SIZE; 1303 conf->upstream.header_buffer_size = NGX_CONF_UNSET_SIZE;
1304 conf->upstream.busy_buffers_size = NGX_CONF_UNSET_SIZE; 1304
1305 conf->upstream.max_temp_file_size = NGX_CONF_UNSET_SIZE; 1305 conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
1306 conf->upstream.temp_file_write_size = NGX_CONF_UNSET_SIZE; 1306 conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
1307 conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
1307 1308
1308 conf->upstream.pass_unparsed_uri = NGX_CONF_UNSET; 1309 conf->upstream.pass_unparsed_uri = NGX_CONF_UNSET;
1309 conf->upstream.method = NGX_CONF_UNSET_UINT; 1310 conf->upstream.method = NGX_CONF_UNSET_UINT;
1310 conf->upstream.pass_request_headers = NGX_CONF_UNSET; 1311 conf->upstream.pass_request_headers = NGX_CONF_UNSET;
1311 conf->upstream.pass_request_body = NGX_CONF_UNSET; 1312 conf->upstream.pass_request_body = NGX_CONF_UNSET;
1372 if (size < conf->upstream.bufs.size) { 1373 if (size < conf->upstream.bufs.size) {
1373 size = conf->upstream.bufs.size; 1374 size = conf->upstream.bufs.size;
1374 } 1375 }
1375 1376
1376 1377
1377 ngx_conf_merge_size_value(conf->upstream.busy_buffers_size, 1378 ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf,
1378 prev->upstream.busy_buffers_size, 1379 prev->upstream.busy_buffers_size_conf,
1379 NGX_CONF_UNSET_SIZE); 1380 NGX_CONF_UNSET_SIZE);
1380 1381
1381 if (conf->upstream.busy_buffers_size == NGX_CONF_UNSET_SIZE) { 1382 if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) {
1382 conf->upstream.busy_buffers_size = 2 * size; 1383 conf->upstream.busy_buffers_size = 2 * size;
1383 1384 } else {
1384 } else if (conf->upstream.busy_buffers_size < size) { 1385 conf->upstream.busy_buffers_size =
1386 conf->upstream.busy_buffers_size_conf;
1387 }
1388
1389 if (conf->upstream.busy_buffers_size < size) {
1385 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 1390 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1386 "\"proxy_busy_buffers_size\" must be equal or bigger than " 1391 "\"proxy_busy_buffers_size\" must be equal or bigger than "
1387 "maximum of the value of \"proxy_header_buffer_size\" and " 1392 "maximum of the value of \"proxy_header_buffer_size\" and "
1388 "one of the \"proxy_buffers\""); 1393 "one of the \"proxy_buffers\"");
1389 1394
1390 return NGX_CONF_ERROR; 1395 return NGX_CONF_ERROR;
1391 1396 }
1392 } else if (conf->upstream.busy_buffers_size 1397
1393 > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size) 1398 if (conf->upstream.busy_buffers_size
1399 > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
1394 { 1400 {
1395 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 1401 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1396 "\"proxy_busy_buffers_size\" must be less than " 1402 "\"proxy_busy_buffers_size\" must be less than "
1397 "the size of all \"proxy_buffers\" minus one buffer"); 1403 "the size of all \"proxy_buffers\" minus one buffer");
1398 1404
1399 return NGX_CONF_ERROR; 1405 return NGX_CONF_ERROR;
1400 } 1406 }
1407
1408
1409 ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf,
1410 prev->upstream.temp_file_write_size_conf,
1411 NGX_CONF_UNSET_SIZE);
1412
1413 if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) {
1414 conf->upstream.temp_file_write_size = 2 * size;
1415 } else {
1416 conf->upstream.temp_file_write_size =
1417 conf->upstream.temp_file_write_size_conf;
1418 }
1401 1419
1402 1420 if (conf->upstream.temp_file_write_size < size) {
1403 ngx_conf_merge_size_value(conf->upstream.temp_file_write_size,
1404 prev->upstream.temp_file_write_size,
1405 NGX_CONF_UNSET_SIZE);
1406
1407 if (conf->upstream.temp_file_write_size == NGX_CONF_UNSET_SIZE) {
1408 conf->upstream.temp_file_write_size = 2 * size;
1409
1410 } else if (conf->upstream.temp_file_write_size < size) {
1411 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 1421 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1412 "\"proxy_temp_file_write_size\" must be equal or bigger than " 1422 "\"proxy_temp_file_write_size\" must be equal or bigger than "
1413 "maximum of the value of \"proxy_header_buffer_size\" and " 1423 "maximum of the value of \"proxy_header_buffer_size\" and "
1414 "one of the \"proxy_buffers\""); 1424 "one of the \"proxy_buffers\"");
1415 1425
1416 return NGX_CONF_ERROR; 1426 return NGX_CONF_ERROR;
1417 } 1427 }
1418 1428
1419 1429 ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf,
1420 ngx_conf_merge_size_value(conf->upstream.max_temp_file_size, 1430 prev->upstream.max_temp_file_size_conf,
1421 prev->upstream.max_temp_file_size,
1422 NGX_CONF_UNSET_SIZE); 1431 NGX_CONF_UNSET_SIZE);
1423 1432
1424 if (conf->upstream.max_temp_file_size == NGX_CONF_UNSET_SIZE) { 1433 if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) {
1425
1426 conf->upstream.max_temp_file_size = 1024 * 1024 * 1024; 1434 conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
1427 1435 } else {
1428 } else if (conf->upstream.max_temp_file_size != 0 1436 conf->upstream.max_temp_file_size =
1429 && conf->upstream.max_temp_file_size < size) 1437 conf->upstream.max_temp_file_size_conf;
1438 }
1439
1440 if (conf->upstream.max_temp_file_size != 0
1441 && conf->upstream.max_temp_file_size < size)
1430 { 1442 {
1431 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 1443 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1432 "\"fastcgi_max_temp_file_size\" must be equal to zero to disable " 1444 "\"fastcgi_max_temp_file_size\" must be equal to zero to disable "
1433 "the temporary files usage or must be equal or bigger than " 1445 "the temporary files usage or must be equal or bigger than "
1434 "maximum of the value of \"fastcgi_header_buffer_size\" and " 1446 "maximum of the value of \"fastcgi_header_buffer_size\" and "
1435 "one of the \"fastcgi_buffers\""); 1447 "one of the \"fastcgi_buffers\"");
1436 1448
1437 return NGX_CONF_ERROR; 1449 return NGX_CONF_ERROR;
1438 } 1450 }
1439 1451
1452
1440 ngx_conf_merge_bitmask_value(conf->upstream.next_upstream, 1453 ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
1441 prev->upstream.next_upstream, 1454 prev->upstream.next_upstream,
1442 (NGX_CONF_BITMASK_SET 1455 (NGX_CONF_BITMASK_SET
1443 |NGX_HTTP_UPSTREAM_FT_ERROR 1456 |NGX_HTTP_UPSTREAM_FT_ERROR
1444 |NGX_HTTP_UPSTREAM_FT_TIMEOUT)); 1457 |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
1446 ngx_conf_merge_path_value(conf->upstream.temp_path, 1459 ngx_conf_merge_path_value(conf->upstream.temp_path,
1447 prev->upstream.temp_path, 1460 prev->upstream.temp_path,
1448 NGX_HTTP_PROXY_TEMP_PATH, 1, 2, 0, 1461 NGX_HTTP_PROXY_TEMP_PATH, 1, 2, 0,
1449 ngx_garbage_collector_temp_handler, cf); 1462 ngx_garbage_collector_temp_handler, cf);
1450 1463
1451 ngx_conf_merge_msec_value(conf->upstream.pass_unparsed_uri, 1464 ngx_conf_merge_value(conf->upstream.pass_unparsed_uri,
1452 prev->upstream.pass_unparsed_uri, 0); 1465 prev->upstream.pass_unparsed_uri, 0);
1453 1466
1454 if (conf->upstream.pass_unparsed_uri && conf->upstream.location->len > 1) { 1467 if (conf->upstream.pass_unparsed_uri && conf->upstream.location->len > 1) {
1455 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, 1468 ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
1456 "\"proxy_pass_unparsed_uri\" can be set for " 1469 "\"proxy_pass_unparsed_uri\" can be set for "
1465 ngx_conf_merge_value(conf->upstream.pass_request_headers, 1478 ngx_conf_merge_value(conf->upstream.pass_request_headers,
1466 prev->upstream.pass_request_headers, 1); 1479 prev->upstream.pass_request_headers, 1);
1467 ngx_conf_merge_value(conf->upstream.pass_request_body, 1480 ngx_conf_merge_value(conf->upstream.pass_request_body,
1468 prev->upstream.pass_request_body, 1); 1481 prev->upstream.pass_request_body, 1);
1469 1482
1470 ngx_conf_merge_msec_value(conf->upstream.redirect_errors, 1483 ngx_conf_merge_value(conf->upstream.redirect_errors,
1471 prev->upstream.redirect_errors, 0); 1484 prev->upstream.redirect_errors, 0);
1472 1485
1473 ngx_conf_merge_msec_value(conf->upstream.pass_x_powered_by, 1486 ngx_conf_merge_value(conf->upstream.pass_x_powered_by,
1474 prev->upstream.pass_x_powered_by, 1); 1487 prev->upstream.pass_x_powered_by, 1);
1475 ngx_conf_merge_msec_value(conf->upstream.pass_server, 1488 ngx_conf_merge_value(conf->upstream.pass_server,
1476 prev->upstream.pass_server, 0); 1489 prev->upstream.pass_server, 0);
1477 ngx_conf_merge_msec_value(conf->upstream.pass_x_accel_expires, 1490 ngx_conf_merge_value(conf->upstream.pass_x_accel_expires,
1478 prev->upstream.pass_x_accel_expires, 0); 1491 prev->upstream.pass_x_accel_expires, 0);
1479 1492
1480 1493
1481 ngx_conf_merge_value(conf->redirect, prev->redirect, 1); 1494 ngx_conf_merge_value(conf->redirect, prev->redirect, 1);
1482 1495
1506 } 1519 }
1507 1520
1508 1521
1509 if (conf->peers == NULL) { 1522 if (conf->peers == NULL) {
1510 conf->peers = prev->peers; 1523 conf->peers = prev->peers;
1511 conf->upstream = prev->upstream;
1512 } 1524 }
1513 1525
1514 if (conf->headers_source == NULL) { 1526 if (conf->headers_source == NULL) {
1515 conf->headers_source = prev->headers_source; 1527 conf->headers_source = prev->headers_source;
1516 conf->headers_set_len = prev->headers_set_len; 1528 conf->headers_set_len = prev->headers_set_len;