public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implements Runnable
Modifier and Type | Class and Description |
---|---|
protected static class |
I2PTunnelHTTPClientBase.AuthResult |
protected class |
I2PTunnelHTTPClientBase.OnTimeout |
Modifier and Type | Field and Description |
---|---|
protected static AtomicLong |
__requestId |
protected List<String> |
_proxyList |
static String |
BASIC_AUTH |
protected static int |
DEFAULT_READ_TIMEOUT |
static String |
DIGEST_AUTH |
protected static String |
ERR_DESTINATION_UNKNOWN |
protected static String |
ERR_NO_OUTPROXY |
static String |
PROP_AUTH
all auth @since 0.8.2
|
static String |
PROP_OUTPROXY_AUTH |
static String |
PROP_OUTPROXY_PW |
static String |
PROP_OUTPROXY_PW_PREFIX |
static String |
PROP_OUTPROXY_USER |
static String |
PROP_OUTPROXY_USER_PREFIX
passwords for specific outproxies may be added with outproxyUsername.fooproxy.i2p=user and outproxyPassword.fooproxy.i2p=pw
|
static String |
PROP_PROXY_DIGEST_PREFIX
new style MD5 auth
|
static String |
PROP_PROXY_DIGEST_SUFFIX |
static String |
PROP_PW |
static String |
PROP_PW_PREFIX
additional users may be added with proxyPassword.user=pw
|
static String |
PROP_USE_OUTPROXY_PLUGIN |
static String |
PROP_USER |
protected static String |
SUCCESS_RESPONSE |
_clientId, _context, _log, _ownDest, DEFAULT_CONNECT_TIMEOUT, dest, l, listenerReady, mySockets, PROP_USE_SSL, sockLock, sockMgr, ss
open
Constructor and Description |
---|
I2PTunnelHTTPClientBase(int localPort,
boolean ownDest,
Logging l,
EventDispatcher notifyThis,
String handlerName,
I2PTunnel tunnel) |
I2PTunnelHTTPClientBase(int localPort,
Logging l,
I2PSocketManager sktMgr,
I2PTunnel tunnel,
EventDispatcher notifyThis,
long clientId)
This constructor always starts the tunnel (ignoring the i2cp.delayOpen option).
|
Modifier and Type | Method and Description |
---|---|
protected String |
_t(String key)
Translate
|
protected String |
_t(String key,
Object o)
Translate
{0}
|
protected String |
_t(String key,
Object o,
Object o2)
Translate
{0} and {1}
|
protected I2PTunnelHTTPClientBase.AuthResult |
authorize(Socket s,
long requestId,
String method,
String authorization)
Authorization
Ref: RFC 2617
If the socket is an InternalSocket, no auth required.
|
protected String |
getAuthError(boolean isStale)
What to send if digest auth fails
|
protected static String |
getErrorPage(I2PAppContext ctx,
String base,
String backup)
foo => errordir/foo-header_xx.ht for lang xx, or errordir/foo-header.ht,
or the backup byte array on fail.
|
protected String |
getErrorPage(String base,
String backup)
foo => errordir/foo-header_xx.ht for lang xx, or errordir/foo-header.ht,
or the backup byte array on fail.
|
protected String |
getPrefix(long requestId) |
protected abstract String |
getRealm() |
protected void |
handleClientException(Exception ex,
OutputStream out,
String targetRequest,
boolean usingWWWProxy,
String wwwProxy,
long requestId) |
protected void |
handleI2PSocketException(I2PSocketException ise,
OutputStream out,
String targetRequest,
boolean usingWWWProxy,
String wwwProxy)
Generate an error page based on the status code
in our custom exception.
|
protected boolean |
isDigestAuthRequired() |
void |
optionsUpdated(I2PTunnel tunnel)
Update the outproxy list then call super.
|
protected String |
selectProxy() |
protected void |
writeErrorMessage(String errMessage,
OutputStream out,
String targetRequest,
boolean usingWWWProxy,
String wwwProxy)
No jump servers or extra message
|
protected void |
writeErrorMessage(String errMessage,
OutputStream out,
String targetRequest,
boolean usingWWWProxy,
String wwwProxy,
String jumpServers)
No extra message
|
protected void |
writeErrorMessage(String errMessage,
String extraMessage,
OutputStream out,
String targetRequest,
boolean usingWWWProxy,
String wwwProxy)
No jump servers
|
protected void |
writeErrorMessage(String errMessage,
String extraMessage,
OutputStream outs,
String targetRequest,
boolean usingWWWProxy,
String wwwProxy,
String jumpServers) |
static void |
writeFooter(OutputStream out)
Flushes.
|
static void |
writeFooter(Writer out)
Flushes.
|
addSubsession, buildSocketManager, buildSocketManager, buildSocketManager, buildSocketManager, clientConnectionRun, close, closeSocket, createI2PSocket, createI2PSocket, createI2PSocket, destroy, getDefaultOptions, getDefaultOptions, getListenHost, getLocalPort, getSocketManager, getSocketManager, getSocketManager, killSharedClient, manageConnection, run, startRunning, verifySocketManager
connected, disconnected, errorOccurred, getId, getTunnel, isOpen, reportAbuse, routerDisconnected, setId, setName, setTunnel, toString
attachEventDispatcher, detachEventDispatcher, getEventDispatcher, getEvents, getEventValue, ignoreEvents, notifyEvent, unIgnoreEvents, waitEventValue
public static final String PROP_USE_OUTPROXY_PLUGIN
protected static final String ERR_NO_OUTPROXY
protected static final String ERR_DESTINATION_UNKNOWN
protected static final String SUCCESS_RESPONSE
protected static final int DEFAULT_READ_TIMEOUT
protected static final AtomicLong __requestId
public static final String PROP_AUTH
public static final String PROP_USER
public static final String PROP_PW
public static final String PROP_PW_PREFIX
public static final String PROP_OUTPROXY_AUTH
public static final String PROP_OUTPROXY_USER
public static final String PROP_OUTPROXY_PW
public static final String PROP_OUTPROXY_USER_PREFIX
public static final String PROP_OUTPROXY_PW_PREFIX
public static final String PROP_PROXY_DIGEST_PREFIX
public static final String PROP_PROXY_DIGEST_SUFFIX
public static final String BASIC_AUTH
public static final String DIGEST_AUTH
public I2PTunnelHTTPClientBase(int localPort, boolean ownDest, Logging l, EventDispatcher notifyThis, String handlerName, I2PTunnel tunnel) throws IllegalArgumentException
IllegalArgumentException
public I2PTunnelHTTPClientBase(int localPort, Logging l, I2PSocketManager sktMgr, I2PTunnel tunnel, EventDispatcher notifyThis, long clientId) throws IllegalArgumentException
sktMgr
- the existing socket managerIllegalArgumentException
protected String getPrefix(long requestId)
protected String selectProxy()
protected abstract String getRealm()
public void optionsUpdated(I2PTunnel tunnel)
optionsUpdated
in class I2PTunnelClientBase
protected boolean isDigestAuthRequired()
protected I2PTunnelHTTPClientBase.AuthResult authorize(Socket s, long requestId, String method, String authorization)
method
- GET, POST, etc.authorization
- may be null, the full auth line e.g. "Basic lskjlksjf"protected String getAuthError(boolean isStale)
protected String getErrorPage(String base, String backup)
protected static String getErrorPage(I2PAppContext ctx, String base, String backup)
protected void handleClientException(Exception ex, OutputStream out, String targetRequest, boolean usingWWWProxy, String wwwProxy, long requestId)
ex
- may be nullprotected void handleI2PSocketException(I2PSocketException ise, OutputStream out, String targetRequest, boolean usingWWWProxy, String wwwProxy)
ise
- may be nullprotected void writeErrorMessage(String errMessage, OutputStream out, String targetRequest, boolean usingWWWProxy, String wwwProxy) throws IOException
IOException
protected void writeErrorMessage(String errMessage, OutputStream out, String targetRequest, boolean usingWWWProxy, String wwwProxy, String jumpServers) throws IOException
jumpServers
- comma- or space-separated list, or nullIOException
protected void writeErrorMessage(String errMessage, String extraMessage, OutputStream out, String targetRequest, boolean usingWWWProxy, String wwwProxy) throws IOException
extraMessage
- extra message or null, will be HTML-escapedIOException
protected void writeErrorMessage(String errMessage, String extraMessage, OutputStream outs, String targetRequest, boolean usingWWWProxy, String wwwProxy, String jumpServers) throws IOException
jumpServers
- comma- or space-separated list, or nullextraMessage
- extra message or null, will be HTML-escapedIOException
public static void writeFooter(OutputStream out) throws IOException
IOException
public static void writeFooter(Writer out) throws IOException
IOException
protected String _t(String key, Object o)