lua-users home
lua-l archive

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


Thanks Paul and everyone that helped with suggestions. After a fair bit of struggle I got it working.  Ad hoc and messy process I know, but at least it worked.

I didnt really like any of those solutions, none were straightforward. For the average Joe Win programmer like me, I dont like the LuaDist type solution of download all the dependency sources and download mingw and compile ourselves.  Too much hassle and too many things likely to trip you up.

For anyone that struggles with this in the future, here is exactly what I did to get luasec/SSL working  (I am using Lua 5.1 and Win7 64 Bit for reference)

I am using LuaSocket 2.0.2 from an earlier LuaForWindows Install
Downloaded Luasec 0.5 from Github

Refer to this page to get the Windows Luasec binaries.
I  chose Windows x86 (32-bit) 

 Copied the 'ssl.lua' file to a folder in my LUA_PATH.
 Copied the 'ssl.dll' file to a folder in  my LUA_CPATH.
 Created a directory 'ssl' in my LUA_PATH and copied 'https.lua' to it.

Tested it with this code
local https = require("ssl.https")

local body, code, headers, status = https.request("";)
print(body, code, headers, status)

I got a Window dialogue box pop up with a fairly obscure sounding error. Forget the exact wording, something like

"The ordinal 350 could not be located in the dynamic link library SSLEAY32.dll"

That one had me foxed for a while, but found an article.

As the article points out the error was due to the version of openSSL that ships and installs with WAMP.
(I had installed WAMP on my PC some time ago)

So then went to this page

and downloaded and installed   Win32 OpenSSL v1.0.2d

That fixed the problem, I can now download https pages successfully.

My code to get the live football scores from the Betfair page is not working but thats just some html parsing logic problem I daresay.
I should be able to debug that and get it working tomorrow with some assistance from Zerobrane Studio.

Hey Paul, you should try Zerobrane Studio, its excellent and very helpful at  bug finding !  :)

Regards Geoff

From: <> on behalf of Paul K <>
Sent: 24 November 2015 22:03
To: Lua mailing list
Subject: Re: How to get a webpage with Lua Socket ?

Hi Geoff,

> This library doesnt appear to have a windows binary available.  So I have to build it myself, with not very good build notes.
> I wonder if I could  snag the luasec  *.lua files and *.dll file I need from my  Zerobrane Studio installation ? That might be a simpler solution ?

Yes, you should be able to get all the files including the binary from
this commit:
The DLL is no longer packaged with the IDE, but you can still get it
from the archive. Note that you still need openssl libraries installed
and referenced in PATH, but they come with many applications, like
wget, svn, and others.

Another option is to compile luasec using the build scripts from ZBS.
You'll need to pull the latest changes from the repository and then
run "(cd build; bash lua luasec)". This should build
and install ssl.dll in the right place under ZBS tree (and it will
include all the dependencies) as long as you have mingw/msys or tdm

Yet another option is to try luarocks or luadist
you'd still need openssl libraries and headers though.