httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: core dump in ap_send_fd
Date Thu, 20 Dec 2001 18:20:58 GMT

[moving this to dev@httpd since it's an httpd issue]


On Fri, 21 Dec 2001, Stas Bekman wrote:

> ap_send_fd expects the length of the input to send.
>
> First of all is there a way not to specify the length? I've a fd (can be
> a pipe to a process), and I've no way to figure out the length of the
> output. How APR can handle this? This breaks the compatibility with
> send_fd from httpd-1.3.x.

You don't want to send a pipe with ap_send_fd() in Apache 2.0, as it would
put the pipe in a file bucket, which is wrong.  Maybe we should add an
ap_send_pipe(), or maybe we should change the ap_send_fd() API to accept
-1 as a magic length and to recognize it as meaning the thing is a pipe
not a file.  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);

> Second, I've found something that appears to be a bug. If I tell
> ap_send_fd to send one char more than the size of the file that I try to
> send, it asserts and dumps core, the latter probably is bad.

Um, why would you ever do that and expect it to work?  I mean, I guess we
could theoretically check the length you pass in against the length of the
file, but that goes against the
we-expect-the-caller-to-pass-us-sane-arguments mentality that we typically
maintain around here.

--Cliff

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA



Mime
View raw message