public class SeleniumProxyHandler extends AbstractHttpHandler
Modifier and Type | Class and Description |
---|---|
static class |
SeleniumProxyHandler.SslRelay |
Modifier and Type | Field and Description |
---|---|
protected HashSet<Integer> |
_allowedConnectPorts
Set of allowed CONNECT ports.
|
protected StringMap |
_DontProxyHeaders
Map of leg by leg headers (not end to end).
|
protected StringMap |
_ProxyAuthHeaders
Map of leg by leg headers (not end to end).
|
protected Set<String> |
_proxyHostsBlackList |
protected Set<String> |
_proxyHostsWhiteList |
protected StringMap |
_ProxySchemes
Map of allows schemes to proxy Should be a set, but more efficient string map is used
instead.
|
protected int |
_tunnelTimeoutMs |
Constructor and Description |
---|
SeleniumProxyHandler(boolean trustAllSSLCertificates,
String dontInjectRegex,
String debugURL,
boolean proxyInjectionMode,
boolean forceProxyChain) |
Modifier and Type | Method and Description |
---|---|
void |
cleanSslWithCyberVilliansCA() |
protected void |
customizeConnection(String pathInContext,
String pathParams,
HttpRequest request,
Socket socket)
Customize proxy Socket connection for CONNECT.
|
protected void |
customizeConnection(String pathInContext,
String pathParams,
HttpRequest request,
URLConnection connection)
Customize proxy URL connection.
|
protected SeleniumProxyHandler.SslRelay |
getSslRelayOrCreateNew(URI uri,
InetAddrPort addrPort,
HttpServer server) |
int |
getTunnelTimeoutMs() |
void |
handle(String pathInContext,
String pathParams,
HttpRequest request,
HttpResponse response)
Handle a request.
|
void |
handleConnect(String pathInContext,
String pathParams,
HttpRequest request,
HttpResponse response) |
boolean |
isAnonymous() |
protected boolean |
isForbidden(String scheme,
String host,
int port,
boolean openNonPrivPorts)
Is scheme,host & port Forbidden.
|
protected boolean |
isForbidden(URI uri)
Is URL Forbidden.
|
protected URL |
isProxied(URI uri)
Is URL Proxied.
|
protected HttpTunnel |
newHttpTunnel(HttpRequest request,
HttpResponse response,
InetAddress iaddr,
int port,
int timeoutMS) |
protected long |
proxyPlainTextRequest(URL url,
String pathInContext,
String pathParams,
HttpRequest request,
HttpResponse response) |
protected void |
sendForbid(HttpRequest request,
HttpResponse response,
URI uri)
Send Forbidden.
|
protected void |
sendNotFound(HttpResponse response)
Send not found.
|
void |
setAnonymous(boolean anonymous) |
void |
setShutdownLock(Object shutdownLock) |
void |
setSslKeystorePath(String sslKeystorePath) |
void |
setTunnelTimeoutMs(int ms)
Tunnel timeout.
|
void |
start()
Start the LifeCycle.
|
protected void |
wireUpSslWithImpersonationCA(String host,
SeleniumProxyHandler.SslRelay listener) |
protected void |
wireUpSslWithRemoteService(String host,
SeleniumProxyHandler.SslRelay listener) |
getHttpContext, getName, handleTrace, initialize, isStarted, setName, stop, toString
protected int _tunnelTimeoutMs
protected StringMap _DontProxyHeaders
protected StringMap _ProxyAuthHeaders
protected StringMap _ProxySchemes
public void start() throws Exception
LifeCycle
start
in interface LifeCycle
start
in class AbstractHttpHandler
Exception
- An arbitrary exception may be thrown.public int getTunnelTimeoutMs()
public void setTunnelTimeoutMs(int ms)
public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException
HttpHandler
pathInContext
- The context pathpathParams
- Path parameters such as encoded Session IDrequest
- The HttpRequest requestresponse
- The HttpResponse responseHttpException
IOException
protected long proxyPlainTextRequest(URL url, String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws IOException
IOException
public void handleConnect(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException
HttpException
IOException
protected SeleniumProxyHandler.SslRelay getSslRelayOrCreateNew(URI uri, InetAddrPort addrPort, HttpServer server) throws Exception
Exception
protected void wireUpSslWithRemoteService(String host, SeleniumProxyHandler.SslRelay listener) throws IOException
IOException
protected void wireUpSslWithImpersonationCA(String host, SeleniumProxyHandler.SslRelay listener)
public void cleanSslWithCyberVilliansCA()
protected HttpTunnel newHttpTunnel(HttpRequest request, HttpResponse response, InetAddress iaddr, int port, int timeoutMS) throws IOException
IOException
protected void customizeConnection(String pathInContext, String pathParams, HttpRequest request, Socket socket)
protected void customizeConnection(String pathInContext, String pathParams, HttpRequest request, URLConnection connection)
protected URL isProxied(URI uri) throws MalformedURLException
uri
- The requested URI, which should include a scheme, host and port.MalformedURLException
protected boolean isForbidden(URI uri)
protected boolean isForbidden(String scheme, String host, int port, boolean openNonPrivPorts)
scheme
- A scheme that mast be in the proxySchemes StringMap.host
- A host that must pass the white and black listsport
- A port that must in the allowedConnectPorts SetopenNonPrivPorts
- If true ports greater than 1024 are allowed.protected void sendForbid(HttpRequest request, HttpResponse response, URI uri) throws IOException
IOException
protected void sendNotFound(HttpResponse response) throws IOException
IOException
public boolean isAnonymous()
public void setAnonymous(boolean anonymous)
anonymous
- The anonymous to set.public void setSslKeystorePath(String sslKeystorePath)
public void setShutdownLock(Object shutdownLock)
Copyright © 2016. All Rights Reserved.