lua-users home
lua-l archive

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

> Could you use the "create" request field? It allows you to
> pass a function that will be used to create the socket
> object. As long as your object respects the standard socket
> interface, http.request won't even notice.
Hi Diego,
Thanks for your response. I am not sure this will work. The example
from luasec has some work done after the call to "connect", which http
calls after "create" in the "open" function:

(from luasec
local conn = socket.tcp()
conn:connect("", 8888)

 -- TLS/SSL initialization
conn = ssl.wrap(conn, params)

but maybe my "create" function can return a proxy for socket with an
overide for "connect" that does the ssl initialization. Not entirely
clear how this would work since the ssl.wrap function seems to return
a proxy of its own. Should I set a new metatable on self inside the
proxy "connect" method? Are we allowed to do that?

thanks again,