comparison src/os/unix/ngx_writev_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 d0f7a625f27c
children
comparison
equal deleted inserted replaced
671:47cb3497fbab 672:f41d4b305d22
52 if (limit == 0 || limit > (off_t) (NGX_MAX_SIZE_T_VALUE - ngx_pagesize)) { 52 if (limit == 0 || limit > (off_t) (NGX_MAX_SIZE_T_VALUE - ngx_pagesize)) {
53 limit = NGX_MAX_SIZE_T_VALUE - ngx_pagesize; 53 limit = NGX_MAX_SIZE_T_VALUE - ngx_pagesize;
54 } 54 }
55 55
56 send = 0; 56 send = 0;
57 complete = 0;
58 57
59 vec.elts = iovs; 58 vec.elts = iovs;
60 vec.size = sizeof(struct iovec); 59 vec.size = sizeof(struct iovec);
61 vec.nalloc = NGX_IOVS; 60 vec.nalloc = NGX_IOVS;
62 vec.pool = c->pool; 61 vec.pool = c->pool;
63 62
64 for ( ;; ) { 63 for ( ;; ) {
65 prev = NULL; 64 prev = NULL;
66 iov = NULL; 65 iov = NULL;
67 eintr = 0; 66 eintr = 0;
67 complete = 0;
68 prev_send = send; 68 prev_send = send;
69 69
70 vec.nelts = 0; 70 vec.nelts = 0;
71 71
72 /* create the iovec and coalesce the neighbouring bufs */ 72 /* create the iovec and coalesce the neighbouring bufs */
73 73
74 for (cl = in; cl && vec.nelts < IOV_MAX && send < limit; cl = cl->next) 74 for (cl = in; cl && send < limit; cl = cl->next) {
75 { 75
76 if (ngx_buf_special(cl->buf)) { 76 if (ngx_buf_special(cl->buf)) {
77 continue; 77 continue;
78 } 78 }
79 79
80 #if 1 80 #if 1
91 91
92 if (prev == cl->buf->pos) { 92 if (prev == cl->buf->pos) {
93 iov->iov_len += size; 93 iov->iov_len += size;
94 94
95 } else { 95 } else {
96 if (vec.nelts >= IOV_MAX) {
97 break;
98 }
99
96 iov = ngx_array_push(&vec); 100 iov = ngx_array_push(&vec);
97 if (iov == NULL) { 101 if (iov == NULL) {
98 return NGX_CHAIN_ERROR; 102 return NGX_CHAIN_ERROR;
99 } 103 }
100 104