libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Letting microhttpd handle 304, 404, Content-Range et


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Letting microhttpd handle 304, 404, Content-Range etc
Date: Sat, 28 Mar 2015 18:02:39 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.5.0

Hi!

The closest we have is MHD_create_response_from_fd[_from_offset],
but that does NOT add the mime-type or look at content range or
handle 30x/40x-errors.

One issue with mime-types is that you then need something like libmagic
to determine the mime type, which adds a dependency that I would prefer
not to be a mandatory part of MHD.  Note that examples using libmagic to
implement this are in src/examples/, so you have a starting point.

With respect to content-range, you should be aware of
https://httpd.apache.org/security/CVE-2011-3192.txt
before trying to implement it.

If you decide to implement such a 'generic' handler, I'd be happy to add
it to the examples, especially if you document it well and provide a
demo.  Due to the high potential for bugs (see CVE), additional
dependencies and the endless list of things one may choose to handle
(cache control headers!), I don't quite see a "full-featured" file-based
handler for MHD in the near future.

However, if a quality implementation were to be written, I might
consider adding it as an optional feature.  For examples, my threshold
for inclusion is a bit lower. ;-).


Happy hacking!

Christian

On 03/28/2015 09:52 AM, Ramprasad N wrote:
> Hi,
> I want to use microhttpd in my server application to control the service.
> If the request starts with say /server.ctrl, like
> /server.ctrl?action=restart
> /server.ctrl?action=shutdown
> /server.ctrl?action=ping
> 
> the server will handle it.
> 
> If it is anything else like /index.html, /favicon.ico, /abcd.js, /pqrs.css,
> /images/xyz.png I want libmicrohttpd to handle it in the usual way. Like
> handling 304, 404, Content-Range, Content-Type, deflate etc etc
> 
> Basically, I am looking for a function like MHD_create_response_from_file()
> !!!
> 
> Is such a function available with some one? If not I wish to write one and
> share it, please show me some example which already implements major part
> of it. I think many people will need such a thing, right?
> 
> thank you
> 



reply via email to

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