Package org.klomp.snark.standalone
Class HostCheckHandler
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.server.handler.AbstractHandler
org.klomp.snark.standalone.HostCheckHandler
- All Implemented Interfaces:
Handler
,Container
,Destroyable
,Dumpable
,LifeCycle
public class HostCheckHandler extends AbstractHandler
Block certain Host headers to prevent DNS rebinding attacks.
Unlike in the console, this is an AbstractHandler, not a HandlerWrapper.
- Since:
- 0.9.34 adapted from router console
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING
-
Constructor Summary
Constructors Constructor Description HostCheckHandler()
HostCheckHandler(I2PAppContext ctx)
-
Method Summary
Modifier and Type Method Description void
handle(String pathInContext, Request baseRequest, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
Block by Host header, redirect HTTP to HTTPS, pass everything else to the delegate.void
setListenHosts(Set<String> hosts)
Unused, we can't get here from RunStandaloneMethods inherited from class org.eclipse.jetty.server.handler.AbstractHandler
destroy, doStart, doStop, dumpThis, getServer, setServer
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
Constructor Details
-
HostCheckHandler
public HostCheckHandler() -
HostCheckHandler
-
-
Method Details
-
setListenHosts
Unused, we can't get here from RunStandalone- Parameters:
hosts
- contains hostnames or IPs. But we allow all IPs anyway.
-
handle
public void handle(String pathInContext, Request baseRequest, HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException, ServletExceptionBlock by Host header, redirect HTTP to HTTPS, pass everything else to the delegate.- Throws:
IOException
ServletException
-