[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] ZLib & MHD_create_response_from_fd_at_offset64: comp
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] ZLib & MHD_create_response_from_fd_at_offset64: compression on demand |
Date: |
Mon, 7 Jan 2019 12:49:04 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 |
Hi Silvio,
Sorry, that won't work. To send compressed replies *and* use sendfile()
the only way would be to have the gzip'ed file already on disk. (You'll
still need to set the right content encoding, and you must then _also_
have an uncompressed version of the file on disk in case a client does
not support compression.)
Happy hacking!
Christian
On 1/5/19 12:23 AM, silvioprog wrote:
> Hello dudes,
>
> firstly, thanks Christian for indicating the MHD_fd* functions, I
> upgraded my library to use them! :-)
>
> Now I have a new challenge. I'm going to create two new examples for MHD
> (issue #4914), however, I have a question. Is there any chance to use
> zlib to compress data when creating a response via
> MHD_create_response_from_fd_at_offset64()? I tried that, but it seems
> its internal read() cannot be intercepted (to compress data on demand
> using zlib's compress2()). I would like to "intercept" the internal
> MHD's file_reader() (response.c:572) to reuse it instead of rewriting a
> new one, because the original already handles the reading in any
> supported platform.
>
> Thanks in advance for any help!
>
> --
> Silvio Clécio
0x939E6BE1E29FC3CC.asc
Description: application/pgp-keys
signature.asc
Description: OpenPGP digital signature