geforkt von Mirrors/Velocity
Clean up FML/handshake stuff from virtual host.
Dieser Commit ist enthalten in:
Ursprung
2f0ba42fa0
Commit
33f333d8cc
@ -61,7 +61,7 @@ public class HandshakeSessionHandler implements MinecraftSessionHandler {
|
||||
|
||||
@Override
|
||||
public boolean handle(Handshake handshake) {
|
||||
InitialInboundConnection ic = new InitialInboundConnection(connection, handshake);
|
||||
InitialInboundConnection ic = new InitialInboundConnection(connection, cleanVhost(handshake.getServerAddress()), handshake);
|
||||
switch (handshake.getNextStatus()) {
|
||||
case StateRegistry.STATUS_ID:
|
||||
connection.setState(StateRegistry.STATUS);
|
||||
@ -109,6 +109,11 @@ public class HandshakeSessionHandler implements MinecraftSessionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private String cleanVhost(String hostname) {
|
||||
int zeroIdx = hostname.indexOf('\0');
|
||||
return zeroIdx == -1 ? hostname : hostname.substring(0, zeroIdx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleGeneric(MinecraftPacket packet) {
|
||||
|
||||
|
@ -9,10 +9,12 @@ import java.util.Optional;
|
||||
|
||||
class InitialInboundConnection implements InboundConnection {
|
||||
private final MinecraftConnection connection;
|
||||
private final String cleanedAddress;
|
||||
private final Handshake handshake;
|
||||
|
||||
InitialInboundConnection(MinecraftConnection connection, Handshake handshake) {
|
||||
InitialInboundConnection(MinecraftConnection connection, String cleanedAddress, Handshake handshake) {
|
||||
this.connection = connection;
|
||||
this.cleanedAddress = cleanedAddress;
|
||||
this.handshake = handshake;
|
||||
}
|
||||
|
||||
@ -23,7 +25,7 @@ class InitialInboundConnection implements InboundConnection {
|
||||
|
||||
@Override
|
||||
public Optional<InetSocketAddress> getVirtualHost() {
|
||||
return Optional.of(InetSocketAddress.createUnresolved(handshake.getServerAddress(), handshake.getPort()));
|
||||
return Optional.of(InetSocketAddress.createUnresolved(cleanedAddress, handshake.getPort()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren