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
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.AbstractLifeCycleListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.ListenerNested 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(String pathInContext, Request baseRequest, HttpServletRequest httpRequest, HttpServletResponse httpResponse) Block by Host header, redirect HTTP to HTTPS, pass everything else to the delegate.voidsetListenHosts(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, setServerMethods 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, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, ServletException Block by Host header, redirect HTTP to HTTPS, pass everything else to the delegate.- Throws:
IOExceptionServletException
-