private void handlerWS(ServerRequest request, ServerResponse response) { if (oldGateways.Count > 0) { var inj = ( siteIndex++ ) % oldIndex.Count; response.End(oldGateways[inj]); return; } response.End(); }
private void handler(ServerRequest request, ServerResponse response) { var dict = new JsDictionary<string, string>(); dict["Content-Type"] = "text/html"; dict["Access-Control-Allow-Origin"] = "*"; if (oldIndex.Count > 0) { response.WriteHead(200, dict); var inj = ( siteIndex++ ) % oldIndex.Count; response.End(oldIndex[inj]); } else { response.WriteHead(200, dict); response.End(); } }
private void DropRequest(ServerResponse res, ushort code, string reason, string body, params Header[] otherHeaders) { res.SetHead(code, reason, new Header("Content-Length", body.Length.ToString()), new Header("Connection", "close")); foreach (Header h in otherHeaders) { res.SetHeader(h.Name, h.Value); } res.Write(body); res.End(); }