comparison src/http/modules/ngx_http_range_filter_module.c @ 382:984bb0b1399b NGINX_0_7_3

nginx 0.7.3 *) Change: the "rss" extension MIME type has been changed to "application/rss+xml". *) Change: now the "gzip_vary" directive turned on issues a "Vary: Accept-Encoding" header line for uncompressed responses too. *) Feature: now the "rewrite" directive does a redirect automatically if the "https://" protocol is used. *) Bugfix: the "proxy_pass" directive did not work with the HTTPS protocol; the bug had appeared in 0.6.9.
author Igor Sysoev <http://sysoev.ru>
date Mon, 23 Jun 2008 00:00:00 +0400
parents 05693816539c
children a5f67d82aea3 0b6053502c55
comparison
equal deleted inserted replaced
381:23d1555141d9 382:984bb0b1399b
305 305
306 content_range->hash = 1; 306 content_range->hash = 1;
307 content_range->key.len = sizeof("Content-Range") - 1; 307 content_range->key.len = sizeof("Content-Range") - 1;
308 content_range->key.data = (u_char *) "Content-Range"; 308 content_range->key.data = (u_char *) "Content-Range";
309 309
310 content_range->value.data = ngx_palloc(r->pool, 310 content_range->value.data = ngx_pnalloc(r->pool,
311 sizeof("bytes */") - 1 + NGX_OFF_T_LEN); 311 sizeof("bytes */") - 1 + NGX_OFF_T_LEN);
312 if (content_range->value.data == NULL) { 312 if (content_range->value.data == NULL) {
313 return NGX_ERROR; 313 return NGX_ERROR;
314 } 314 }
315 315
339 content_range->hash = 1; 339 content_range->hash = 1;
340 content_range->key.len = sizeof("Content-Range") - 1; 340 content_range->key.len = sizeof("Content-Range") - 1;
341 content_range->key.data = (u_char *) "Content-Range"; 341 content_range->key.data = (u_char *) "Content-Range";
342 342
343 content_range->value.data = 343 content_range->value.data =
344 ngx_palloc(r->pool, sizeof("bytes -/") - 1 + 3 * NGX_OFF_T_LEN); 344 ngx_pnalloc(r->pool, sizeof("bytes -/") - 1 + 3 * NGX_OFF_T_LEN);
345 if (content_range->value.data == NULL) { 345 if (content_range->value.data == NULL) {
346 return NGX_ERROR; 346 return NGX_ERROR;
347 } 347 }
348 348
349 /* "Content-Range: bytes SSSS-EEEE/TTTT" header */ 349 /* "Content-Range: bytes SSSS-EEEE/TTTT" header */
374 374
375 if (r->headers_out.charset.len) { 375 if (r->headers_out.charset.len) {
376 len += sizeof("; charset=") - 1 + r->headers_out.charset.len; 376 len += sizeof("; charset=") - 1 + r->headers_out.charset.len;
377 } 377 }
378 378
379 ctx->boundary_header.data = ngx_palloc(r->pool, len); 379 ctx->boundary_header.data = ngx_pnalloc(r->pool, len);
380 if (ctx->boundary_header.data == NULL) { 380 if (ctx->boundary_header.data == NULL) {
381 return NGX_ERROR; 381 return NGX_ERROR;
382 } 382 }
383 383
384 boundary = ngx_next_temp_number(0); 384 boundary = ngx_next_temp_number(0);
412 &r->headers_out.content_type) 412 &r->headers_out.content_type)
413 - ctx->boundary_header.data; 413 - ctx->boundary_header.data;
414 } 414 }
415 415
416 r->headers_out.content_type.data = 416 r->headers_out.content_type.data =
417 ngx_palloc(r->pool, 417 ngx_pnalloc(r->pool,
418 sizeof("Content-Type: multipart/byteranges; boundary=") - 1 418 sizeof("Content-Type: multipart/byteranges; boundary=") - 1
419 + NGX_ATOMIC_T_LEN); 419 + NGX_ATOMIC_T_LEN);
420 420
421 if (r->headers_out.content_type.data == NULL) { 421 if (r->headers_out.content_type.data == NULL) {
422 return NGX_ERROR; 422 return NGX_ERROR;
423 } 423 }
424 424
439 for (i = 0; i < ctx->ranges.nelts; i++) { 439 for (i = 0; i < ctx->ranges.nelts; i++) {
440 440
441 /* the size of the range: "SSSS-EEEE/TTTT" CRLF CRLF */ 441 /* the size of the range: "SSSS-EEEE/TTTT" CRLF CRLF */
442 442
443 range[i].content_range.data = 443 range[i].content_range.data =
444 ngx_palloc(r->pool, 3 * NGX_OFF_T_LEN + 2 + 4); 444 ngx_pnalloc(r->pool, 3 * NGX_OFF_T_LEN + 2 + 4);
445 445
446 if (range[i].content_range.data == NULL) { 446 if (range[i].content_range.data == NULL) {
447 return NGX_ERROR; 447 return NGX_ERROR;
448 } 448 }
449 449
647 } 647 }
648 648
649 b->temporary = 1; 649 b->temporary = 1;
650 b->last_buf = 1; 650 b->last_buf = 1;
651 651
652 b->pos = ngx_palloc(r->pool, sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN 652 b->pos = ngx_pnalloc(r->pool, sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN
653 + sizeof("--" CRLF) - 1); 653 + sizeof("--" CRLF) - 1);
654 if (b->pos == NULL) { 654 if (b->pos == NULL) {
655 return NGX_ERROR; 655 return NGX_ERROR;
656 } 656 }
657 657
658 b->last = ngx_cpymem(b->pos, ctx->boundary_header.data, 658 b->last = ngx_cpymem(b->pos, ctx->boundary_header.data,