[bugfix] Mp4: set single_range when ngx_http_mp4_process() returns NGX_OK.

胡聪 (hucc) hucong.c at foxmail.com
Mon Mar 27 14:56:13 UTC 2017


# HG changeset patch
# User hucongcong <hucong.c at foxmail.com>
# Date 1490618655 -28800
#      Mon Mar 27 20:44:15 2017 +0800
# Node ID 84d73e16113e3fccea9a0156f8edb8e8d0e7499a
# Parent  22be63bf21edaa1b8ea916c7d8cd4e5fe4892061
Mp4: set single_range when ngx_http_mp4_process() returns NGX_OK.

Set single_range flag in reuqest when ngx_http_mp4_process() returns NGX_OK,
because response body is going to be in more than one buffer only in this case.

diff -r 22be63bf21ed -r 84d73e16113e src/http/modules/ngx_http_mp4_module.c
--- a/src/http/modules/ngx_http_mp4_module.c	Fri Mar 24 18:05:06 2017 +0300
+++ b/src/http/modules/ngx_http_mp4_module.c	Mon Mar 27 20:44:15 2017 +0800
@@ -561,8 +561,6 @@ ngx_http_mp4_handler(ngx_http_request_t
     }

     if (start >= 0) {
-        r->single_range = 1;
-
         mp4 = ngx_pcalloc(r->pool, sizeof(ngx_http_mp4_file_t));
         if (mp4 == NULL) {
             return NGX_HTTP_INTERNAL_SERVER_ERROR;
@@ -589,6 +587,7 @@ ngx_http_mp4_handler(ngx_http_request_t
             break;

         case NGX_OK:
+            r->single_range = 1;
             r->headers_out.content_length_n = mp4->content_length;
             break;


More information about the nginx-devel mailing list