lua-users home
lua-l archive

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


Thijs,

you are right. I found the same while implementing SSL with LuaSEC in my project.

Currently I am trying get LuaSec and Copas work together in a non-blocking fashion, which is not that easy as there are some more issues between the socket library and the Copas which make a non-blocking connect() not 100% reliable on some OS.
The LuaSec functions in between complicate this a little bit further:-)

--
Oliver

Am 03.03.2015 um 22:44 schrieb Thijs Schreijer:
Aaron B. wrote
On Thu, 23 Oct 2014 06:38:45 +0000
Thijs Schreijer <
thijs@
> wrote:

Does anyone have (a pointer to) some examples implementing this (copas
with luasec, or just luasec used non-blocking)?

I remember it being surpisingly simple to get LuaSec and Copas to play
nice. In short, just call ssl.wrap() inside your handler function.

I needed it working for a project once, and it looks like my patch was
applied:

https://github.com/lipp/tango/blob/master/tango/server/copas_socket.lua

--
Aaron B. <
aaron@
>
Took me a while, but got into this matter rather deep. From this line [1],
it seems to me that it does not do non-blocking ssl. The timeout has a
default of 10 seconds, which means that it still might block for 10 seconds.
The LuaSec  ssl wrapper will return "wantread" or "wantwrite" on a
non-blocking socket, which doesn't seem to be handled in the code. So from
what I see, the timeout is high enough to not encounter it... (but hence it
is blocking)

Or am I missing something?

Thijs

[1]
https://github.com/lipp/tango/blob/master/tango/server/copas_socket.lua#L22




--
View this message in context: http://lua.2524044.n2.nabble.com/using-Copas-with-LuaSec-non-blocking-ssl-tp7663632p7666106.html
Sent from the Lua-l mailing list archive at Nabble.com.