Welcome! Log In Create A New Profile

Advanced

Re: Using sendfile in module

Maxim Dounin
May 06, 2010 05:32AM
Hello!

On Wed, May 05, 2010 at 06:51:15PM -0700, Kent Karlsson wrote:

> I'm considering porting a slow cgi to a module for nginx that
> provides a custom url scheme to access parts of big files and
> would like to use sendfile to avoid copying all the data to
> userspace and back again. I looked at X-Accel-Redirect, but it
> seems to require that I send the entire file, which won't work
> for me.

X-Accel-Redirect require URI, it's up to other modules to provide
entire file or parts of a file as a response to the URI in
question. E.g. you may combine X-Accel-Redirect with bytes filter
to obtain parts of files, see here:

http://mdounin.ru/hg/ngx_http_bytes_filter_module/

> I need to understand if it is possible first, so if someone can
> tell me if it is and maybe give me some code or links to read,
> that would be much appreciated.

Just provide correct in-file buffer, nginx will take care of it
according to OS capabilities and/or config settings.

See ngx_http_flv_module.c for an example of sending parts of a
file from content handler module.

Maxim Dounin

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Using sendfile in module

Kent Karlsson 2364 May 05, 2010 09:52PM

Re: Using sendfile in module

Maxim Dounin 1364 May 06, 2010 05:32AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 299
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready