Skip to content

Commit 6901b9f

Browse files
author
Stephane Landelle
committed
When talking to a SSL proxy, AHC should use relative URIs by default, close AsyncHttpClient#509
1 parent 20e6a18 commit 6901b9f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/main/java/com/ning/http/client/AsyncHttpClientConfig.java

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

18+
import static com.ning.http.util.MiscUtil.getBoolean;
19+
1820
import com.ning.http.client.date.TimeConverter;
1921
import com.ning.http.client.filter.IOExceptionFilter;
2022
import com.ning.http.client.filter.RequestFilter;
@@ -539,7 +541,7 @@ public static class Builder {
539541
private boolean useProxyProperties = Boolean.getBoolean(ASYNC_CLIENT + "useProxyProperties");
540542
private boolean useProxySelector = Boolean.getBoolean(ASYNC_CLIENT + "useProxySelector");
541543
private boolean allowPoolingConnection = true;
542-
private boolean useRelativeURIsWithSSLProxies = Boolean.getBoolean(ASYNC_CLIENT + "useRelativeURIsWithSSLProxies");
544+
private boolean useRelativeURIsWithSSLProxies = getBoolean(ASYNC_CLIENT + "useRelativeURIsWithSSLProxies", true);
543545
private ExecutorService applicationThreadPool;
544546
private ProxyServerSelector proxyServerSelector = null;
545547
private SSLContext sslContext;

src/main/java/com/ning/http/util/MiscUtil.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private MiscUtil() {
2323
public static boolean isNonEmpty(String string) {
2424
return string != null && string.length() != 0;
2525
}
26-
26+
2727
public static boolean isNonEmpty(Object[] array) {
2828
return array != null && array.length != 0;
2929
}
@@ -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)