Package net.i2p.i2ptunnel
Class I2PTunnelHTTPClientRunner
java.lang.Object
java.lang.Thread
net.i2p.util.I2PThread
net.i2p.util.I2PAppThread
net.i2p.i2ptunnel.I2PTunnelRunner
net.i2p.i2ptunnel.I2PTunnelHTTPClientRunner
- All Implemented Interfaces:
Runnable
,I2PSocket.SocketErrorListener
,LimitOutputStream.DoneCallback
Override the response with a stream filtering the HTTP headers
received. Specifically, this makes sure we get Connection: close,
so the browser knows they really shouldn't try to use persistent
connections. The HTTP server *should* already be setting this,
since the HTTP headers sent by the browser specify Connection: close,
and the server should echo it. However, both broken and malicious
servers could ignore that, potentially confusing the user.
Warning - not maintained as a stable API for external use.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.i2p.i2ptunnel.I2PTunnelRunner
I2PTunnelRunner.FailCallback, I2PTunnelRunner.SuccessCallback
Nested classes/interfaces inherited from class net.i2p.util.I2PThread
I2PThread.OOMEventListener
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class net.i2p.i2ptunnel.I2PTunnelRunner
_keepAliveI2P, _keepAliveSocket, _log, MAX_PACKET_SIZE, NETWORK_BUFFER_SIZE
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorDescriptionI2PTunnelHTTPClientRunner
(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail) Deprecated.use other constructorI2PTunnelHTTPClientRunner
(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail, boolean allowKeepAliveI2P, boolean allowKeepAliveSocket, boolean isHead) Does NOT start itself. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
close
(OutputStream out, InputStream in, OutputStream i2pout, InputStream i2pin, Socket s, I2PSocket i2ps, Thread t1, Thread t2) May not actually close either socket, depending on keepalive settings.(package private) boolean
Should we keep the I2P socket open when done?(package private) boolean
Should we keep the local browser socket open when done?protected OutputStream
Only call once!Methods inherited from class net.i2p.i2ptunnel.I2PTunnelRunner
errorOccurred, getLastActivityOn, getSocketIn, getStartedOn, isFinished, run, setSuccessCallback, streamDone
Methods inherited from class net.i2p.util.I2PAppThread
addOOMEventThreadListener, fireOOM, removeOOMEventThreadListener
Methods inherited from class net.i2p.util.I2PThread
addOOMEventListener, removeOOMEventListener, start
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, startVirtualThread, stop, suspend, threadId, toString, yield
-
Constructor Details
-
I2PTunnelHTTPClientRunner
@Deprecated public I2PTunnelHTTPClientRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail) Deprecated.use other constructorDoes NOT start itself. Caller must call start(). -
I2PTunnelHTTPClientRunner
public I2PTunnelHTTPClientRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail, boolean allowKeepAliveI2P, boolean allowKeepAliveSocket, boolean isHead) Does NOT start itself. Caller must call start().- Parameters:
allowKeepAliveI2P
- we may, but are not required to, keep the I2P socket alive - Requires allowKeepAliveSocketallowKeepAliveSocket
- we may, but are not required to, keep the browser-side socket alive NO data will be forwarded from the socket to the i2psocket other than initialI2PData if this is true.isHead
- is this a response to a HEAD, and thus no data is expected (RFC 2616 sec. 4.4)- Since:
- 0.9.62
-
-
Method Details
-
getSocketOut
Only call once!- Overrides:
getSocketOut
in classI2PTunnelRunner
- Returns:
- an HTTPResponseOutputStream
- Throws:
IllegalStateException
- if called againIOException
-
getKeepAliveSocket
boolean getKeepAliveSocket()Should we keep the local browser socket open when done?- Overrides:
getKeepAliveSocket
in classI2PTunnelRunner
- Since:
- 0.9.62
-
getKeepAliveI2P
boolean getKeepAliveI2P()Should we keep the I2P socket open when done?- Overrides:
getKeepAliveI2P
in classI2PTunnelRunner
- Since:
- 0.9.62
-
close
protected void close(OutputStream out, InputStream in, OutputStream i2pout, InputStream i2pin, Socket s, I2PSocket i2ps, Thread t1, Thread t2) throws InterruptedException May not actually close either socket, depending on keepalive settings.- Overrides:
close
in classI2PTunnelRunner
- Parameters:
out
- may be nullin
- may be nulli2pout
- may be nulli2pin
- may be nulls
- non-nulli2ps
- non-nullt1
- may be nullt2
- may be null, ignored, we only join t1- Throws:
InterruptedException
-