comparison src/http/modules/ngx_http_chunked_filter.c @ 10:46833bd150cb NGINX_0_1_5

nginx 0.1.5 *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <http://sysoev.ru>
date Thu, 11 Nov 2004 00:00:00 +0300
parents 4b2dafa26fe2
children 8b6db3bda591
comparison
equal deleted inserted replaced
9:77eee314ddbd 10:46833bd150cb
30 NGX_MODULE, 30 NGX_MODULE,
31 &ngx_http_chunked_filter_module_ctx, /* module context */ 31 &ngx_http_chunked_filter_module_ctx, /* module context */
32 NULL, /* module directives */ 32 NULL, /* module directives */
33 NGX_HTTP_MODULE, /* module type */ 33 NGX_HTTP_MODULE, /* module type */
34 ngx_http_chunked_filter_init, /* init module */ 34 ngx_http_chunked_filter_init, /* init module */
35 NULL /* init child */ 35 NULL /* init process */
36 }; 36 };
37 37
38 38
39 static ngx_http_output_header_filter_pt ngx_http_next_header_filter; 39 static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
40 static ngx_http_output_body_filter_pt ngx_http_next_body_filter; 40 static ngx_http_output_body_filter_pt ngx_http_next_body_filter;
82 "http chunk: %d", ngx_buf_size(cl->buf)); 82 "http chunk: %d", ngx_buf_size(cl->buf));
83 83
84 size += ngx_buf_size(cl->buf); 84 size += ngx_buf_size(cl->buf);
85 85
86 if (cl->buf->flush || ngx_buf_in_memory(cl->buf) || cl->buf->in_file) { 86 if (cl->buf->flush || ngx_buf_in_memory(cl->buf) || cl->buf->in_file) {
87 ngx_test_null(tl, ngx_alloc_chain_link(r->pool), NGX_ERROR); 87
88 if (!(tl = ngx_alloc_chain_link(r->pool))) {
89 return NGX_ERROR;
90 }
91
88 tl->buf = cl->buf; 92 tl->buf = cl->buf;
89 *ll = tl; 93 *ll = tl;
90 ll = &tl->next; 94 ll = &tl->next;
91 } 95 }
92 96
100 if (size) { 104 if (size) {
101 if (!(b = ngx_calloc_buf(r->pool))) { 105 if (!(b = ngx_calloc_buf(r->pool))) {
102 return NGX_ERROR; 106 return NGX_ERROR;
103 } 107 }
104 108
105 if (!(chunk = ngx_palloc(r->pool, 11))) { 109 if (!(chunk = ngx_palloc(r->pool, sizeof("00000000" CRLF) - 1))) {
106 return NGX_ERROR; 110 return NGX_ERROR;
107 } 111 }
108 112
109 b->temporary = 1; 113 b->temporary = 1;
110 b->pos = chunk; 114 b->pos = chunk;
111 b->last = ngx_sprintf(chunk, "%uxS" CRLF, size); 115 b->last = ngx_sprintf(chunk, "%xz" CRLF, size);
112 116
113 out.buf = b; 117 out.buf = b;
114 #if 0
115 ngx_test_null(chunk, ngx_palloc(r->pool, 11), NGX_ERROR);
116 len = ngx_snprintf((char *) chunk, 11, SIZE_T_X_FMT CRLF, size);
117
118 ngx_test_null(b, ngx_calloc_buf(r->pool), NGX_ERROR);
119 b->temporary = 1;
120 b->pos = chunk;
121 b->last = chunk + len;
122
123 out.buf = b;
124 #endif
125 } 118 }
126 119
127 if (cl->buf->last_buf) { 120 if (cl->buf->last_buf) {
128 ngx_test_null(b, ngx_calloc_buf(r->pool), NGX_ERROR); 121 if (!(b = ngx_calloc_buf(r->pool))) {
122 return NGX_ERROR;
123 }
124
129 b->memory = 1; 125 b->memory = 1;
130 b->last_buf = 1; 126 b->last_buf = 1;
131 b->pos = (u_char *) CRLF "0" CRLF CRLF; 127 b->pos = (u_char *) CRLF "0" CRLF CRLF;
132 b->last = b->pos + 7; 128 b->last = b->pos + 7;
133 129
145 if (size == 0) { 141 if (size == 0) {
146 *ll = NULL; 142 *ll = NULL;
147 return ngx_http_next_body_filter(r, out.next); 143 return ngx_http_next_body_filter(r, out.next);
148 } 144 }
149 145
150 ngx_test_null(b, ngx_calloc_buf(r->pool), NGX_ERROR); 146 if (!(b = ngx_calloc_buf(r->pool))) {
147 return NGX_ERROR;
148 }
149
151 b->memory = 1; 150 b->memory = 1;
152 b->pos = (u_char *) CRLF; 151 b->pos = (u_char *) CRLF;
153 b->last = b->pos + 2; 152 b->last = b->pos + 2;
154 } 153 }
155 154