lua-users home
lua-l archive

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


Hi,

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.

Another solution I've tried is to socket.protect socket.http.request{} and repeat the whole request when the connection was closed, but sometimes the server _do_ close the connection and repeating the request would be wrong.

Am I doing something wrong? Any ideas?

WinXP, Lua 5.0.2, LuaSocket-2.0.1-lua50-win32.

Thanks.