comparison src/http/modules/ngx_http_chunked_filter.c @ 4:4b2dafa26fe2 NGINX_0_1_2

nginx 0.1.2 *) Feature: the --user=USER, --group=GROUP, and --with-ld-opt=OPTIONS options in configure. *) Feature: the server_name directive supports *.domain.tld. *) Bugfix: the portability improvements. *) Bugfix: if configuration file was set in command line, the reconfiguration was impossible; bug appeared in 0.1.1. *) Bugfix: proxy module may get caught in an endless loop when sendfile is not used. *) Bugfix: with sendfile the response was not recoded according to the charset module directives; bug appeared in 0.1.1. *) Bugfix: very seldom bug in the kqueue processing. *) Bugfix: the gzip module compressed the proxied responses that was already compressed.
author Igor Sysoev <http://sysoev.ru>
date Thu, 21 Oct 2004 00:00:00 +0400
parents cc9f381affaa
children 46833bd150cb
comparison
equal deleted inserted replaced
3:8beaf7b3241f 4:4b2dafa26fe2
61 61
62 static ngx_int_t ngx_http_chunked_body_filter(ngx_http_request_t *r, 62 static ngx_int_t ngx_http_chunked_body_filter(ngx_http_request_t *r,
63 ngx_chain_t *in) 63 ngx_chain_t *in)
64 { 64 {
65 u_char *chunk; 65 u_char *chunk;
66 size_t size, len; 66 size_t size;
67 ngx_buf_t *b; 67 ngx_buf_t *b;
68 ngx_chain_t out, tail, *cl, *tl, **ll; 68 ngx_chain_t out, tail, *cl, *tl, **ll;
69 69
70 if (in == NULL || !r->chunked) { 70 if (in == NULL || !r->chunked) {
71 return ngx_http_next_body_filter(r, in); 71 return ngx_http_next_body_filter(r, in);
96 96
97 cl = cl->next; 97 cl = cl->next;
98 } 98 }
99 99
100 if (size) { 100 if (size) {
101 if (!(b = ngx_calloc_buf(r->pool))) {
102 return NGX_ERROR;
103 }
104
105 if (!(chunk = ngx_palloc(r->pool, 11))) {
106 return NGX_ERROR;
107 }
108
109 b->temporary = 1;
110 b->pos = chunk;
111 b->last = ngx_sprintf(chunk, "%uxS" CRLF, size);
112
113 out.buf = b;
114 #if 0
101 ngx_test_null(chunk, ngx_palloc(r->pool, 11), NGX_ERROR); 115 ngx_test_null(chunk, ngx_palloc(r->pool, 11), NGX_ERROR);
102 len = ngx_snprintf((char *) chunk, 11, SIZE_T_X_FMT CRLF, size); 116 len = ngx_snprintf((char *) chunk, 11, SIZE_T_X_FMT CRLF, size);
103 117
104 ngx_test_null(b, ngx_calloc_buf(r->pool), NGX_ERROR); 118 ngx_test_null(b, ngx_calloc_buf(r->pool), NGX_ERROR);
105 b->temporary = 1; 119 b->temporary = 1;
106 b->pos = chunk; 120 b->pos = chunk;
107 b->last = chunk + len; 121 b->last = chunk + len;
108 122
109 out.buf = b; 123 out.buf = b;
124 #endif
110 } 125 }
111 126
112 if (cl->buf->last_buf) { 127 if (cl->buf->last_buf) {
113 ngx_test_null(b, ngx_calloc_buf(r->pool), NGX_ERROR); 128 ngx_test_null(b, ngx_calloc_buf(r->pool), NGX_ERROR);
114 b->memory = 1; 129 b->memory = 1;