comparison src/http/ngx_http_upstream.c @ 2704:ac1e2e199c9f

shutdown client connection for cacheable header only responses
author Igor Sysoev <igor@sysoev.ru>
date Wed, 15 Apr 2009 11:19:27 +0000
parents 3b6afa999c2f
children 4c658be4ab63
comparison
equal deleted inserted replaced
2703:3b6afa999c2f 2704:ac1e2e199c9f
1828 if (rc == NGX_ERROR || rc > NGX_OK || r->post_action) { 1828 if (rc == NGX_ERROR || rc > NGX_OK || r->post_action) {
1829 ngx_http_upstream_finalize_request(r, u, rc); 1829 ngx_http_upstream_finalize_request(r, u, rc);
1830 return; 1830 return;
1831 } 1831 }
1832 1832
1833 c = r->connection;
1834
1833 if (r->header_only) { 1835 if (r->header_only) {
1836
1834 if (u->cacheable || u->store) { 1837 if (u->cacheable || u->store) {
1838
1839 if (ngx_shutdown_socket(c->fd, NGX_WRITE_SHUTDOWN) == -1) {
1840 ngx_connection_error(c, ngx_socket_errno,
1841 ngx_shutdown_socket_n " failed");
1842 }
1843
1835 r->read_event_handler = ngx_http_request_empty_handler; 1844 r->read_event_handler = ngx_http_request_empty_handler;
1836 r->write_event_handler = ngx_http_request_empty_handler; 1845 r->write_event_handler = ngx_http_request_empty_handler;
1837 r->connection->error = 1; 1846 c->error = 1;
1838 1847
1839 } else { 1848 } else {
1840 ngx_http_upstream_finalize_request(r, u, rc); 1849 ngx_http_upstream_finalize_request(r, u, rc);
1841 return; 1850 return;
1842 } 1851 }
1846 1855
1847 if (r->request_body && r->request_body->temp_file) { 1856 if (r->request_body && r->request_body->temp_file) {
1848 ngx_pool_run_cleanup_file(r->pool, r->request_body->temp_file->file.fd); 1857 ngx_pool_run_cleanup_file(r->pool, r->request_body->temp_file->file.fd);
1849 r->request_body->temp_file->file.fd = NGX_INVALID_FILE; 1858 r->request_body->temp_file->file.fd = NGX_INVALID_FILE;
1850 } 1859 }
1851
1852 c = r->connection;
1853 1860
1854 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 1861 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1855 1862
1856 if (!u->buffering) { 1863 if (!u->buffering) {
1857 1864