Mercurial > hg > nginx
diff src/http/ngx_http_header_filter.c @ 101:2e069b6e6920
nginx-0.0.1-2003-06-04-21:28:33 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 04 Jun 2003 17:28:33 +0000 |
parents | 7ebc8b7fb816 |
children | 152567c11325 |
line wrap: on
line diff
--- a/src/http/ngx_http_header_filter.c +++ b/src/http/ngx_http_header_filter.c @@ -4,6 +4,12 @@ #include <ngx_http.h> #include <nginx.h> +/* STUB probably, needed for ngx_freebsd_tcp_nopush_flush */ +#ifdef __FreeBSD__ +#include <ngx_freebsd_init.h> +#endif + + static int ngx_http_header_filter_init(ngx_pool_t *pool); static int ngx_http_header_filter(ngx_http_request_t *r); @@ -94,6 +100,23 @@ static int ngx_http_header_filter(ngx_ht ngx_chain_t *ch; ngx_table_elt_t *header; +#ifdef __FreeBSD__ + + if (r->keepalive) { + if (ngx_freebsd_tcp_nopush_flush) { + r->connection->tcp_nopush_enabled = 1; + } + + } else { + r->connection->tcp_nopush_enabled = 1; + } + +#else + + r->connection->tcp_nopush_enabled = 1; + +#endif + if (r->http_version < NGX_HTTP_VERSION_10) { return NGX_OK; } @@ -219,12 +242,12 @@ static int ngx_http_header_filter(ngx_ht len += 28; } - if (r->keepalive == 0) { + if (r->keepalive) { + /* "Connection: keep-alive\r\n" */ + len += 24; + } else { /* "Connection: close\r\n" */ len += 19; - } else { - /* "Connection: keep-alive\r\n" */ - len += 24; } header = (ngx_table_elt_t *) r->headers_out.headers->elts; @@ -323,11 +346,11 @@ static int ngx_http_header_filter(ngx_ht h->last = ngx_cpymem(h->last, "Transfer-Encoding: chunked" CRLF, 28); } - if (r->keepalive == 0) { - h->last = ngx_cpymem(h->last, "Connection: close" CRLF, 19); + if (r->keepalive) { + h->last = ngx_cpymem(h->last, "Connection: keep-alive" CRLF, 24); } else { - h->last = ngx_cpymem(h->last, "Connection: keep-alive" CRLF, 24); + h->last = ngx_cpymem(h->last, "Connection: close" CRLF, 19); } for (i = 0; i < r->headers_out.headers->nelts; i++) {