[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Problem trying to download a webpage
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 25 Mar 2019 20:54:17 +0200
I installed it from LuaRocks, which normally takes care of system
dependencies. It should install on Windows or Unix platforms with just
luarocks install lua-curl
The rockspec says:
external_dependencies = {
platforms = {
windows = {
CURL = {
header = "curl/curl.h",
library = "libcurl",
}
};
unix = {
CURL = {
header = "curl/curl.h",
-- library = "curl",
}
};
}
}
build = {
copy_directories = {'doc', 'examples', 'test'},
type = "builtin",
platforms = {
windows = { modules = {
lcurl = {
libraries = {"libcurl", "ws2_32"},
}
}},
unix = { modules = {
lcurl = {
libraries = {"curl"},
}
}}
},
Unfortunatly I can't offer Windows-specific advice, but there must be
many list members who can.
Op Ma. 25 Mrt. 2019 om 19:30 het Geoff Smith <spammealot1@live.co.uk> geskryf:
>
> hi
>
> Thanks for the response, I would be happy to use whatever works to download the page i need. However I have never used lua curl before, so I am unsure how to get that working.
>
> Could you point me at some Windows library binaries I would need to try this ? Also what is the require line needed ? require "curl" or "luacurl" "libcurl". A quick google search seemed to have a mixture of these
>
>
> ________________________________
> From: lua-l-bounces@lists.lua.org <lua-l-bounces@lists.lua.org> on behalf of Dirk Laurie <dirk.laurie@gmail.com>
> Sent: 25 March 2019 13:34
> To: Lua mailing list
> Subject: Re: Problem trying to download a webpage
>
> I suppose this does not answer your question, but ... if you don't
> explicitly need SSL, you can get away with curl.
>
> I figured out the 'if' below a year or two ago, and now just
> cut-and-paste it every time.
>
> Having loaded lua-curl as "curl", this is all:
>
> logins = {}
> session = curl.easy()
> if curl.OPT_COOKIEFILE and curl.OPT_COOKIEJAR then
> cookies = os.tmpname()
> session:setopt(curl.OPT_COOKIEFILE,cookies)
> session:setopt(curl.OPT_COOKIEJAR,cookies)
> logins[session] = cookies
> else
> message("Your 'curl' does not support cookies. You will be anonymous.")
> end
> session:setopt{url="https://www.attheraces.com/racecards",writefunction=print}:perform()
>
> I see the entire HTML code of the landing page.
>
> To store it in a table, just put something like 'function(str)
> table.insert(buffer,str) end' instead of 'print' having done
> 'buffer={}' first.
>
>
>
> Op Ma. 25 Mrt. 2019 om 13:51 het Geoff Smith <spammealot1@live.co.uk> geskryf:
> >
> > I am trying to download a webpage using Lua 5.1 and Luasec (not sure which version)
> >
> > I am seeing the same error on several pages, but one example is [[https://www.attheraces.com/racecards]]
> > I am getting an error stating "sslv3 alert handshake failure"
> >
> > I am not an expert on the https protocol so not sure what I need to do to fix this problem. I am assuming i need to tell it to use TLS v1.2 or later to make it work. Not proved that this is the problem though. Here is gist of my latest code attempt that still gives me the same error.
> >
> > ssl.newcontext({mode="client", protocol="tlsv1_2"})
> >
> > local url = [[https://www.attheraces.com/racecards]]
> >
> > webText, code, headers, status = https.request({url=url, protocol="tlsv1_2"})
> > print(code, headers, status)
> >
> > I have tried protocol = "sslv23" and "sslv3" neither fixed the problem
> >
> > Any help on this issue would be most appreciated, thanks.
> >
> >
> >
> >
> >
> >
> >
> > Virus-free. www.avast.com
>
>
> Virus-free. www.avast.com