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.

websocket library help
#2
Replace upgrade_request function:
Code:
local upgrade_request = function(req, key)
  local format = string.format
  local uri = req.path or ''
  local query = req.query
  if type(query) == 'string' and #query > 0 then
    uri = uri .. '?' .. query
  end

  local lines = {
    format('GET %s HTTP/1.1', uri),
    format('Host: %s', req.host),
    'Upgrade: websocket',
    'Connection: Upgrade',
    format('Sec-WebSocket-Key: %s',key),
    'Sec-WebSocket-Version: 13',
  }
  if req.port and req.port ~= 80 then
    lines[2] = format('Host: %s:%d', req.host, req.port)
  end
  if req.userinfo then
    local auth = format('Authorization: Basic %s', base64enc(req.userinfo))
    tinsert(lines, auth)
  end
  tinsert(lines,'\r\n')
  return tconcat(lines,'\r\n')
end
Reply


Messages In This Thread
websocket library help - by rocfusion - 04.01.2019, 00:37
RE: websocket library help - by admin - 04.01.2019, 10:08

Forum Jump: