mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Исправление порядка NettyIpForwardHandler
This commit is contained in:
parent
77566cbd30
commit
09cae122d1
2 changed files with 4 additions and 3 deletions
|
@ -44,10 +44,10 @@ public void initChannel(NioSocketChannel ch) {
|
|||
//p.addLast(new LoggingHandler(LogLevel.INFO));
|
||||
pipeline.addLast(new HttpServerCodec());
|
||||
pipeline.addLast(new HttpObjectAggregator(65536));
|
||||
if (LaunchServer.server.config.netty.ipForwarding) pipeline.addLast(new NettyIpForwardHandler(context));
|
||||
pipeline.addLast(new WebSocketServerCompressionHandler());
|
||||
pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
|
||||
if (LaunchServer.server.config.netty.fileServerEnabled) pipeline.addLast(new FileServerHandler(LaunchServer.server.updatesDir, true));
|
||||
if (LaunchServer.server.config.netty.ipForwarding) pipeline.addLast(new NettyIpForwardHandler(context));
|
||||
pipeline.addLast(new WebSocketFrameHandler(context));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
import io.netty.handler.codec.http.DefaultHttpRequest;
|
||||
import io.netty.handler.codec.http.HttpHeaders;
|
||||
import io.netty.handler.codec.http.HttpRequest;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
public class NettyIpForwardHandler extends ChannelInboundHandlerAdapter {
|
||||
|
@ -19,9 +20,9 @@ public NettyIpForwardHandler(NettyConnectContext context) {
|
|||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
//super.channelRead(ctx, msg);
|
||||
if(context.ip != null) return;
|
||||
if(msg instanceof DefaultHttpRequest)
|
||||
if(msg instanceof HttpRequest)
|
||||
{
|
||||
DefaultHttpRequest http = (DefaultHttpRequest) msg;
|
||||
HttpRequest http = (HttpRequest) msg;
|
||||
HttpHeaders headers = http.headers();
|
||||
String realIP = null;
|
||||
if(headers.contains("X-Forwarded-For"))
|
||||
|
|
Loading…
Reference in a new issue