comparison src/http/modules/ngx_http_range_filter_module.c @ 662:e5fa0a4a7d27 NGINX_1_1_15

nginx 1.1.15 *) Feature: the "disable_symlinks" directive. *) Feature: the "proxy_cookie_domain" and "proxy_cookie_path" directives. *) Bugfix: nginx might log incorrect error "upstream prematurely closed connection" instead of correct "upstream sent too big header" one. Thanks to Feibo Li. *) Bugfix: nginx could not be built with the ngx_http_perl_module if the --with-openssl option was used. *) Bugfix: internal redirects to named locations were not limited. *) Bugfix: calling $r->flush() multiple times might cause errors in the ngx_http_gzip_filter_module. *) Bugfix: temporary files might be not removed if the "proxy_store" directive were used with SSI includes. *) Bugfix: in some cases non-cacheable variables (such as the $args variable) returned old empty cached value. *) Bugfix: a segmentation fault might occur in a worker process if too many SSI subrequests were issued simultaneously; the bug had appeared in 0.7.25.
author Igor Sysoev <http://sysoev.ru>
date Wed, 15 Feb 2012 00:00:00 +0400
parents d0f7a625f27c
children 597573166f34
comparison
equal deleted inserted replaced
661:b49c1751031c 662:e5fa0a4a7d27
593 } 593 }
594 594
595 buf = in->buf; 595 buf = in->buf;
596 596
597 if (!buf->last_buf) { 597 if (!buf->last_buf) {
598 598 start = ctx->offset;
599 if (buf->in_file) { 599 last = ctx->offset + ngx_buf_size(buf);
600 start = buf->file_pos + ctx->offset;
601 last = buf->file_last + ctx->offset;
602
603 } else {
604 start = buf->pos - buf->start + ctx->offset;
605 last = buf->last - buf->start + ctx->offset;
606 }
607 600
608 range = ctx->ranges.elts; 601 range = ctx->ranges.elts;
609 for (i = 0; i < ctx->ranges.nelts; i++) { 602 for (i = 0; i < ctx->ranges.nelts; i++) {
610 if (start > range[i].start || last < range[i].end) { 603 if (start > range[i].start || last < range[i].end) {
611 goto overlapped; 604 goto overlapped;
714 707
715 static ngx_int_t 708 static ngx_int_t
716 ngx_http_range_multipart_body(ngx_http_request_t *r, 709 ngx_http_range_multipart_body(ngx_http_request_t *r,
717 ngx_http_range_filter_ctx_t *ctx, ngx_chain_t *in) 710 ngx_http_range_filter_ctx_t *ctx, ngx_chain_t *in)
718 { 711 {
719 off_t body_start;
720 ngx_buf_t *b, *buf; 712 ngx_buf_t *b, *buf;
721 ngx_uint_t i; 713 ngx_uint_t i;
722 ngx_chain_t *out, *hcl, *rcl, *dcl, **ll; 714 ngx_chain_t *out, *hcl, *rcl, *dcl, **ll;
723 ngx_http_range_t *range; 715 ngx_http_range_t *range;
724 716
725 ll = &out; 717 ll = &out;
726 buf = in->buf; 718 buf = in->buf;
727 range = ctx->ranges.elts; 719 range = ctx->ranges.elts;
728
729 #if (NGX_HTTP_CACHE)
730 body_start = r->cached ? r->cache->body_start : 0;
731 #else
732 body_start = 0;
733 #endif
734 720
735 for (i = 0; i < ctx->ranges.nelts; i++) { 721 for (i = 0; i < ctx->ranges.nelts; i++) {
736 722
737 /* 723 /*
738 * The boundary header of the range: 724 * The boundary header of the range:
790 b->memory = buf->memory; 776 b->memory = buf->memory;
791 b->mmap = buf->mmap; 777 b->mmap = buf->mmap;
792 b->file = buf->file; 778 b->file = buf->file;
793 779
794 if (buf->in_file) { 780 if (buf->in_file) {
795 b->file_pos = body_start + range[i].start; 781 b->file_pos = buf->file_pos + range[i].start;
796 b->file_last = body_start + range[i].end; 782 b->file_last = buf->file_pos + range[i].end;
797 } 783 }
798 784
799 if (ngx_buf_in_memory(buf)) { 785 if (ngx_buf_in_memory(buf)) {
800 b->pos = buf->start + (size_t) range[i].start; 786 b->pos = buf->pos + (size_t) range[i].start;
801 b->last = buf->start + (size_t) range[i].end; 787 b->last = buf->pos + (size_t) range[i].end;
802 } 788 }
803 789
804 dcl = ngx_alloc_chain_link(r->pool); 790 dcl = ngx_alloc_chain_link(r->pool);
805 if (dcl == NULL) { 791 if (dcl == NULL) {
806 return NGX_ERROR; 792 return NGX_ERROR;