private static bool IsAuthenticated(HeyHttpRequest request) { string authorization = request.GetHeader("Proxy-Authorization"); if (!String.IsNullOrEmpty(authorization)) { // Credentails are included. return(true); } return(false); }
private static void Upgrade() { if (requestHeaders.Method != "GET") { throw new Exception("HTTP method must be 'GET'."); } // E.g.: Upgrade: websocket if (requestHeaders.GetHeader("Upgrade", "").ToLower() != "websocket") { throw new Exception("'Upgrade' header must be 'websocket'."); } // E.g.: Connection: keep-alive, Upgrade if (!requestHeaders.GetHeader("Connection", "").ToLower().Contains("upgrade")) { throw new Exception("'Connection' header must be 'upgrade'."); } SendResponseHeaders(); ReadData(); }
private void ReadRequestContent() { using (FileStream logFileStream = File.OpenWrite(logFile.FullName)) { if (request.GetHeader("Transfer-Encoding") == "chunked") { ReadChunkedRequestContent(logFileStream); } else { ReadNormalRequestContent(logFileStream); } } }