# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../nginx/nginx_upload_module-range-length-must-equal-to-content-length.diff # Copyright (C) 2012 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- From ccbe8f1729223f0193f79bf8f5d739426170bcfd Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 23 Apr 2011 17:39:33 +0800 Subject: [PATCH 7/8] range length must equal to content length --- ngx_http_upload_module.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/ngx_http_upload_module.c b/ngx_http_upload_module.c index 64c8ca6..9212f57 100644 --- a/ngx_http_upload_module.c +++ b/ngx_http_upload_module.c @@ -3478,6 +3478,14 @@ static ngx_int_t upload_parse_request_headers(ngx_http_upload_ctx_t *upload_ctx, return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE; } + if( (upload_ctx->content_range_n.end - upload_ctx->content_range_n.start + 1) + != headers_in->content_length_n) + { + ngx_log_error(NGX_LOG_ERR, upload_ctx->log, 0, + "range length is not equal to content length"); + return NGX_HTTP_RANGE_NOT_SATISFIABLE; + } + upload_ctx->partial_content = 1; } } -- 1.6.6.2