public override void EndOfRequest() { Connection conn = _connection; if (conn != null) { _connection = null; _server.OnRequestEnd(conn, GetProcessUser()); } if (_auth != null) { _auth.Dispose(); // _auth = null; } }
private bool TryNtlmAuthenticate() { NtlmAuth auth = null; try { auth = new NtlmAuth(); do { string blobString = null; string extraHeaders = _knownRequestHeaders[0x18]; if ((extraHeaders != null) && extraHeaders.StartsWith("NTLM ", StringComparison.Ordinal)) { blobString = extraHeaders.Substring(5); } if (blobString != null) { if (!auth.Authenticate(blobString)) { _connection.WriteErrorAndClose(0x193); return(false); } if (auth.Completed) { goto Label_009A; } extraHeaders = "WWW-Authenticate: NTLM " + auth.Blob + "\r\n"; } else { extraHeaders = "WWW-Authenticate: NTLM\r\n"; } SkipAllPostedContent(); _connection.WriteErrorWithExtraHeadersAndKeepAlive(0x191, extraHeaders); } while (TryParseRequest()); return(false); Label_009A: if (_host.GetProcessSid() != auth.SID) { _auth = auth; auth = null; //_connection.WriteErrorAndClose(0x193); //return false; } } catch { try { _connection.WriteErrorAndClose(500); } // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { } return(false); } finally { if (auth != null) { auth.Dispose(); } } return(true); }