comparison src/http/modules/ngx_http_range_filter_module.c @ 464:c8cfb6c462ef NGINX_0_7_44

nginx 0.7.44 *) Feature: the ngx_http_proxy_module preliminary cache support. *) Feature: the --with-pcre option in the configure. *) Feature: the "try_files" directive is now allowed on the server block level. *) Bugfix: the "try_files" directive handled incorrectly a query string in a fallback parameter. *) Bugfix: the "try_files" directive might test incorrectly directories. *) Bugfix: if there is the single server for given address:port pair, then captures in regular expressions in a "server_name" directive did not work.
author Igor Sysoev <http://sysoev.ru>
date Mon, 23 Mar 2009 00:00:00 +0300
parents a8424ffa495c
children 499474178a11
comparison
equal deleted inserted replaced
463:51cb914e6d3a 464:c8cfb6c462ef
197 if (rc == NGX_OK) { 197 if (rc == NGX_OK) {
198 198
199 ngx_http_set_ctx(r, ctx, ngx_http_range_body_filter_module); 199 ngx_http_set_ctx(r, ctx, ngx_http_range_body_filter_module);
200 200
201 r->headers_out.status = NGX_HTTP_PARTIAL_CONTENT; 201 r->headers_out.status = NGX_HTTP_PARTIAL_CONTENT;
202 r->headers_out.status_line.len = 0;
202 203
203 if (ctx->ranges.nelts == 1) { 204 if (ctx->ranges.nelts == 1) {
204 return ngx_http_range_singlepart_header(r, ctx); 205 return ngx_http_range_singlepart_header(r, ctx);
205 } 206 }
206 207
706 707
707 static ngx_int_t 708 static ngx_int_t
708 ngx_http_range_multipart_body(ngx_http_request_t *r, 709 ngx_http_range_multipart_body(ngx_http_request_t *r,
709 ngx_http_range_filter_ctx_t *ctx, ngx_chain_t *in) 710 ngx_http_range_filter_ctx_t *ctx, ngx_chain_t *in)
710 { 711 {
712 off_t body_start;
711 ngx_buf_t *b, *buf; 713 ngx_buf_t *b, *buf;
712 ngx_uint_t i; 714 ngx_uint_t i;
713 ngx_chain_t *out, *hcl, *rcl, *dcl, **ll; 715 ngx_chain_t *out, *hcl, *rcl, *dcl, **ll;
714 ngx_http_range_t *range; 716 ngx_http_range_t *range;
715 717
716 ll = &out; 718 ll = &out;
717 buf = in->buf; 719 buf = in->buf;
718 range = ctx->ranges.elts; 720 range = ctx->ranges.elts;
721
722 #if (NGX_HTTP_CACHE)
723 body_start = r->cached ? r->cache->body_start : 0;
724 #else
725 body_start = 0;
726 #endif
719 727
720 for (i = 0; i < ctx->ranges.nelts; i++) { 728 for (i = 0; i < ctx->ranges.nelts; i++) {
721 729
722 /* 730 /*
723 * The boundary header of the range: 731 * The boundary header of the range:
775 b->memory = buf->memory; 783 b->memory = buf->memory;
776 b->mmap = buf->mmap; 784 b->mmap = buf->mmap;
777 b->file = buf->file; 785 b->file = buf->file;
778 786
779 if (buf->in_file) { 787 if (buf->in_file) {
780 b->file_pos = range[i].start; 788 b->file_pos = body_start + range[i].start;
781 b->file_last = range[i].end; 789 b->file_last = body_start + range[i].end;
782 } 790 }
783 791
784 if (ngx_buf_in_memory(buf)) { 792 if (ngx_buf_in_memory(buf)) {
785 b->pos = buf->start + (size_t) range[i].start; 793 b->pos = buf->start + (size_t) range[i].start;
786 b->last = buf->start + (size_t) range[i].end; 794 b->last = buf->start + (size_t) range[i].end;