comparison src/http/ngx_http_request.c @ 452:23fb87bddda1 release-0.1.1

nginx-0.1.1-RELEASE import *) Feature: the gzip_types directive. *) Feature: the tcp_nodelay directive. *) Feature: the send_lowat directive is working not only on OSes that support kqueue NOTE_LOWAT, but also on OSes that support SO_SNDLOWAT. *) Feature: the setproctitle() emulation for Linux and Solaris. *) Bugfix: the "Location" header rewrite bug fixed while the proxying. *) Bugfix: the ngx_http_chunked_module module may get caught in an endless loop. *) Bugfix: the /dev/poll module bugs fixed. *) Bugfix: the responses were corrupted when the temporary files were used while the proxying. *) Bugfix: the unescaped requests were passed to the backend. *) Bugfix: while the build configuration on Linux 2.4 the --with-poll_module parameter was required.
author Igor Sysoev <igor@sysoev.ru>
date Mon, 11 Oct 2004 15:07:03 +0000
parents 3b1e8c9df9ad
children 295d97d70c69
comparison
equal deleted inserted replaced
451:f40362e47689 452:23fb87bddda1
548 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 548 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
549 ngx_http_close_connection(c); 549 ngx_http_close_connection(c);
550 return; 550 return;
551 } 551 }
552 552
553 if (r->complex_uri) { 553 if (r->complex_uri || r->quoted_uri) {
554 rc = ngx_http_parse_complex_uri(r); 554 rc = ngx_http_parse_complex_uri(r);
555 555
556 if (rc == NGX_HTTP_INTERNAL_SERVER_ERROR) { 556 if (rc == NGX_HTTP_INTERNAL_SERVER_ERROR) {
557 ngx_http_close_request(r, rc); 557 ngx_http_close_request(r, rc);
558 ngx_http_close_connection(c); 558 ngx_http_close_connection(c);
1316 ngx_http_core_module); 1316 ngx_http_core_module);
1317 if (!wev->delayed) { 1317 if (!wev->delayed) {
1318 ngx_add_timer(wev, clcf->send_timeout); 1318 ngx_add_timer(wev, clcf->send_timeout);
1319 } 1319 }
1320 1320
1321 wev->available = clcf->send_lowat; 1321 if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
1322 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) {
1323 ngx_http_close_request(r, 0); 1322 ngx_http_close_request(r, 0);
1324 ngx_http_close_connection(r->connection); 1323 ngx_http_close_connection(r->connection);
1325 } 1324 }
1326 1325
1327 return; 1326 return;
1352 if (!wev->ready) { 1351 if (!wev->ready) {
1353 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r, 1352 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
1354 ngx_http_core_module); 1353 ngx_http_core_module);
1355 ngx_add_timer(wev, clcf->send_timeout); 1354 ngx_add_timer(wev, clcf->send_timeout);
1356 1355
1357 wev->available = clcf->send_lowat; 1356 if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
1358
1359 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) {
1360 ngx_http_close_request(r, 0); 1357 ngx_http_close_request(r, 0);
1361 ngx_http_close_connection(r->connection); 1358 ngx_http_close_connection(r->connection);
1362 } 1359 }
1363 1360
1364 return; 1361 return;
1369 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0, 1366 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0,
1370 "http writer delayed"); 1367 "http writer delayed");
1371 1368
1372 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r, 1369 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
1373 ngx_http_core_module); 1370 ngx_http_core_module);
1374 wev->available = clcf->send_lowat; 1371
1375 1372 if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
1376 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) {
1377 ngx_http_close_request(r, 0); 1373 ngx_http_close_request(r, 0);
1378 ngx_http_close_connection(r->connection); 1374 ngx_http_close_connection(r->connection);
1379 } 1375 }
1380 1376
1381 return; 1377 return;
1392 ngx_http_core_module); 1388 ngx_http_core_module);
1393 if (!wev->ready && !wev->delayed) { 1389 if (!wev->ready && !wev->delayed) {
1394 ngx_add_timer(wev, clcf->send_timeout); 1390 ngx_add_timer(wev, clcf->send_timeout);
1395 } 1391 }
1396 1392
1397 wev->available = clcf->send_lowat; 1393 if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
1398
1399 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) {
1400 ngx_http_close_request(r, 0); 1394 ngx_http_close_request(r, 0);
1401 ngx_http_close_connection(r->connection); 1395 ngx_http_close_connection(r->connection);
1402 } 1396 }
1403 1397
1404 return; 1398 return;
1539 } 1533 }
1540 1534
1541 1535
1542 static void ngx_http_set_keepalive(ngx_http_request_t *r) 1536 static void ngx_http_set_keepalive(ngx_http_request_t *r)
1543 { 1537 {
1538 int tcp_nodelay;
1544 ngx_int_t i; 1539 ngx_int_t i;
1545 ngx_buf_t *b, *f; 1540 ngx_buf_t *b, *f;
1546 ngx_event_t *rev, *wev; 1541 ngx_event_t *rev, *wev;
1547 ngx_connection_t *c; 1542 ngx_connection_t *c;
1548 ngx_http_connection_t *hc; 1543 ngx_http_connection_t *hc;
1682 if (ngx_tcp_push(c->fd) == NGX_ERROR) { 1677 if (ngx_tcp_push(c->fd) == NGX_ERROR) {
1683 ngx_connection_error(c, ngx_socket_errno, ngx_tcp_push_n " failed"); 1678 ngx_connection_error(c, ngx_socket_errno, ngx_tcp_push_n " failed");
1684 ngx_http_close_connection(c); 1679 ngx_http_close_connection(c);
1685 return; 1680 return;
1686 } 1681 }
1682
1687 c->tcp_nopush = NGX_TCP_NOPUSH_UNSET; 1683 c->tcp_nopush = NGX_TCP_NOPUSH_UNSET;
1684
1685 } else {
1686 if (clcf->tcp_nodelay && !c->tcp_nodelay) {
1687 tcp_nodelay = 1;
1688
1689 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "tcp_nodelay");
1690
1691 if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY,
1692 (const void *) &tcp_nodelay, sizeof(int)) == -1)
1693 {
1694 ngx_connection_error(c, ngx_socket_errno,
1695 "setsockopt(TCP_NODELAY) failed");
1696 ngx_http_close_connection(c);
1697 return;
1698 }
1699
1700 c->tcp_nodelay = 1;
1701 }
1688 } 1702 }
1689 1703
1690 #if 0 1704 #if 0
1691 /* if "keepalive_buffers off" then we need some other place */ 1705 /* if "keepalive_buffers off" then we need some other place */
1692 r->http_state = NGX_HTTP_KEEPALIVE_STATE; 1706 r->http_state = NGX_HTTP_KEEPALIVE_STATE;
2053 void ngx_http_close_connection(ngx_connection_t *c) 2067 void ngx_http_close_connection(ngx_connection_t *c)
2054 { 2068 {
2055 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 2069 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
2056 "close http connection: %d", c->fd); 2070 "close http connection: %d", c->fd);
2057 2071
2072 #if (NGX_OPENSSL)
2073
2074 if (c->ssl) {
2075 if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
2076 c->read->event_handler = ngx_ssl_close_handler;
2077 c->write->event_handler = ngx_ssl_close_handler;
2078 return;
2079 }
2080 }
2081
2082 #endif
2083
2058 #if (NGX_STAT_STUB) 2084 #if (NGX_STAT_STUB)
2059 (*ngx_stat_active)--; 2085 (*ngx_stat_active)--;
2060 #endif 2086 #endif
2061 2087
2062 ngx_close_connection(c); 2088 ngx_close_connection(c);