Skip to content

Commit 595a061

Browse files
author
Stephane Landelle
committed
When talking to a SSL proxy, AHC should use relative URIs by default, close AsyncHttpClient#509
1 parent 6327640 commit 595a061

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

api/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.asynchttpclient;
1717

18+
import static org.asynchttpclient.util.MiscUtil.getBoolean;
19+
1820
import org.asynchttpclient.date.TimeConverter;
1921
import org.asynchttpclient.filter.IOExceptionFilter;
2022
import org.asynchttpclient.filter.RequestFilter;
@@ -578,7 +580,7 @@ public static class Builder {
578580
private boolean useProxyProperties = Boolean.getBoolean(ASYNC_CLIENT + "useProxyProperties");
579581
private boolean useProxySelector = Boolean.getBoolean(ASYNC_CLIENT + "useProxySelector");
580582
private boolean allowPoolingConnection = true;
581-
private boolean useRelativeURIsWithSSLProxies = Boolean.getBoolean(ASYNC_CLIENT + "useRelativeURIsWithSSLProxies");
583+
private boolean useRelativeURIsWithSSLProxies = getBoolean(ASYNC_CLIENT + "useRelativeURIsWithSSLProxies", true);
582584
private ScheduledExecutorService reaper;
583585
private ExecutorService applicationThreadPool;
584586
private ProxyServerSelector proxyServerSelector = null;

api/src/main/java/org/asynchttpclient/util/MiscUtil.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,9 @@ public static boolean isNonEmpty(Collection<?> collection) {
3939
public static boolean isNonEmpty(Map<?, ?> map) {
4040
return map != null && !map.isEmpty();
4141
}
42+
43+
public static boolean getBoolean(String systemPropName, boolean defaultValue) {
44+
String systemPropValue = System.getProperty(systemPropName);
45+
return systemPropValue != null ? systemPropValue.equalsIgnoreCase("true") : defaultValue;
46+
}
4247
}

0 commit comments

Comments
 (0)