HTTP Client: Allow SSL to i2p hosts by default

This commit is contained in:
zzz
2018-05-05 22:25:13 +00:00
parent 543e5bd218
commit e14a4f0111
3 changed files with 17 additions and 4 deletions

View File

@@ -371,8 +371,10 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
public static final String PROP_SSL_OUTPROXIES = "i2ptunnel.httpclient.SSLOutproxies";
/** @since 0.9.14 */
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";
/** @since 0.9.35 */
public static final String PROP_SSL_SET = "sslManuallySet";
/**
*
@@ -1245,9 +1247,11 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
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") &&
!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 {
writeErrorMessage(ERR_INTERNAL_SSL, out, targetRequest, false, destination);
} catch (IOException ioe) {

View File

@@ -661,8 +661,13 @@ public class GeneralHelper {
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) {
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) {

View File

@@ -600,6 +600,9 @@ public class TunnelConfig {
if (_port >= 0)
config.setProperty(TunnelController.PROP_LISTEN_PORT, Integer.toString(_port));
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)
config.setProperty(OPT + p, "" + _booleanOptions.contains(p));
for (String p : _otherClientOpts) {
@@ -759,7 +762,8 @@ public class TunnelConfig {
I2PTunnelHTTPClient.PROP_USER_AGENT,
I2PTunnelHTTPClient.PROP_REFERER,
I2PTunnelHTTPClient.PROP_ACCEPT,
I2PTunnelHTTPClient.PROP_INTERNAL_SSL
I2PTunnelHTTPClient.PROP_INTERNAL_SSL,
I2PTunnelHTTPClient.PROP_SSL_SET
};
private static final String _booleanServerOpts[] = {
"i2cp.reduceOnIdle", "i2cp.encryptLeaseSet", PROP_ENABLE_ACCESS_LIST, PROP_ENABLE_BLACKLIST,