libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] MHD_connection_close API


From: Christian Grothoff
Subject: Re: [libmicrohttpd] MHD_connection_close API
Date: Tue, 1 Dec 2015 14:17:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.3.0

Hi Robert,

I think I understand you goal, and I think you missed the "trick": if
you want to force MHD to close a persistent connection after the current
reply (and the client set keep-alive, it is HTTP/1.1, etc.), what you
should do is explicitly add a "Connection: Close" header to your
response.  MHD will detect that you did this, and will then close the
connection itself.

Alternatively, if you want to hard-close a connection (in violation of
the protocol) at any time, you just need to return "MHD_NO" from the
handler.

Please let me know if this somehow doesn't solve your problem (i.e.
because I didn't understand what you wanted to do).

Happy hacking!

Christian

On 12/01/2015 02:13 PM, Robert Groenenberg wrote:
> Hi Christian,
> 
> In my application I want to be able to close a (persistent) connection
> after completing the current request. For this I had in mind to register
> a callback for the NOTIFY_COMPLETED option.
> When the callback is called and my close flag is set, I wanted to call
> *MHD_connection_close()*.
> Only glitch is that MHD_connection_close() is not in the external API...
> 
> Could it be made part of the external API?
> 
> Kind regards,
> Robert
> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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