Mercurial > hg > nginx-vendor-current
comparison src/os/unix/ngx_freebsd_sendfile_chain.c @ 672:f41d4b305d22 NGINX_1_2_0
nginx 1.2.0
*) Bugfix: a segmentation fault might occur in a worker process if the
"try_files" directive was used; the bug had appeared in 1.1.19.
*) Bugfix: response might be truncated if there were more than IOV_MAX
buffers used.
*) Bugfix: in the "crop" parameter of the "image_filter" directive.
Thanks to Maxim Bublis.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 23 Apr 2012 00:00:00 +0400 |
parents | ad45b044f1e5 |
children |
comparison
equal
deleted
inserted
replaced
671:47cb3497fbab | 672:f41d4b305d22 |
---|---|
105 /* create the header iovec and coalesce the neighbouring bufs */ | 105 /* create the header iovec and coalesce the neighbouring bufs */ |
106 | 106 |
107 prev = NULL; | 107 prev = NULL; |
108 iov = NULL; | 108 iov = NULL; |
109 | 109 |
110 for (cl = in; | 110 for (cl = in; cl && send < limit; cl = cl->next) { |
111 cl && header.nelts < IOV_MAX && send < limit; | 111 |
112 cl = cl->next) | |
113 { | |
114 if (ngx_buf_special(cl->buf)) { | 112 if (ngx_buf_special(cl->buf)) { |
115 continue; | 113 continue; |
116 } | 114 } |
117 | 115 |
118 if (!ngx_buf_in_memory_only(cl->buf)) { | 116 if (!ngx_buf_in_memory_only(cl->buf)) { |
127 | 125 |
128 if (prev == cl->buf->pos) { | 126 if (prev == cl->buf->pos) { |
129 iov->iov_len += (size_t) size; | 127 iov->iov_len += (size_t) size; |
130 | 128 |
131 } else { | 129 } else { |
130 if (header.nelts >= IOV_MAX){ | |
131 break; | |
132 } | |
133 | |
132 iov = ngx_array_push(&header); | 134 iov = ngx_array_push(&header); |
133 if (iov == NULL) { | 135 if (iov == NULL) { |
134 return NGX_CHAIN_ERROR; | 136 return NGX_CHAIN_ERROR; |
135 } | 137 } |
136 | 138 |
181 /* create the trailer iovec and coalesce the neighbouring bufs */ | 183 /* create the trailer iovec and coalesce the neighbouring bufs */ |
182 | 184 |
183 prev = NULL; | 185 prev = NULL; |
184 iov = NULL; | 186 iov = NULL; |
185 | 187 |
186 while (cl && header.nelts < IOV_MAX && send < limit) { | 188 while (cl && send < limit) { |
187 | 189 |
188 if (ngx_buf_special(cl->buf)) { | 190 if (ngx_buf_special(cl->buf)) { |
189 cl = cl->next; | 191 cl = cl->next; |
190 continue; | 192 continue; |
191 } | 193 } |
202 | 204 |
203 if (prev == cl->buf->pos) { | 205 if (prev == cl->buf->pos) { |
204 iov->iov_len += (size_t) size; | 206 iov->iov_len += (size_t) size; |
205 | 207 |
206 } else { | 208 } else { |
209 if (trailer.nelts >= IOV_MAX){ | |
210 break; | |
211 } | |
212 | |
207 iov = ngx_array_push(&trailer); | 213 iov = ngx_array_push(&trailer); |
208 if (iov == NULL) { | 214 if (iov == NULL) { |
209 return NGX_CHAIN_ERROR; | 215 return NGX_CHAIN_ERROR; |
210 } | 216 } |
211 | 217 |