changeset 2119:0799703985ef

fix ranges without Content-Type
author Igor Sysoev <igor@sysoev.ru>
date Wed, 23 Jul 2008 16:30:42 +0000
parents c1f589732d8c
children 2f2052fdd882
files src/http/modules/ngx_http_range_filter_module.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
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
@@ -393,8 +393,6 @@ ngx_http_range_multipart_header(ngx_http
     ngx_http_range_t   *range;
     ngx_atomic_uint_t   boundary;
 
-    /* TODO: what if no content_type ?? */
-
     len = sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN
           + sizeof(CRLF "Content-Type: ") - 1
           + r->headers_out.content_type.len
@@ -431,7 +429,7 @@ ngx_http_range_multipart_header(ngx_http
 
         r->headers_out.charset.len = 0;
 
-    } else {
+    } else if (r->headers_out.content_type.len) {
         ctx->boundary_header.len = ngx_sprintf(ctx->boundary_header.data,
                                            CRLF "--%0muA" CRLF
                                            "Content-Type: %V" CRLF
@@ -439,6 +437,13 @@ ngx_http_range_multipart_header(ngx_http
                                            boundary,
                                            &r->headers_out.content_type)
                                    - ctx->boundary_header.data;
+
+    } else {
+        ctx->boundary_header.len = ngx_sprintf(ctx->boundary_header.data,
+                                           CRLF "--%0muA" CRLF
+                                           "Content-Range: bytes ",
+                                           boundary)
+                                   - ctx->boundary_header.data;
     }
 
     r->headers_out.content_type.data =