[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: EnableSendfile and $r->sendfile
From:       "Philippe M. Chiasson" <gozer () ectoplasm ! org>
Date:       2006-10-31 6:22:15
Message-ID: CEAC1461-F845-4B22-B478-7E3B27F13787 () ectoplasm ! org
[Download RAW message or body]


On 30-Oct-06, at 10:49 AM, Dave Viner wrote:

> I'm trying to understand the full effect of the EnableSendfile  
> directive.  If I set the directive to 'Off', what happens when I  
> invoke $r->sendfile($myfile) ??
>
> My hope is that the $r->sendfile will simply use mechanism other  
> than sendfile() to read/send the given file (maybe allocate a  
> buffer, read in file to buffer, send buffer, repeat until file is  
> eof()... or something similar).  But I've looked in the source, but  
> I can't seem to convince myself that this will actually happen

$r->sendfile($myfile) ends up calling ap_send_fd()

ap_send_fd() checks the setting of EnableSendfile, and if it's on AND  
APR_HAS_SENDFILE was detected,
it then calls apr_file_open with the  APR_SENDFILE_ENABLED flag

See here http://apr.apache.org/docs/apr/group__apr__file__io.html#ga3

But it's basically an advisory flag, saying please try and use  
sendfile(), but nothing is guaranteed. In any case,
it will always fallback to something sane, sending the file one way  
or another.


["PGP.sig" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic