[Top][All Lists]

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

[libmicrohttpd] Re: libmicrohttpd question

From: Christian Grothoff
Subject: [libmicrohttpd] Re: libmicrohttpd question
Date: Sun, 14 Nov 2010 20:49:54 +0100
User-agent: KMail/1.13.2 (Linux/2.6.32-25-generic; KDE/4.4.2; i686; ; )

Dear Jared,

I was just about to fire back a response saying: "just add a footer", but then 
I decided to look for the API for that and I found that -- while 99% of the 
support for this is there -- a tiny function to do so was missing from the 

So I'm happy to introduce: "MHD_add_response_footer"; the only difference to 
'MHD_add_response_header' being that the 'kind' is set to MHD_FOOTER_KIND. The 
new API is in SVN 13683.

This helps you in that you simply add a footer that signals your client 
software that some kind of error happened; doing so inside of the response
callback while also returning "-1" should do the trick.

In fact, the recommended approach would actually be to always add a 
cryptographic checksum (MD5, SHA-1) as a footer.  That way, your clients will 
also be better at detecting other transmission errors in your gigabytes of 
data.  This is the best approach, and certainly also how HTTP intended footers 
to be used.  

Naturally, this only works if you can teach your HTTP client to respect 
footers.  If you cannot do that, I don't have a good answer for you.

Happy hacking,


On Sunday, November 14, 2010 06:00:37 pm Jared Cantwell wrote:
> Hi Christian,
> Thanks for a great piece of software-- it has helped me tremendously to
> quickly implement a key feature for us.  I have a question about chunked
> uploads that I was hoping you could help me with.  According to the
> documentation (and my reading of the code), when using
> MHD_ContentReaderCallback to return chunks of data (i.e. in response to a
> GET request), there doesn't seem to be a way to indicate that the chunked
> response failed.  Returning 0 will try again, -1 will assume the transfer
> completed successfully.  Is there a way to indicate to MHD that a chunked
> response failed?  The reason I ask is that we are transferring files on the
> order of 10s of GBs, and we're getting this data from throughout our
> cluster.  Midway through the transfer, anything could happen, and it would
> be nice to just prematurely close the connection to signal failure (instead
> of assuming the end of the chunked data was reached).  Am I missing
> something in the interface, or is this just not currently possible?
> Thanks for any help!!
> ~Jared

reply via email to

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