comparison src/http/modules/ngx_http_range_filter_module.c @ 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 b39c0040b3e4
comparison
equal deleted inserted replaced
2118:c1f589732d8c 2119:0799703985ef
391 size_t len; 391 size_t len;
392 ngx_uint_t i; 392 ngx_uint_t i;
393 ngx_http_range_t *range; 393 ngx_http_range_t *range;
394 ngx_atomic_uint_t boundary; 394 ngx_atomic_uint_t boundary;
395 395
396 /* TODO: what if no content_type ?? */
397
398 len = sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN 396 len = sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN
399 + sizeof(CRLF "Content-Type: ") - 1 397 + sizeof(CRLF "Content-Type: ") - 1
400 + r->headers_out.content_type.len 398 + r->headers_out.content_type.len
401 + sizeof(CRLF "Content-Range: bytes ") - 1; 399 + sizeof(CRLF "Content-Range: bytes ") - 1;
402 400
429 &r->headers_out.charset) 427 &r->headers_out.charset)
430 - ctx->boundary_header.data; 428 - ctx->boundary_header.data;
431 429
432 r->headers_out.charset.len = 0; 430 r->headers_out.charset.len = 0;
433 431
434 } else { 432 } else if (r->headers_out.content_type.len) {
435 ctx->boundary_header.len = ngx_sprintf(ctx->boundary_header.data, 433 ctx->boundary_header.len = ngx_sprintf(ctx->boundary_header.data,
436 CRLF "--%0muA" CRLF 434 CRLF "--%0muA" CRLF
437 "Content-Type: %V" CRLF 435 "Content-Type: %V" CRLF
438 "Content-Range: bytes ", 436 "Content-Range: bytes ",
439 boundary, 437 boundary,
440 &r->headers_out.content_type) 438 &r->headers_out.content_type)
441 - ctx->boundary_header.data; 439 - ctx->boundary_header.data;
440
441 } else {
442 ctx->boundary_header.len = ngx_sprintf(ctx->boundary_header.data,
443 CRLF "--%0muA" CRLF
444 "Content-Range: bytes ",
445 boundary)
446 - ctx->boundary_header.data;
442 } 447 }
443 448
444 r->headers_out.content_type.data = 449 r->headers_out.content_type.data =
445 ngx_pnalloc(r->pool, 450 ngx_pnalloc(r->pool,
446 sizeof("Content-Type: multipart/byteranges; boundary=") - 1 451 sizeof("Content-Type: multipart/byteranges; boundary=") - 1