Mercurial > hg > nginx-vendor-0-8
comparison src/http/modules/perl/nginx.xs @ 162:6be073125f2e NGINX_0_3_28
nginx 0.3.28
*) Feature: the "restrict_host_names" directive was canceled.
*) Feature: the --with-cpu-opt=ppc64 configuration parameter.
*) Bugfix: on some condition the proxied connection with a client was
terminated prematurely.
Thanks to Vladimir Shutoff.
*) Bugfix: the "X-Accel-Limit-Rate" header line was not taken into
account if the request was redirected using the "X-Accel-Redirect"
header line.
*) Bugfix: the "post_action" directive ran only after a successful
completion of a request.
*) Bugfix: the proxied response body generated by the "post_action"
directive was transferred to a client.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 16 Feb 2006 00:00:00 +0300 |
parents | 396dbbc06dd7 |
children | fef68f68bcfd |
comparison
equal
deleted
inserted
replaced
161:086553d7da41 | 162:6be073125f2e |
---|---|
413 OUTPUT: | 413 OUTPUT: |
414 RETVAL | 414 RETVAL |
415 | 415 |
416 | 416 |
417 int | 417 int |
418 sendfile(r, filename) | 418 sendfile(r, filename, offset = -1, bytes = 0) |
419 nginx r | 419 nginx r |
420 char *filename | 420 char *filename |
421 int offset; | |
422 size_t bytes; | |
421 | 423 |
422 PREINIT: | 424 PREINIT: |
423 | 425 |
424 ngx_fd_t fd; | 426 ngx_fd_t fd; |
425 ngx_buf_t *b; | 427 ngx_buf_t *b; |
458 ngx_open_file_n " \"%s\" failed", filename); | 460 ngx_open_file_n " \"%s\" failed", filename); |
459 RETVAL = NGX_ERROR; | 461 RETVAL = NGX_ERROR; |
460 goto done; | 462 goto done; |
461 } | 463 } |
462 | 464 |
463 if (ngx_fd_info(fd, &fi) == NGX_FILE_ERROR) { | 465 if (offset == -1) { |
464 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, | 466 offset = 0; |
465 ngx_fd_info_n " \"%s\" failed", filename); | 467 } |
466 | 468 |
467 if (ngx_close_file(fd) == NGX_FILE_ERROR) { | 469 if (bytes == 0) { |
468 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, | 470 if (ngx_fd_info(fd, &fi) == NGX_FILE_ERROR) { |
469 ngx_close_file_n " \"%s\" failed", filename); | 471 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, |
470 } | 472 ngx_fd_info_n " \"%s\" failed", filename); |
471 | 473 |
472 RETVAL = NGX_ERROR; | 474 if (ngx_close_file(fd) == NGX_FILE_ERROR) { |
473 goto done; | 475 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, |
476 ngx_close_file_n " \"%s\" failed", filename); | |
477 } | |
478 | |
479 RETVAL = NGX_ERROR; | |
480 goto done; | |
481 | |
482 } | |
483 | |
484 bytes = ngx_file_size(&fi) - offset; | |
474 } | 485 } |
475 | 486 |
476 cln->handler = ngx_pool_cleanup_file; | 487 cln->handler = ngx_pool_cleanup_file; |
477 clnf = cln->data; | 488 clnf = cln->data; |
478 | 489 |
479 clnf->fd = fd; | 490 clnf->fd = fd; |
480 clnf->name = (u_char *) ""; | 491 clnf->name = (u_char *) ""; |
481 clnf->log = r->pool->log; | 492 clnf->log = r->pool->log; |
482 | 493 |
483 b->in_file = 1; | 494 b->in_file = 1; |
484 b->file_pos = 0; | 495 |
485 b->file_last = ngx_file_size(&fi); | 496 b->file_pos = offset; |
497 b->file_last = offset + bytes; | |
486 | 498 |
487 b->file->fd = fd; | 499 b->file->fd = fd; |
488 b->file->log = r->connection->log; | 500 b->file->log = r->connection->log; |
489 | 501 |
490 RETVAL = ngx_http_perl_output(r, b); | 502 RETVAL = ngx_http_perl_output(r, b); |