This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

http.request more then 1 command in the same session
#6
So then you just need to pass cookie header to the next request:
Code:
require('socket.http')
socket.http.TIMEOUT = 5

url1 = ...
url2 = ...

res, err, hdrs = socket.http.request(url1)

if res then
  tbl = {}
  res, err = socket.http.request({
    url = url2,
    headers = {
      cookie = hdrs['set-cookie']
    },
    sink = ltn12.sink.table(tbl),
  })

  if res then
    resp = table.concat(tbl)
    log(resp)
  else
    alert('request 2 failed: ' .. tostring(err))
  end
else
  alert('request 1 failed: ' .. tostring(err))
end
Reply


Messages In This Thread
RE: http.request more then 1 command in the same session - by admin - 19.02.2019, 09:16

Forum Jump: