Mercurial > hg > nginx-vendor-0-5
comparison src/http/modules/ngx_http_range_filter.c @ 4:4b2dafa26fe2 NGINX_0_1_2
nginx 0.1.2
*) Feature: the --user=USER, --group=GROUP, and --with-ld-opt=OPTIONS
options in configure.
*) Feature: the server_name directive supports *.domain.tld.
*) Bugfix: the portability improvements.
*) Bugfix: if configuration file was set in command line, the
reconfiguration was impossible; bug appeared in 0.1.1.
*) Bugfix: proxy module may get caught in an endless loop when sendfile
is not used.
*) Bugfix: with sendfile the response was not recoded according to the
charset module directives; bug appeared in 0.1.1.
*) Bugfix: very seldom bug in the kqueue processing.
*) Bugfix: the gzip module compressed the proxied responses that was
already compressed.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 21 Oct 2004 00:00:00 +0400 |
parents | f0b350454894 |
children | 46833bd150cb |
comparison
equal
deleted
inserted
replaced
3:8beaf7b3241f | 4:4b2dafa26fe2 |
---|---|
262 if (r->headers_out.content_range->value.data == NULL) { | 262 if (r->headers_out.content_range->value.data == NULL) { |
263 return NGX_ERROR; | 263 return NGX_ERROR; |
264 } | 264 } |
265 | 265 |
266 r->headers_out.content_range->value.len = | 266 r->headers_out.content_range->value.len = |
267 ngx_sprintf(r->headers_out.content_range->value.data, | |
268 "bytes */%O", r->headers_out.content_length_n) | |
269 - r->headers_out.content_range->value.data; | |
270 #if 0 | |
267 ngx_snprintf((char *) r->headers_out.content_range->value.data, | 271 ngx_snprintf((char *) r->headers_out.content_range->value.data, |
268 8 + 20 + 1, "bytes */" OFF_T_FMT, | 272 8 + 20 + 1, "bytes */" OFF_T_FMT, |
269 r->headers_out.content_length_n); | 273 r->headers_out.content_length_n); |
274 #endif | |
270 | 275 |
271 r->headers_out.content_length_n = -1; | 276 r->headers_out.content_length_n = -1; |
272 if (r->headers_out.content_length) { | 277 if (r->headers_out.content_length) { |
273 r->headers_out.content_length->key.len = 0; | 278 r->headers_out.content_length->key.len = 0; |
274 r->headers_out.content_length = NULL; | 279 r->headers_out.content_length = NULL; |
295 NGX_ERROR); | 300 NGX_ERROR); |
296 | 301 |
297 /* "Content-Range: bytes SSSS-EEEE/TTTT" header */ | 302 /* "Content-Range: bytes SSSS-EEEE/TTTT" header */ |
298 | 303 |
299 r->headers_out.content_range->value.len = | 304 r->headers_out.content_range->value.len = |
305 ngx_sprintf(r->headers_out.content_range->value.data, | |
306 "bytes %O-%O/%O", | |
307 range->start, range->end - 1, | |
308 r->headers_out.content_length_n) | |
309 - r->headers_out.content_range->value.data; | |
310 | |
311 #if 0 | |
300 ngx_snprintf((char *) | 312 ngx_snprintf((char *) |
301 r->headers_out.content_range->value.data, | 313 r->headers_out.content_range->value.data, |
302 6 + 20 + 1 + 20 + 1 + 20 + 1, | 314 6 + 20 + 1 + 20 + 1 + 20 + 1, |
303 "bytes " OFF_T_FMT "-" OFF_T_FMT "/" OFF_T_FMT, | 315 "bytes " OFF_T_FMT "-" OFF_T_FMT "/" OFF_T_FMT, |
304 range->start, range->end - 1, | 316 range->start, range->end - 1, |
305 r->headers_out.content_length_n); | 317 r->headers_out.content_length_n); |
318 #endif | |
306 | 319 |
307 r->headers_out.content_length_n = range->end - range->start; | 320 r->headers_out.content_length_n = range->end - range->start; |
308 | 321 |
309 } else { | 322 } else { |
310 | 323 |
341 * "Content-Range: bytes " | 354 * "Content-Range: bytes " |
342 */ | 355 */ |
343 | 356 |
344 if (r->headers_out.charset.len) { | 357 if (r->headers_out.charset.len) { |
345 ctx->boundary_header.len = | 358 ctx->boundary_header.len = |
359 ngx_sprintf(ctx->boundary_header.data, | |
360 CRLF "--%010ui" CRLF | |
361 "Content-Type: %s; charset=%s" CRLF | |
362 "Content-Range: bytes ", | |
363 boundary, | |
364 r->headers_out.content_type->value.data, | |
365 r->headers_out.charset.data) | |
366 - ctx->boundary_header.data; | |
367 #if 0 | |
346 ngx_snprintf((char *) ctx->boundary_header.data, len, | 368 ngx_snprintf((char *) ctx->boundary_header.data, len, |
347 CRLF "--%010" NGX_UINT_T_FMT CRLF | 369 CRLF "--%010" NGX_UINT_T_FMT CRLF |
348 "Content-Type: %s; charset=%s" CRLF | 370 "Content-Type: %s; charset=%s" CRLF |
349 "Content-Range: bytes ", | 371 "Content-Range: bytes ", |
350 boundary, | 372 boundary, |
351 r->headers_out.content_type->value.data, | 373 r->headers_out.content_type->value.data, |
352 r->headers_out.charset.data); | 374 r->headers_out.charset.data); |
375 #endif | |
353 | 376 |
354 r->headers_out.charset.len = 0; | 377 r->headers_out.charset.len = 0; |
355 | 378 |
356 } else { | 379 } else { |
357 ctx->boundary_header.len = | 380 ctx->boundary_header.len = |
381 ngx_sprintf(ctx->boundary_header.data, | |
382 CRLF "--%010ui" CRLF | |
383 "Content-Type: %s" CRLF | |
384 "Content-Range: bytes ", | |
385 boundary, | |
386 r->headers_out.content_type->value.data) | |
387 - ctx->boundary_header.data; | |
388 | |
389 #if 0 | |
358 ngx_snprintf((char *) ctx->boundary_header.data, len, | 390 ngx_snprintf((char *) ctx->boundary_header.data, len, |
359 CRLF "--%010" NGX_UINT_T_FMT CRLF | 391 CRLF "--%010" NGX_UINT_T_FMT CRLF |
360 "Content-Type: %s" CRLF | 392 "Content-Type: %s" CRLF |
361 "Content-Range: bytes ", | 393 "Content-Range: bytes ", |
362 boundary, | 394 boundary, |
363 r->headers_out.content_type->value.data); | 395 r->headers_out.content_type->value.data); |
396 | |
397 #endif | |
364 } | 398 } |
365 | 399 |
366 ngx_test_null(r->headers_out.content_type->value.data, | 400 ngx_test_null(r->headers_out.content_type->value.data, |
367 ngx_palloc(r->pool, 31 + 10 + 1), | 401 ngx_palloc(r->pool, 31 + 10 + 1), |
368 NGX_ERROR); | 402 NGX_ERROR); |
369 | 403 |
370 /* "Content-Type: multipart/byteranges; boundary=0123456789" */ | 404 /* "Content-Type: multipart/byteranges; boundary=0123456789" */ |
371 | 405 |
372 r->headers_out.content_type->value.len = | 406 r->headers_out.content_type->value.len = |
407 ngx_sprintf(r->headers_out.content_type->value.data, | |
408 "multipart/byteranges; boundary=%010ui", | |
409 boundary) | |
410 - r->headers_out.content_type->value.data; | |
411 #if 0 | |
373 ngx_snprintf((char *) | 412 ngx_snprintf((char *) |
374 r->headers_out.content_type->value.data, | 413 r->headers_out.content_type->value.data, |
375 31 + 10 + 1, | 414 31 + 10 + 1, |
376 "multipart/byteranges; boundary=%010" | 415 "multipart/byteranges; boundary=%010" |
377 NGX_UINT_T_FMT, | 416 NGX_UINT_T_FMT, |
378 boundary); | 417 boundary); |
418 #endif | |
379 | 419 |
380 /* the size of the last boundary CRLF "--0123456789--" CRLF */ | 420 /* the size of the last boundary CRLF "--0123456789--" CRLF */ |
381 len = 4 + 10 + 4; | 421 len = 4 + 10 + 4; |
382 | 422 |
383 range = r->headers_out.ranges.elts; | 423 range = r->headers_out.ranges.elts; |
387 NGX_ERROR); | 427 NGX_ERROR); |
388 | 428 |
389 /* the size of the range: "SSSS-EEEE/TTTT" CRLF CRLF */ | 429 /* the size of the range: "SSSS-EEEE/TTTT" CRLF CRLF */ |
390 | 430 |
391 range[i].content_range.len = | 431 range[i].content_range.len = |
432 ngx_sprintf(range[i].content_range.data, | |
433 "%O-%O/%O" CRLF CRLF, | |
434 range[i].start, range[i].end - 1, | |
435 r->headers_out.content_length_n) | |
436 - range[i].content_range.data; | |
437 #if 0 | |
392 ngx_snprintf((char *) range[i].content_range.data, | 438 ngx_snprintf((char *) range[i].content_range.data, |
393 20 + 1 + 20 + 1 + 20 + 5, | 439 20 + 1 + 20 + 1 + 20 + 5, |
394 OFF_T_FMT "-" OFF_T_FMT "/" OFF_T_FMT CRLF CRLF, | 440 OFF_T_FMT "-" OFF_T_FMT "/" OFF_T_FMT CRLF CRLF, |
395 range[i].start, range[i].end - 1, | 441 range[i].start, range[i].end - 1, |
396 r->headers_out.content_length_n); | 442 r->headers_out.content_length_n); |
443 #endif | |
397 | 444 |
398 len += ctx->boundary_header.len + range[i].content_range.len | 445 len += ctx->boundary_header.len + range[i].content_range.len |
399 + (size_t) (range[i].end - range[i].start); | 446 + (size_t) (range[i].end - range[i].start); |
400 } | 447 } |
401 | 448 |