Hi Santos and Christian.

Santos, the Christian's answer was complete and clarified me a lot too. ☺

Christian, it seems sendfile() is not available in mingw and in the
Google's NDK (Android), but my library must work at least on
Windows, Linux, Raspbian and Android, so I've used the fopen() in this way:
link
<https://github.com/risoflora/libsagui/blob/master/src/sg_httpres.c#L112>
(sorry
for put a link, but the code is a little bit large). Do you recommend to
use fopen() in those cases? I would like to use sendfile() because it is
very fast, but I can't implement it for Windows.

Thanks in advance for your help!

On Wed, Nov 28, 2018 at 1:55 PM Christian Grothoff <groth...@gnunet.org>
wrote:

> Dear Santos,
>
> MHD can send chunked response to the client. That said, this is not a
> question of how large the file is. Especially, if it is simply a very
> large file, MHD allows you to use sendfile() to avoid having a copy of
> the data in userspace.  Chunked encoding is usually only used if the
> application simply does not know the size of the response ahead of time.
>
> Happy hacking!
>
> Christian
>
> On 11/28/18 4:09 PM, Santos Das wrote:
> > Hi,
> >
> > How can MHD send the chunked message to the client ?
> >
> > When a server receives a simple GET request, and the response is so
> > large that it must be sent back using the "chunked" procedure.
> >
> > An example would be if a server received a file GET request, and the
> > response is a large data file.
> >
> > Can you please point me to some example on how this can be done using
> MHD ?
> >
> > Thanks in advance.
> >
> > Regards, Santos
>

-- 
Silvio Clécio

Reply via email to