[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Q: luasocket https client?
- From: James McLaughlin <jomclaughlin@...>
- Date: Fri, 13 Feb 2009 20:27:12 -0600
> 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.
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()
-- 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?