lua-users home
lua-l archive

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


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.
Op Wo., 7 Nov. 2018 om 21:34 het Srinivas Murthy
<the.srinivas.murthy@gmail.com> geskryf:
>
> Using http.request() like so,
>         response_body = { }
>         local res, code, response_headers, status = http.request
>         {
>         url = myurl,
>         method = "POST",
>
> is resulting in a new TCP conn each time I invoke this call. Is there a way to use persistent tcp conn to avoid this conn setup / tear down overhead?
>