libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] MHD_ContentReaderCallback and Byte serving


From: Christian Grothoff
Subject: Re: [libmicrohttpd] MHD_ContentReaderCallback and Byte serving
Date: Sat, 16 Apr 2016 11:08:24 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0

Hi!

What you do is you need to (1) manually add the header to tell the
browser that you support range requests, and (2) request the "Range"
header from MHD, and parse it to get the range yourself. Then you
generate a response that covers the range (that's what the "at_offset"
API is for).

Maybe we should find a better way to explain this in the manual, because
"clients" in the passage you are quoting was intended to refer to the
main program that uses the MHD library.

Does this help?

-Christian

On 04/16/2016 04:45 AM, silvioprog wrote:
> Hello,
> 
> I've used the MHD_create_response_from_callback() to serve big files,
> however, I need to send only a portion of some certain files. It can be
> easily done using the HTTP 1.1 Byte serving
> <https://en.wikipedia.org/wiki/Byte_serving>, that can be implemented
> following the RFC 7233 <http://httpwg.org/specs/rfc7233.html> and getting
> inspirations from Node JS send logic
> <https://github.com/pillarjs/send/blob/master/index.js#L561>.
> 
> Considering this goals, can I get the client range request in the
> MHD_ContentReaderCallback()? For example, considering that client sent
> "Range: bytes=1-2", can I get these values parsed in this callback
> parameters?
> 
> I took a look at MHD manual, but unfortunately I found only:
> 
> "The library is supposed to handle everything that it must handle (...),
> such as basic connection management; however, detailed interpretations of
> headers — *such as range requests* — and HTTP methods are left to clients."
> 
> Any tip are welcome.
> 
> Thank you!
> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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