lua-users home
lua-l archive

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





On Mon, Aug 26, 2013 at 4:30 AM, Choonster TheMage <choonster.2010@gmail.com> wrote:

On 26 Aug 2013 09:12, "William Ahern" <william@25thandclement.com> wrote:
>
> On Sun, Aug 25, 2013 at 08:20:25PM +1000, Choonster TheMage wrote:
> > Does anyone know of any examples of asynchronous HTTPS requests in
> > Lua? I've seen some examples of asynchronous HTTP using LuaSocket, but
> > nothing with LuaSec for asynchronous HTTPS requests.
> >
> > I'm writing a Lua interface[1] to a RESTful web API[2] which requires
> > HTTPS requests for authenticated users. I'm looking into what it would
> > take to rewrite the library to use asynchronous requests instead of
> > synchronous ones.
>
> My cqueues library supports this:
>
>         http://25thandclement.com/~william/projects/cqueues.html
>
> But it doesn't use LuaSocket or LuaSec. See cqueues/src/lib/socket.c for how
> it uses the OpenSSL library. Specifically, so_starttls_, so_read, and
> so_write.
>

That looks quite interesting, but unfortunately I'd like to support both Windows and Unix systems.


On 26 August 2013 16:04, Ross Bencina <rossb-lists@audiomulch.com> wrote:


>
> On 25/08/2013 8:20 PM, Choonster TheMage wrote:
>>
>> Does anyone know of any examples of asynchronous HTTPS requests in
>> Lua?
>
>
> For another non-luasocket async networking option you could look at luvit
> (http://luvit.io/)
>
> I believe that there is also a libuv binding for non-luajit Lua developed by
> the same guy(s).
>
> Ross.
>

I'll take a look at luv, thanks. There are a few bindings of libuv around.


I'm working on creationix/luv again thanks to recent interest in the project.  Luv itself doesn't do https or tls, but the http parser in luvit is also packaged standalone as creationix/lhttp_parser on github.  Tls would be harder, but someone could extract the openssl bindings out from luvit.

Or if you want the controlled route, luvit runs on windows and unix systems and has all that built-in.  It's just a little more opinionated and doesn't work out of the box with most existing lua libraries.