[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Processing single request with data from heap
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] Processing single request with data from heap |
Date: |
Sun, 18 Jun 2017 10:44:12 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
MHD_create_response_from_callback() is the API you are looking for.
src/examples/chunked_example.c (and various others) is one example for
how this API is used. Admittedly, it's not in the tutorial (yet), and I
agree it would be good to add it.
On 06/18/2017 10:38 AM, Alex Reynolds wrote:
> I have some request handler code that sends the contents of a regular
> file to the client. However, the issue is that my program must first
> write a regular file to the file system, and this is time consuming for
> very large files. My program (and the client) must wait for the entire
> file to be generated, before my program can go back and read the file to
> send any data to the client.
>
> As an addition to the excellent tutorials already available, I'd like to
> ask if there could be a tutorial written that demonstrates how to
> process a single request for data in chunks, where the source of the
> data is not a regular file, but a heap-allocated buffer of some size,
> which is repeatedly filled to some content length (up to or smaller than
> its size) and sent to the client in asynchronous fashion, until all data
> are processed.
>
> Regards,
> Alex
signature.asc
Description: OpenPGP digital signature