[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] MHD_create_response_from_fd using a pipe

From: Christian Grothoff
Subject: Re: [libmicrohttpd] MHD_create_response_from_fd using a pipe
Date: Tue, 02 Jun 2015 09:45:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0


Why don't you just use 'MHD_create_response_from_fd'?  I'm not sure how
well pipes (or socketpairs) work with 'sendfile', but short of that,
this should work at least to set the FD.

You wouldn't be able to do chunked encoding on systems where 'size_t !=
uint64_t' (because we have 'size_t' for the size argument, which is
admittedly not nice). Other than those limitations, this should give you
the desired result.


On 06/02/2015 08:07 AM, Denis Dowling wrote:
> Hi,
> I am looking at generating some content from the result of a zip process
> and it would be neat if I could get the popen() pipe to push data
> directly into MHD_create_response. It looks like this would almost work
> by using MHD_create_response_from_callback but also setting the
> response->fd to be the fd of the pipe returned by popen(). Read callback
> would be mostly the same as happens for a file. The size would be set to
> -1 for chunked output. pclose() call could be run from the free callback.
> Has anyone done something like this before? There is an issue that the
> response->fd is opaque from user code and would need some function to
> expose.
> Regards,
> Denis
> ------------------------------------------------------------------------
> The information contained in this message and any attachments is
> strictly confidential and intended solely for the use of the intended
> recipient(s). The copyright in this communication belongs to *(HSD)*.
> This message and any attachments are confidential and may be subject to
> legal or other professional privilege. Any confidentiality or privilege
> is not waived or lost because this e-mail has been sent to you by
> mistake. If you have received this transmission in error, please notify
> *HSD* on +61 3 9875 5900 immediately and destroy all copies of this
> e-mail. The contents of this email message may not be quoted, copied,
> reproduced or published in part or in whole, without the written
> authorisation of *HSD*.

Attachment: 0xE29FC3CC.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]