lua-users home
lua-l archive

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


Op Do., 8 Nov. 2018 om 02:47 het Srinivas Murthy
<the.srinivas.murthy@gmail.com> geskryf:
>
> This is an important issue for me. Can anyone please add to this? There's got to be a way to avoid conn setup/teardown each time we issue a http.request()
>
> Thanks
>
> On Wed, Nov 7, 2018 at 12:44 PM Coda Highland <chighland@gmail.com> wrote:
>>
>> On Wed, Nov 7, 2018 at 1:56 PM Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> >
>> > You need to provide a file for stroing cookies.
>> >
>> > I can do it from the module 'curl' installed by 'luarocks install lua-curl'.
>> >
>> >   local session = curl.easy()
>> >   local cookies
>> >   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
>> >
>> > The module 'http' should offer a similar service.
>>
>> That's curious. A cookie jar is required in order to use HTTP
>> keepalive? Is that documented? It seems like a dubious dependency.

All I can attest to is that curl with a cookie jar works. It might
well be overkill of you need only keepalive, but since I use curl only
for sites that require me to login, I would not know.