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 http://www.inf.puc-rio.br/~brunoos/luasec/)
local conn = socket.tcp()
conn:connect("127.0.0.1", 8888)

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

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,
jim