|
From: | Taehwan Weon |
Subject: | Re: [libmicrohttpd] a strange thing when send call returns -1 in send_cls() |
Date: | Mon, 3 Nov 2014 13:45:18 +0900 |
On 11/01/2014 07:04 AM, Taehwan Weon wrote:
> I am testing reliability of my caching proxy based on MHD, which opens 80
> port.
> It means anyone can use it to reach any web server.
> Most of incoming requests seems either incomplete or odd.
Most!? Or do you mean "some"?
> (I found a client opened a HTTP session and sent only a part of headers,
> but no body data.)
>
> 1. To avoid spurious EAGAIN, I add a counter into MHD_Connection, which
> counts continuous errors. If a threshold reaches, ECONNRESET set. EAGAIN
> seems caused by buffer full on client side. I am not sure what is the
> client's purpose.
That's odd, TCP flow control should take care of that and simply not
present the (busy) connection as writable to the server userspace.
Still, if you are right, this suggests an easy way to
test for that condition -- by implementing a client that doens't
read the response and by sending a 'large' reply that won't fit
into the buffers. Have you tried this to reproduce the issue?
> 2, To avoid infinite wait to receive remaining part of a client's data, I
> need timeout mechanism.
> I am not sure where is the best location to handle timeout. MHD or my
> caching proxy would be the candidate.
I would say that virtually every MHD production site should set 'some'
timeout for MHD. Note that you can set a custom timeout for a
particular connection, i.e. when you know that a specific connection
will take way longer than usual.
[Prev in Thread] | Current Thread | [Next in Thread] |