libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] How to avoid responding to a client which has timedo


From: Christian Grothoff
Subject: Re: [libmicrohttpd] How to avoid responding to a client which has timedout
Date: Wed, 14 Oct 2015 16:15:04 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

Hi Basagouda,

You're right, there is no way, because the HTTP/TCP protocol and the OS
doesn't really allow us to detect that the client has timed out (at
least not unless we try to send a reply).  Basically, when MHD tries to
send() the reply, we (may) learn that the client has disconnected, but
there is no (good, scalable, portable, etc.) way to find out that the
TCP connection is dead until we try to use it.

If you have some control/knowledge about the client, you may let the
server know how long your timeout is and then the server can use the
same timeout for the respective connection. That's the best alternative
I can propose if you have frequent problems with timeouts.
Still, in practice, you should probably just strive to rework your code
or architecture to avoid timeouts being common in the first place.

Happy hacking!

Christian


On 10/14/2015 09:19 AM, Basagouda Patil wrote:
> Hi,
> 
>  
> 
> I am using libmicrohttpd-0.9.37 for a http server and would like to
> understand how to avoid responding to a curl based client which has
> timed out on the http request.
> 
> Currently I see that http response from libmicrohttpd for the previous
> request is being received by the libcurl during the current request.
> 
> And previous request has already timed out on the client & it is does
> not want to receive that response in the current one.
> 
>  
> 
> In libmicrohttpd-0.9.37 I did not find an API which will basically
> return a status code based on which server can stop either calling
> MHD_queue_response or returning MHD_NO from the
> MHD_AccessHandlerCallback (). I am using |MHD_USE_THREAD_PER_CONNECTION
> |option.
> 
>  
> 
> Regards
> 
> Basagouda
> 
>  
> 
>  
> 
> *
> 
> BASAGOUDA PATIL*
> Architect - Product Development*
> 
> HARMAN Connected Services
> *Tel. +918033072576 | Mobile +919845980767 | Twitter
> <https://twitter.com/symphony_teleca>
> Plot No.3 & 3A, EOIZ Industrial Area, Sy.No.85 and 86, Sadaramangala
> Village, Krishnarajapuram Hobli, Bangalore-560066, Karnataka, India
> 
> www.symphonyteleca.com
> <http://www.symphonyteleca.com/company/newsroom/blog/the-st-blog/2015/july/microsoft-iot-partner-of-the-year-and-the-award-goes-to/>
> 
> /Please consider the environment before you print.
> 
> Notice to recipient: This e-mail (including any attachments) is meant
> for the intended recipient only, may contain confidential and
> proprietary information, and is protected by law. If you received this
> e-mail in error, please immediately notify the sender of the error by
> return e-mail, delete this communication and any attachments, and shred
> any printouts. Unauthorized review, use, dissemination, distribution,
> copying or taking of any action based on this communication is strictly
> prohibited./
> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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