From dae96ac18bad9734177060942f6826d58ec2ecce Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 22 Jan 2014 12:09:29 +1100 Subject: [PATCH] Close #819 - remove trailing . from hostname if it exists --- .../java/net/md_5/bungee/connection/InitialHandler.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index ff288c5d..752f807a 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -198,6 +198,13 @@ public class InitialHandler extends PacketHandler implements PendingConnection { Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" ); this.handshake = handshake; + + // SRV records can end with a . depending on DNS / client. + if ( handshake.getHost().endsWith( "." ) ) + { + handshake.setHost( handshake.getHost().substring( 0, handshake.getHost().length() - 1 ) ); + } + this.vHost = new InetSocketAddress( handshake.getHost(), handshake.getPort() ); bungee.getLogger().log( Level.INFO, "{0} has connected", this );