]> git.kaiwu.me - nginx.git/commitdiff
fix ranges without Content-Type
authorIgor Sysoev <igor@sysoev.ru>
Wed, 23 Jul 2008 16:30:42 +0000 (16:30 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Wed, 23 Jul 2008 16:30:42 +0000 (16:30 +0000)
src/http/modules/ngx_http_range_filter_module.c

index 8f5ff797671093fa8d8f97aef854560b9a12abfa..e8134d16490e35270f96d23ab171b25695abfb27 100644 (file)
@@ -393,8 +393,6 @@ ngx_http_range_multipart_header(ngx_http_request_t *r,
     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_request_t *r,
 
         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_request_t *r,
                                            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 =