handshake failure fix
This commit is contained in:
parent
33001803e6
commit
e129fbd077
@ -250,6 +250,8 @@ namespace DiIiS_NA.LoginServer.Base
|
|||||||
}
|
}
|
||||||
internal class WebSocketServerProtocolHandshakeHandler : ChannelHandlerAdapter
|
internal class WebSocketServerProtocolHandshakeHandler : ChannelHandlerAdapter
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static readonly Logger _logger = LogManager.CreateLogger();
|
||||||
private readonly string websocketPath;
|
private readonly string websocketPath;
|
||||||
|
|
||||||
private readonly string subprotocols;
|
private readonly string subprotocols;
|
||||||
@ -290,12 +292,16 @@ namespace DiIiS_NA.LoginServer.Base
|
|||||||
{
|
{
|
||||||
if (!object.Equals(req.Method, HttpMethod.Get))
|
if (!object.Equals(req.Method, HttpMethod.Get))
|
||||||
{
|
{
|
||||||
SendHttpResponse(ctx, req, new DefaultFullHttpResponse(HttpVersion.Http11, HttpResponseStatus.Forbidden));
|
SendHttpResponse(ctx, req,
|
||||||
|
new DefaultFullHttpResponse(HttpVersion.Http11, HttpResponseStatus.Forbidden));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//v1.rpc.battle.net
|
//v1.rpc.battle.net
|
||||||
//
|
//
|
||||||
WebSocketServerHandshakerFactory webSocketServerHandshakerFactory = new WebSocketServerHandshakerFactory(GetWebSocketLocation(ctx.Channel.Pipeline, req, websocketPath), subprotocols, allowExtensions, maxFramePayloadSize, allowMaskMismatch);
|
WebSocketServerHandshakerFactory webSocketServerHandshakerFactory =
|
||||||
|
new WebSocketServerHandshakerFactory(GetWebSocketLocation(ctx.Channel.Pipeline, req, websocketPath),
|
||||||
|
subprotocols, allowExtensions, maxFramePayloadSize, allowMaskMismatch);
|
||||||
WebSocketServerHandshaker handshaker = webSocketServerHandshakerFactory.NewHandshaker(req);
|
WebSocketServerHandshaker handshaker = webSocketServerHandshakerFactory.NewHandshaker(req);
|
||||||
if (handshaker == null)
|
if (handshaker == null)
|
||||||
{
|
{
|
||||||
@ -303,7 +309,7 @@ namespace DiIiS_NA.LoginServer.Base
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handshaker.HandshakeAsync(ctx.Channel, req).ContinueWith(delegate (Task t)
|
handshaker.HandshakeAsync(ctx.Channel, req).ContinueWith(delegate(Task t)
|
||||||
{
|
{
|
||||||
if (t.Status != TaskStatus.RanToCompletion)
|
if (t.Status != TaskStatus.RanToCompletion)
|
||||||
{
|
{
|
||||||
@ -311,12 +317,17 @@ namespace DiIiS_NA.LoginServer.Base
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ctx.FireUserEventTriggered(new HandshakeHandler.HandshakeComplete(req.Uri, req.Headers, handshaker.SelectedSubprotocol));
|
ctx.FireUserEventTriggered(new HandshakeHandler.HandshakeComplete(req.Uri, req.Headers,
|
||||||
|
handshaker.SelectedSubprotocol));
|
||||||
}
|
}
|
||||||
}, TaskContinuationOptions.ExecuteSynchronously);
|
}, TaskContinuationOptions.ExecuteSynchronously);
|
||||||
HandshakeHandler.SetHandshaker(ctx.Channel, handshaker);
|
HandshakeHandler.SetHandshaker(ctx.Channel, handshaker);
|
||||||
ctx.Channel.Pipeline.Replace(this, "WS403Responder", HandshakeHandler.ForbiddenHttpRequestResponder());
|
ctx.Channel.Pipeline.Replace(this, "WS403Responder", HandshakeHandler.ForbiddenHttpRequestResponder());
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException(ex, "Handshake failure");
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
req.Release();
|
req.Release();
|
||||||
|
|||||||
Loading…
Reference in New Issue
user.block.title