Mercurial > hg > nginx
diff src/http/modules/ngx_http_chunked_filter.c @ 343:6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 28 May 2004 15:49:23 +0000 |
parents | 4feff829a849 |
children | 2e3cbc1bbe3c |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_chunked_filter.c Wed May 26 19:33:53 2004 +0000 +++ b/src/http/modules/ngx_http_chunked_filter.c Fri May 28 15:49:23 2004 +0000 @@ -58,14 +58,14 @@ { u_char *chunk; size_t size, len; - ngx_hunk_t *h; + ngx_buf_t *b; ngx_chain_t out, tail, *cl, *tl, **ll; if (in == NULL || !r->chunked) { return ngx_http_next_body_filter(r, in); } - out.hunk = NULL; + out.buf = NULL; ll = &out.next; size = 0; @@ -73,12 +73,12 @@ for ( ;; ) { ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http chunk: %d", ngx_hunk_size(cl->hunk)); + "http chunk: %d", ngx_buf_size(cl->buf)); - size += ngx_hunk_size(cl->hunk); + size += ngx_buf_size(cl->buf); ngx_test_null(tl, ngx_alloc_chain_link(r->pool), NGX_ERROR); - tl->hunk = cl->hunk; + tl->buf = cl->buf; *ll = tl; ll = &tl->next; @@ -93,25 +93,26 @@ ngx_test_null(chunk, ngx_palloc(r->pool, 11), NGX_ERROR); len = ngx_snprintf((char *) chunk, 11, SIZE_T_X_FMT CRLF, size); - ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); - h->type = NGX_HUNK_IN_MEMORY|NGX_HUNK_TEMP; - h->pos = chunk; - h->last = chunk + len; + ngx_test_null(b, ngx_calloc_buf(r->pool), NGX_ERROR); + b->temporary = 1; + b->pos = chunk; + b->last = chunk + len; - out.hunk = h; + out.buf = b; } - if (cl->hunk->type & NGX_HUNK_LAST) { - ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); - h->type = NGX_HUNK_IN_MEMORY|NGX_HUNK_MEMORY|NGX_HUNK_LAST; - h->pos = (u_char *) CRLF "0" CRLF CRLF; - h->last = h->pos + 7; + if (cl->buf->last_buf) { + ngx_test_null(b, ngx_calloc_buf(r->pool), NGX_ERROR); + b->memory = 1; + b->last_buf = 1; + b->pos = (u_char *) CRLF "0" CRLF CRLF; + b->last = b->pos + 7; - cl->hunk->type &= ~NGX_HUNK_LAST; + cl->buf->last_buf = 0; if (size == 0) { - h->pos += 2; - out.hunk = h; + b->pos += 2; + out.buf = b; out.next = NULL; return ngx_http_next_body_filter(r, &out); @@ -123,13 +124,13 @@ return ngx_http_next_body_filter(r, out.next); } - ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); - h->type = NGX_HUNK_IN_MEMORY|NGX_HUNK_MEMORY; - h->pos = (u_char *) CRLF; - h->last = h->pos + 2; + ngx_test_null(b, ngx_calloc_buf(r->pool), NGX_ERROR); + b->memory = 1; + b->pos = (u_char *) CRLF; + b->last = b->pos + 2; } - tail.hunk = h; + tail.buf = b; tail.next = NULL; *ll = &tail;