forked from I2P_Developers/i2p.i2p
HTTP Client: Allow SSL to i2p hosts by default
This commit is contained in:
@@ -371,8 +371,10 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
|||||||
public static final String PROP_SSL_OUTPROXIES = "i2ptunnel.httpclient.SSLOutproxies";
|
public static final String PROP_SSL_OUTPROXIES = "i2ptunnel.httpclient.SSLOutproxies";
|
||||||
/** @since 0.9.14 */
|
/** @since 0.9.14 */
|
||||||
public static final String PROP_ACCEPT = "i2ptunnel.httpclient.sendAccept";
|
public static final String PROP_ACCEPT = "i2ptunnel.httpclient.sendAccept";
|
||||||
/** @since 0.9.14 */
|
/** @since 0.9.14, overridden to true as of 0.9.35 unlesss PROP_SSL_SET is set */
|
||||||
public static final String PROP_INTERNAL_SSL = "i2ptunnel.httpclient.allowInternalSSL";
|
public static final String PROP_INTERNAL_SSL = "i2ptunnel.httpclient.allowInternalSSL";
|
||||||
|
/** @since 0.9.35 */
|
||||||
|
public static final String PROP_SSL_SET = "sslManuallySet";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -1245,9 +1247,11 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// as of 0.9.35, allowInternalSSL defaults to true, and overridden to true unless PROP_SSL_SET is set
|
||||||
if (method.toUpperCase(Locale.US).equals("CONNECT") &&
|
if (method.toUpperCase(Locale.US).equals("CONNECT") &&
|
||||||
!usingWWWProxy &&
|
!usingWWWProxy &&
|
||||||
!Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_INTERNAL_SSL))) {
|
getTunnel().getClientOptions().getProperty(PROP_SSL_SET) != null &&
|
||||||
|
!Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_INTERNAL_SSL, "true"))) {
|
||||||
try {
|
try {
|
||||||
writeErrorMessage(ERR_INTERNAL_SSL, out, targetRequest, false, destination);
|
writeErrorMessage(ERR_INTERNAL_SSL, out, targetRequest, false, destination);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
|
@@ -661,8 +661,13 @@ public class GeneralHelper {
|
|||||||
return getBooleanProperty(tunnel, I2PTunnelHTTPClient.PROP_ACCEPT);
|
return getBooleanProperty(tunnel, I2PTunnelHTTPClient.PROP_ACCEPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* As of 0.9.35, default true, and overridden to true unless
|
||||||
|
* PROP_SSL_SET is set
|
||||||
|
*/
|
||||||
public boolean getAllowInternalSSL(int tunnel) {
|
public boolean getAllowInternalSSL(int tunnel) {
|
||||||
return getBooleanProperty(tunnel, I2PTunnelHTTPClient.PROP_INTERNAL_SSL);
|
return getBooleanProperty(tunnel, I2PTunnelHTTPClient.PROP_INTERNAL_SSL, true) ||
|
||||||
|
!getBooleanProperty(tunnel, I2PTunnelHTTPClient.PROP_SSL_SET, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getMultihome(int tunnel) {
|
public boolean getMultihome(int tunnel) {
|
||||||
|
@@ -600,6 +600,9 @@ public class TunnelConfig {
|
|||||||
if (_port >= 0)
|
if (_port >= 0)
|
||||||
config.setProperty(TunnelController.PROP_LISTEN_PORT, Integer.toString(_port));
|
config.setProperty(TunnelController.PROP_LISTEN_PORT, Integer.toString(_port));
|
||||||
config.setProperty(TunnelController.PROP_SHARED, _sharedClient + "");
|
config.setProperty(TunnelController.PROP_SHARED, _sharedClient + "");
|
||||||
|
// see I2PTunnelHTTPClient
|
||||||
|
if (TunnelController.TYPE_HTTP_CLIENT.equals(_type))
|
||||||
|
_booleanOptions.add(I2PTunnelHTTPClient.PROP_SSL_SET);
|
||||||
for (String p : _booleanClientOpts)
|
for (String p : _booleanClientOpts)
|
||||||
config.setProperty(OPT + p, "" + _booleanOptions.contains(p));
|
config.setProperty(OPT + p, "" + _booleanOptions.contains(p));
|
||||||
for (String p : _otherClientOpts) {
|
for (String p : _otherClientOpts) {
|
||||||
@@ -759,7 +762,8 @@ public class TunnelConfig {
|
|||||||
I2PTunnelHTTPClient.PROP_USER_AGENT,
|
I2PTunnelHTTPClient.PROP_USER_AGENT,
|
||||||
I2PTunnelHTTPClient.PROP_REFERER,
|
I2PTunnelHTTPClient.PROP_REFERER,
|
||||||
I2PTunnelHTTPClient.PROP_ACCEPT,
|
I2PTunnelHTTPClient.PROP_ACCEPT,
|
||||||
I2PTunnelHTTPClient.PROP_INTERNAL_SSL
|
I2PTunnelHTTPClient.PROP_INTERNAL_SSL,
|
||||||
|
I2PTunnelHTTPClient.PROP_SSL_SET
|
||||||
};
|
};
|
||||||
private static final String _booleanServerOpts[] = {
|
private static final String _booleanServerOpts[] = {
|
||||||
"i2cp.reduceOnIdle", "i2cp.encryptLeaseSet", PROP_ENABLE_ACCESS_LIST, PROP_ENABLE_BLACKLIST,
|
"i2cp.reduceOnIdle", "i2cp.encryptLeaseSet", PROP_ENABLE_ACCESS_LIST, PROP_ENABLE_BLACKLIST,
|
||||||
|
Reference in New Issue
Block a user