From bfbc42097ec3de856ea898a5ca4ba6669387da67 Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 23 Jan 2019 21:21:41 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/HttpUtility.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/websocket-sharp/Net/HttpUtility.cs b/websocket-sharp/Net/HttpUtility.cs index 817ef568..bebdb7b7 100644 --- a/websocket-sharp/Net/HttpUtility.cs +++ b/websocket-sharp/Net/HttpUtility.cs @@ -801,16 +801,16 @@ namespace WebSocketSharp.Net if (cred == null) return null; - if (scheme == AuthenticationSchemes.Basic - && ((HttpBasicIdentity) id).Password != cred.Password - ) { - return null; + if (scheme == AuthenticationSchemes.Basic) { + var basicId = (HttpBasicIdentity) id; + if (basicId.Password != cred.Password) + return null; } - if (scheme == AuthenticationSchemes.Digest - && !((HttpDigestIdentity) id).IsValid (cred.Password, realm, method, null) - ) { - return null; + if (scheme == AuthenticationSchemes.Digest) { + var digestId = (HttpDigestIdentity) id; + if (!digestId.IsValid (cred.Password, realm, method, null)) + return null; } return new GenericPrincipal (id, cred.Roles);