Mercurial > hg > nginx
diff src/http/modules/ngx_http_range_filter_module.c @ 2592:3a8a53c0c42f
a prelimiary proxy cache support
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 23 Mar 2009 13:14:51 +0000 |
parents | a6d6d762c554 |
children | 896db5a09bd2 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_range_filter_module.c +++ b/src/http/modules/ngx_http_range_filter_module.c @@ -199,6 +199,7 @@ ngx_http_range_header_filter(ngx_http_re ngx_http_set_ctx(r, ctx, ngx_http_range_body_filter_module); r->headers_out.status = NGX_HTTP_PARTIAL_CONTENT; + r->headers_out.status_line.len = 0; if (ctx->ranges.nelts == 1) { return ngx_http_range_singlepart_header(r, ctx); @@ -708,6 +709,7 @@ static ngx_int_t ngx_http_range_multipart_body(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx, ngx_chain_t *in) { + off_t body_start; ngx_buf_t *b, *buf; ngx_uint_t i; ngx_chain_t *out, *hcl, *rcl, *dcl, **ll; @@ -717,6 +719,12 @@ ngx_http_range_multipart_body(ngx_http_r buf = in->buf; range = ctx->ranges.elts; +#if (NGX_HTTP_CACHE) + body_start = r->cached ? r->cache->body_start : 0; +#else + body_start = 0; +#endif + for (i = 0; i < ctx->ranges.nelts; i++) { /* @@ -777,8 +785,8 @@ ngx_http_range_multipart_body(ngx_http_r b->file = buf->file; if (buf->in_file) { - b->file_pos = range[i].start; - b->file_last = range[i].end; + b->file_pos = body_start + range[i].start; + b->file_last = body_start + range[i].end; } if (ngx_buf_in_memory(buf)) {