Package net.i2p.i2pcontrol
Class HostCheckHandler
-
- All Implemented Interfaces:
Handler
,HandlerContainer
,Container
,Destroyable
,Dumpable
,LifeCycle
public class HostCheckHandler extends HandlerWrapper
Block certain Host headers to prevent DNS rebinding attacks. This Handler wraps the ContextHandlerCollection, which handles all the webapps (not just routerconsole). Therefore, this protects all the webapps. This class is NOT used for the webapp or the bare ServerSocket implementation.- Since:
- 0.12 copied from routerconsole
-
-
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.server.handler.HandlerWrapper
_handler
-
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(I2PAppContext ctx)
MUST call setListenHosts() afterwards.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handle(String pathInContext, Request baseRequest, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
Block by Host header, pass everything else to the delegate.void
setListenHosts(Set<String> hosts)
Set the legal hosts.-
Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper
destroy, expandChildren, getHandler, getHandlers, insertHandler, setHandler
-
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandlerContainer
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass, setServer
-
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler
doStart, doStop, dumpThis, getServer
-
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 Detail
-
HostCheckHandler
public HostCheckHandler(I2PAppContext ctx)
MUST call setListenHosts() afterwards.
-
-
Method Detail
-
setListenHosts
public void setListenHosts(Set<String> hosts)
Set the legal hosts. Not synched. Call this BEFORE starting. If empty, all are allowed.- 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, ServletException
Block by Host header, pass everything else to the delegate.- Specified by:
handle
in interfaceHandler
- Overrides:
handle
in classHandlerWrapper
- Throws:
IOException
ServletException
-
-