public final class AnonProxyRequest
extends java.lang.Object
implements java.lang.Runnable
AnonChannel
, corresponding to the necessary protocol, to the
destination using the given AnonProxy
object.
This allows the request to be intercepted and processed, if necessary, before sending it to the destination over the channel. Similarly the response received over the channel to this object can be processed before relaying to the client over the client socket.
Modifier and Type | Class and Description |
---|---|
(package private) class |
AnonProxyRequest.Response
This object reads a response from an
AnonChannel and sends it to
the ProxyCallbackHandler for processing, before writing it to the
client socket given in the constructor of the AnonProxyRequest
owning this Response object. |
Modifier and Type | Field and Description |
---|---|
private static int |
CHUNK_SIZE |
private java.lang.String[] |
contentEncodings
Indicates that the JonDo has to perform the contentEncoding itself.
|
private boolean |
internalEncodingRequired |
private boolean |
m_bRequestIsAlive |
private boolean |
m_bShowBrowserWarning |
private ProxyCallbackHandler |
m_callbackHandler |
private AnonChannel |
m_Channel
The
AnonChannel connecting to the destination of the request. |
private SocketGuard |
m_clientSocket
The socket connected to the Browser sending the request.
|
private java.util.Hashtable |
m_hashParsedDomains |
private java.io.InputStream |
m_InChannel
InputStream from m_Channel . |
private java.io.InputStream |
m_InSocket
InputStream from m_clientSocket . |
private int |
m_iProtocol
The protocol the request is using, gathered from the first received byte
or lack thereof in the
run() method. |
private java.io.OutputStream |
m_OutChannel
OutputStream from m_Channel . |
private java.io.OutputStream |
m_OutSocket
OutputStream from m_clientSocket . |
private AnonProxy |
m_Proxy |
private java.lang.Object |
m_syncObject
Used when
m_Proxy needs to reconnect, blocking all other
instances using the same sync object. |
private java.lang.Thread |
m_threadRequest |
private java.lang.Thread |
m_threadResponse |
private static int |
ms_currentRequest
Continuing count of processed requests.
|
private static int |
ms_nrOfRequests
Number of requests currently being processed.
|
private static long |
TIMEOUT_RECONNECT |
Constructor and Description |
---|
AnonProxyRequest(AnonProxy proxy,
SocketGuard clientSocket,
java.lang.Object a_syncObject,
ProxyCallbackHandler callbackHandler)
Creates an
AnonProxyRequest object and starts it in a Thread,
listening for a request to come through the given client socket. |
Modifier and Type | Method and Description |
---|---|
private void |
closeRequest() |
int |
getAnonymityDistribution()
Get the anonymity distribution of the mix cascade used by the underlying
proxy server.
|
protected java.lang.String[] |
getContentEncodings() |
static int |
getNrOfRequests() |
boolean |
isBrowserWarningShown() |
boolean |
isInternalEncodingRequired() |
protected boolean |
isProxyKeepAliveEnabled() |
void |
run()
Reads first byte from the given client socket to recognize the kind of
request.
|
private static void |
sendRemainingBytesRecursion(ProxyCallbackBuffer pcBuffer,
int sentBytes,
java.io.OutputStream outputStream) |
protected void |
setContentEncodings(java.lang.String[] contentEncodings) |
protected void |
setHttpParsed(java.lang.String a_strDomain) |
protected void |
setInternalEncodingRequired(boolean internalEncodingRequired) |
void |
showBrowserWarning(boolean a_bShow) |
private static int ms_nrOfRequests
private static final long TIMEOUT_RECONNECT
private static final int CHUNK_SIZE
private static int ms_currentRequest
private AnonChannel m_Channel
AnonChannel
connecting to the destination of the request.private java.io.InputStream m_InChannel
InputStream
from m_Channel
.
Used in the AnonProxyRequest.Response
object to read the response to this request.private java.io.OutputStream m_OutChannel
private SocketGuard m_clientSocket
private java.io.InputStream m_InSocket
InputStream
from m_clientSocket
.
Used to read in the request.private java.io.OutputStream m_OutSocket
OutputStream
from m_clientSocket
.
Used to write the received response to the client, after processing.private java.lang.Thread m_threadResponse
private java.lang.Thread m_threadRequest
private java.util.Hashtable m_hashParsedDomains
private boolean m_bShowBrowserWarning
private AnonProxy m_Proxy
private volatile boolean m_bRequestIsAlive
private int m_iProtocol
run()
method.private final java.lang.Object m_syncObject
m_Proxy
needs to reconnect, blocking all other
instances using the same sync object.private ProxyCallbackHandler m_callbackHandler
private java.lang.String[] contentEncodings
private boolean internalEncodingRequired
AnonProxyRequest(AnonProxy proxy, SocketGuard clientSocket, java.lang.Object a_syncObject, ProxyCallbackHandler callbackHandler) throws java.io.IOException
AnonProxyRequest
object and starts it in a Thread,
listening for a request to come through the given client socket.proxy
- The proxy to communicate over.clientSocket
- The socket to communicate with the browser with.a_syncObject
- Used when the given proxy needs to reconnect to block
all other requests, using that proxy. Implies a connection between the
proxy and this sync object.callbackHandler
- Contains ProxyCallback
objects, that have
the option to process the request and response bytes, before they're sent
out to the destination or client respectively.java.io.IOException
run()
public int getAnonymityDistribution()
MixCascade.getDistribution()
public static int getNrOfRequests()
ms_nrOfRequests
public void run()
After that a corresponding AnonChannel
to the destination of the
request is created to listen for a AnonProxyRequest.Response
on.
Read the request in chunks and send the chunks to a ProxyCallbackHandler
for intermittent processing, before sending it to
the destination using the AnonChannel
created earlier.
run
in interface java.lang.Runnable
AnonProxyRequest.Response
private static void sendRemainingBytesRecursion(ProxyCallbackBuffer pcBuffer, int sentBytes, java.io.OutputStream outputStream) throws java.io.IOException
java.io.IOException
private void closeRequest()
protected void setHttpParsed(java.lang.String a_strDomain)
protected boolean isProxyKeepAliveEnabled()
public boolean isInternalEncodingRequired()
public void showBrowserWarning(boolean a_bShow)
public boolean isBrowserWarningShown()
protected void setInternalEncodingRequired(boolean internalEncodingRequired)
protected java.lang.String[] getContentEncodings()
protected void setContentEncodings(java.lang.String[] contentEncodings)
Copyright © 2023. All rights reserved.