Commit 31aa1db9 authored by Dave Cridland's avatar Dave Cridland

Merge pull request #231 from dwd/fix-everything

Fix filter ordering and admin console NPE
parents ba16b25a 40577476
...@@ -165,6 +165,7 @@ public class NIOConnection implements Connection { ...@@ -165,6 +165,7 @@ public class NIOConnection implements Connection {
public byte[] getAddress() throws UnknownHostException { public byte[] getAddress() throws UnknownHostException {
final SocketAddress remoteAddress = ioSession.getRemoteAddress(); final SocketAddress remoteAddress = ioSession.getRemoteAddress();
if (remoteAddress == null) throw new UnknownHostException();
final InetSocketAddress socketAddress = (InetSocketAddress) remoteAddress; final InetSocketAddress socketAddress = (InetSocketAddress) remoteAddress;
final InetAddress address = socketAddress.getAddress(); final InetAddress address = socketAddress.getAddress();
return address.getAddress(); return address.getAddress();
...@@ -172,6 +173,7 @@ public class NIOConnection implements Connection { ...@@ -172,6 +173,7 @@ public class NIOConnection implements Connection {
public String getHostAddress() throws UnknownHostException { public String getHostAddress() throws UnknownHostException {
final SocketAddress remoteAddress = ioSession.getRemoteAddress(); final SocketAddress remoteAddress = ioSession.getRemoteAddress();
if (remoteAddress == null) throw new UnknownHostException();
final InetSocketAddress socketAddress = (InetSocketAddress) remoteAddress; final InetSocketAddress socketAddress = (InetSocketAddress) remoteAddress;
final InetAddress inetAddress = socketAddress.getAddress(); final InetAddress inetAddress = socketAddress.getAddress();
return inetAddress.getHostAddress(); return inetAddress.getHostAddress();
...@@ -179,6 +181,7 @@ public class NIOConnection implements Connection { ...@@ -179,6 +181,7 @@ public class NIOConnection implements Connection {
public String getHostName() throws UnknownHostException { public String getHostName() throws UnknownHostException {
final SocketAddress remoteAddress = ioSession.getRemoteAddress(); final SocketAddress remoteAddress = ioSession.getRemoteAddress();
if (remoteAddress == null) throw new UnknownHostException();
final InetSocketAddress socketAddress = (InetSocketAddress) remoteAddress; final InetSocketAddress socketAddress = (InetSocketAddress) remoteAddress;
final InetAddress inetAddress = socketAddress.getAddress(); final InetAddress inetAddress = socketAddress.getAddress();
return inetAddress.getHostName(); return inetAddress.getHostName();
...@@ -446,7 +449,7 @@ public class NIOConnection implements Connection { ...@@ -446,7 +449,7 @@ public class NIOConnection implements Connection {
// good // good
filter.setWantClientAuth(true); filter.setWantClientAuth(true);
} }
ioSession.getFilterChain().addAfter(EXECUTOR_FILTER_NAME, TLS_FILTER_NAME, filter); ioSession.getFilterChain().addBefore(EXECUTOR_FILTER_NAME, TLS_FILTER_NAME, filter);
ioSession.setAttribute(SslFilter.DISABLE_ENCRYPTION_ONCE, Boolean.TRUE); ioSession.setAttribute(SslFilter.DISABLE_ENCRYPTION_ONCE, Boolean.TRUE);
if (!clientMode) { if (!clientMode) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment