httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: core dump in ap_send_fd
Date Fri, 21 Dec 2001 18:10:15 GMT
On Friday 21 December 2001 12:09 am, Stas Bekman wrote:
> William A. Rowe, Jr. wrote:
> 
>  > From: "Stas Bekman" <stas@stason.org>
>  > Sent: Friday, December 21, 2001 12:14 AM
>  >
>  >
>  >
>  >>>In the meanwhile, you need to use the buckets directly.
>  >>>It's only four lines of code as opposed to one.
>  >>>
>  >>>apr_bucket_brigade *bb = apr_brigade_create(r->pool);
>  >>>apr_bucket *b = apr_bucket_pipe_create(thepipe);
>  >>>APR_BRIGADE_INSERT_TAIL(bb, b);
>  >>>ap_pass_brigade(bb);
>  >>>
>  >>
>  >>can I use this for sending an opened file as well? given that I've a fd
>  >>already opened from Perl. I use ap_os_file_put to convert it into
>  >>apr_file_t.
>  >>
>  >
>  > That is most certainly not portable.  Win32, particularly, has alternate
>  > semantics for opening files as 'sendfile ready'.  Passing in an fd [which
>  > would be a HANDLE on win32] isn't send-file-able.
> 
> 
> Please suggest a portable alternative. In 1.3.x we have:
> 
>     include/http_protocol.h:
>     API_EXPORT(long) ap_send_fd_length(FILE *f, request_rec *r, long 
> length);
> 
> (which supported length=-1, for 'figure it out yourself')
> 
> and it's being used in many places. When people move to 2.0 what can
> they do? Their code will break since this functionality is not available
> in APR.

It can't easily be done portably.  We could do it in 1.3, because we relied
on POSIX, but that killed performance on non-Unix platforms.  In 2.0, we
use APR to get better performance with good portability.

Ryan
______________________________________________________________
Ryan Bloom				rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Mime
View raw message