comparison src/os/unix/ngx_freebsd_sendfile_chain.c @ 50:72eb30262aac NGINX_0_1_25

nginx 0.1.25 *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 19 Mar 2005 00:00:00 +0300
parents da8c190bdaba
children 962c43960644
comparison
equal deleted inserted replaced
49:93dabbc9efb9 50:72eb30262aac
19 * 19 *
20 * Threfore we use the TCP_NOPUSH option (similar to Linux's TCP_CORK) 20 * Threfore we use the TCP_NOPUSH option (similar to Linux's TCP_CORK)
21 * to postpone the sending - it not only sends a header and the first part of 21 * to postpone the sending - it not only sends a header and the first part of
22 * the file in one packet, but also sends the file pages in the full packets. 22 * the file in one packet, but also sends the file pages in the full packets.
23 * 23 *
24 * But until FreeBSD 4.5 the turning TCP_NOPUSH off does not flush a pending 24 * But until FreeBSD 4.5 turning TCP_NOPUSH off does not flush a pending
25 * data that less than MSS so that data may be sent with 5 second delay. 25 * data that less than MSS, so that data may be sent with 5 second delay.
26 * So we do not use TCP_NOPUSH on FreeBSD prior to 4.5 although it can be used 26 * So we do not use TCP_NOPUSH on FreeBSD prior to 4.5, although it can be used
27 * for non-keepalive HTTP connections. 27 * for non-keepalive HTTP connections.
28 */ 28 */
29 29
30 30
31 #define NGX_HEADERS 8 31 #define NGX_HEADERS 8
32 #define NGX_TRAILERS 4 32 #define NGX_TRAILERS 8
33 33
34 34
35 ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, 35 ngx_chain_t *
36 off_t limit) 36 ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
37 { 37 {
38 int rc; 38 int rc;
39 u_char *prev; 39 u_char *prev;
40 off_t size, send, prev_send, aligned, sent, fprev; 40 off_t size, send, prev_send, aligned, sent, fprev;
41 size_t header_size, file_size; 41 size_t header_size, file_size;
121 121
122 if (prev == cl->buf->pos) { 122 if (prev == cl->buf->pos) {
123 iov->iov_len += (size_t) size; 123 iov->iov_len += (size_t) size;
124 124
125 } else { 125 } else {
126 if (!(iov = ngx_array_push(&header))) { 126 iov = ngx_array_push(&header);
127 if (iov == NULL) {
127 return NGX_CHAIN_ERROR; 128 return NGX_CHAIN_ERROR;
128 } 129 }
129 130
130 iov->iov_base = (void *) cl->buf->pos; 131 iov->iov_base = (void *) cl->buf->pos;
131 iov->iov_len = (size_t) size; 132 iov->iov_len = (size_t) size;
195 196
196 if (prev == cl->buf->pos) { 197 if (prev == cl->buf->pos) {
197 iov->iov_len += (size_t) size; 198 iov->iov_len += (size_t) size;
198 199
199 } else { 200 } else {
200 if (!(iov = ngx_array_push(&trailer))) { 201 iov = ngx_array_push(&trailer);
202 if (iov == NULL) {
201 return NGX_CHAIN_ERROR; 203 return NGX_CHAIN_ERROR;
202 } 204 }
203 205
204 iov->iov_base = (void *) cl->buf->pos; 206 iov->iov_base = (void *) cl->buf->pos;
205 iov->iov_len = (size_t) size; 207 iov->iov_len = (size_t) size;