#3147: HAProxyMessage.sourceAddress() can be null

.sourceAddress() is null when send-proxy-v2 & check option is used
This commit is contained in:
Adrian Antkowiak 2021-07-11 01:06:51 +02:00 committed by GitHub
parent c866619f56
commit 5db276eb52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,6 +82,8 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
{ {
HAProxyMessage proxy = (HAProxyMessage) msg; HAProxyMessage proxy = (HAProxyMessage) msg;
try try
{
if ( proxy.sourceAddress() != null )
{ {
InetSocketAddress newAddress = new InetSocketAddress( proxy.sourceAddress(), proxy.sourcePort() ); InetSocketAddress newAddress = new InetSocketAddress( proxy.sourceAddress(), proxy.sourcePort() );
@ -91,6 +93,7 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
} ); } );
channel.setRemoteAddress( newAddress ); channel.setRemoteAddress( newAddress );
}
} finally } finally
{ {
proxy.release(); proxy.release();