Comparison

net/websocket.lua @ 8893:eb710675f7f8

net.websocket: Honour ex.insecure to match net.http's new parameter for that
author Matthew Wild <mwild1@gmail.com>
date Fri, 08 Jun 2018 16:30:46 +0100
parent 8892:fb38b2c77a72
child 10112:b327f2870382
comparison
equal deleted inserted replaced
8892:fb38b2c77a72 8893:eb710675f7f8
234 local http_url = url:gsub("^(ws)", "http"); 234 local http_url = url:gsub("^(ws)", "http");
235 local http_req = http.request(http_url, { -- luacheck: ignore 211/http_req 235 local http_req = http.request(http_url, { -- luacheck: ignore 211/http_req
236 method = "GET"; 236 method = "GET";
237 headers = headers; 237 headers = headers;
238 sslctx = ex.sslctx; 238 sslctx = ex.sslctx;
239 insecure = ex.insecure;
239 }, function(b, c, r, http_req) 240 }, function(b, c, r, http_req)
240 if c ~= 101 241 if c ~= 101
241 or r.headers["connection"]:lower() ~= "upgrade" 242 or r.headers["connection"]:lower() ~= "upgrade"
242 or r.headers["upgrade"] ~= "websocket" 243 or r.headers["upgrade"] ~= "websocket"
243 or r.headers["sec-websocket-accept"] ~= base64.encode(sha1(key .. "258EAFA5-E914-47DA-95CA-C5AB0DC85B11")) 244 or r.headers["sec-websocket-accept"] ~= base64.encode(sha1(key .. "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"))