[Modify] Polish them
This commit is contained in:
parent
1af3b26cb9
commit
c0398c5bc1
@ -438,14 +438,6 @@ namespace WebSocketSharp.Net.WebSockets
|
||||
Func<IIdentity, NetworkCredential> credentialsFinder
|
||||
)
|
||||
{
|
||||
if (scheme == AuthenticationSchemes.Anonymous)
|
||||
return true;
|
||||
|
||||
if (scheme == AuthenticationSchemes.None) {
|
||||
Close (HttpStatusCode.Forbidden);
|
||||
return false;
|
||||
}
|
||||
|
||||
var chal = new AuthenticationChallenge (scheme, realm).ToString ();
|
||||
|
||||
var retry = -1;
|
||||
@ -453,10 +445,8 @@ namespace WebSocketSharp.Net.WebSockets
|
||||
auth =
|
||||
() => {
|
||||
retry++;
|
||||
if (retry > 99) {
|
||||
Close (HttpStatusCode.Forbidden);
|
||||
if (retry > 99)
|
||||
return false;
|
||||
}
|
||||
|
||||
var user = HttpUtility.CreateUser (
|
||||
_request.Headers["Authorization"],
|
||||
|
@ -806,6 +806,11 @@ namespace WebSocketSharp.Server
|
||||
|
||||
private void processRequest (TcpListenerWebSocketContext context)
|
||||
{
|
||||
if (!authenticateClient (context)) {
|
||||
context.Close (HttpStatusCode.Forbidden);
|
||||
return;
|
||||
}
|
||||
|
||||
var uri = context.RequestUri;
|
||||
if (uri == null) {
|
||||
context.Close (HttpStatusCode.BadRequest);
|
||||
@ -846,9 +851,6 @@ namespace WebSocketSharp.Server
|
||||
cl, null, _secure, _sslConfigInUse, _log
|
||||
);
|
||||
|
||||
if (!ctx.Authenticate (_authSchemes, _realmInUse, _userCredFinder))
|
||||
return;
|
||||
|
||||
processRequest (ctx);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user