lua-users home
lua-l archive

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


On Thu, Mar 01, 2007 at 06:57:50PM -0300, Romulo Bahiense wrote:
> I'm attempting to implement a Keep-Alive connection using the 
> socket.http library. I'm already able to detect and handle the details 
> (http headers, persisting the socket userdata etc.)

> The problem is: how to detect when the server (httpd: apache+fastcgi) 
> closes the connection? I've tried to watch the results of client:send() 
> while sending the reqline and detecting if the error is "closed", but it 
> seems that the client is acting as if nothing had happened until it 
> tries to read from the same socket.

Maybe the http server hasn't closed it's read side of the connection,
only the write side?

Clients are supposed to monitor the read side of the tcp link
continuously, that allows the server to close at any time or to send a
failure response before an entire request is sent by the client.

I don't know how you'd handle that with luasocket's http, but it might
be something to look into.

Sam