comparison src/http/ngx_http_request.c @ 74:77969b24f355 NGINX_0_1_37

nginx 0.1.37 *) Change: now the "\n" is added to the end of the "nginx.pid" file. *) Bugfix: the responses may be transferred not completely, if many parts or the big parts were included by SSI. *) Bugfix: if all backends had returned the 404 reponse and the "http_404" parameter of the "proxy_next_upstream" or "fastcgi_next_upstream" directives was used, then nginx started to request all backends again.
author Igor Sysoev <http://sysoev.ru>
date Thu, 23 Jun 2005 00:00:00 +0400
parents b31656313b59
children da9a3b14312d
comparison
equal deleted inserted replaced
73:05310cdbd906 74:77969b24f355
29 29
30 static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r); 30 static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r);
31 static ngx_int_t ngx_http_find_virtual_server(ngx_http_request_t *r); 31 static ngx_int_t ngx_http_find_virtual_server(ngx_http_request_t *r);
32 32
33 static void ngx_http_request_handler(ngx_event_t *ev); 33 static void ngx_http_request_handler(ngx_event_t *ev);
34 static void ngx_http_set_write_handler(ngx_http_request_t *r); 34 static ngx_int_t ngx_http_set_write_handler(ngx_http_request_t *r);
35 static void ngx_http_writer(ngx_http_request_t *r); 35 static void ngx_http_writer(ngx_http_request_t *r);
36 static ngx_int_t ngx_http_postponed_handler(ngx_http_request_t *r); 36 static ngx_int_t ngx_http_postponed_handler(ngx_http_request_t *r);
37 37
38 static void ngx_http_block_read(ngx_http_request_t *r); 38 static void ngx_http_block_read(ngx_http_request_t *r);
39 static void ngx_http_read_discarded_body_handler(ngx_http_request_t *r); 39 static void ngx_http_read_discarded_body_handler(ngx_http_request_t *r);
1431 ngx_http_finalize_request(r, ngx_http_special_response_handler(r, rc)); 1431 ngx_http_finalize_request(r, ngx_http_special_response_handler(r, rc));
1432 return; 1432 return;
1433 } 1433 }
1434 1434
1435 if (r->parent || rc == NGX_AGAIN) { 1435 if (r->parent || rc == NGX_AGAIN) {
1436 r->write_event_handler = ngx_http_writer; 1436 if (ngx_http_set_write_handler(r) != NGX_OK) {
1437 return;
1438 }
1437 } 1439 }
1438 1440
1439 r->done = 1; 1441 r->done = 1;
1440 1442
1441 if (r != r->connection->data) { 1443 if (r != r->connection->data) {
1495 ngx_http_close_request(r, 0); 1497 ngx_http_close_request(r, 0);
1496 ngx_http_close_connection(r->connection); 1498 ngx_http_close_connection(r->connection);
1497 return; 1499 return;
1498 1500
1499 } else if (rc == NGX_AGAIN || r->out) { 1501 } else if (rc == NGX_AGAIN || r->out) {
1500 ngx_http_set_write_handler(r); 1502 (void) ngx_http_set_write_handler(r);
1501 return; 1503 return;
1502 } 1504 }
1503 1505
1504 if (r->connection->read->timer_set) { 1506 if (r->connection->read->timer_set) {
1505 ngx_del_timer(r->connection->read); 1507 ngx_del_timer(r->connection->read);
1539 ngx_http_close_request(r, 0); 1541 ngx_http_close_request(r, 0);
1540 ngx_http_close_connection(r->connection); 1542 ngx_http_close_connection(r->connection);
1541 } 1543 }
1542 1544
1543 1545
1544 static void 1546 static ngx_int_t
1545 ngx_http_set_write_handler(ngx_http_request_t *r) 1547 ngx_http_set_write_handler(ngx_http_request_t *r)
1546 { 1548 {
1547 ngx_event_t *wev; 1549 ngx_event_t *wev;
1548 ngx_http_core_loc_conf_t *clcf; 1550 ngx_http_core_loc_conf_t *clcf;
1549 1551
1550 r->http_state = NGX_HTTP_WRITING_REQUEST_STATE; 1552 r->http_state = NGX_HTTP_WRITING_REQUEST_STATE;
1551 1553
1554 r->write_event_handler = ngx_http_writer;
1555
1552 wev = r->connection->write; 1556 wev = r->connection->write;
1553 1557
1554 if (wev->ready && wev->delayed) { 1558 if (wev->ready && wev->delayed) {
1555 return; 1559 return NGX_OK;
1556 } 1560 }
1557 1561
1558 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 1562 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1559 if (!wev->delayed) { 1563 if (!wev->delayed) {
1560 ngx_add_timer(wev, clcf->send_timeout); 1564 ngx_add_timer(wev, clcf->send_timeout);
1561 } 1565 }
1562 1566
1563 if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) { 1567 if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
1564 ngx_http_close_request(r, 0); 1568 ngx_http_close_request(r, 0);
1565 ngx_http_close_connection(r->connection); 1569 ngx_http_close_connection(r->connection);
1566 } 1570 return NGX_ERROR;
1571 }
1572
1573 return NGX_OK;
1567 } 1574 }
1568 1575
1569 1576
1570 static void 1577 static void
1571 ngx_http_writer(ngx_http_request_t *r) 1578 ngx_http_writer(ngx_http_request_t *r)