@@ -109,6 +109,7 @@ public class AsyncHttpClientConfig {
109
109
protected int ioThreadMultiplier ;
110
110
protected boolean strict302Handling ;
111
111
protected int maxConnectionLifeTimeInMs ;
112
+ protected boolean useRelativeURIsWithSSLProxies ;
112
113
113
114
protected AsyncHttpClientConfig () {
114
115
}
@@ -143,7 +144,8 @@ private AsyncHttpClientConfig(int maxTotalConnections,
143
144
boolean removeQueryParamOnRedirect ,
144
145
HostnameVerifier hostnameVerifier ,
145
146
int ioThreadMultiplier ,
146
- boolean strict302Handling ) {
147
+ boolean strict302Handling ,
148
+ boolean useRelativeURIsWithSSLProxies ) {
147
149
148
150
this .maxTotalConnections = maxTotalConnections ;
149
151
this .maxConnectionPerHost = maxConnectionPerHost ;
@@ -174,6 +176,7 @@ private AsyncHttpClientConfig(int maxTotalConnections,
174
176
this .hostnameVerifier = hostnameVerifier ;
175
177
this .ioThreadMultiplier = ioThreadMultiplier ;
176
178
this .strict302Handling = strict302Handling ;
179
+ this .useRelativeURIsWithSSLProxies = useRelativeURIsWithSSLProxies ;
177
180
178
181
if (applicationThreadPool == null ) {
179
182
this .applicationThreadPool = Executors .newCachedThreadPool ();
@@ -503,6 +506,16 @@ public boolean isStrict302Handling() {
503
506
return strict302Handling ;
504
507
}
505
508
509
+ /**
510
+ * @return<code>true</code> if AHC should use relative URIs instead of absolute ones when talking with a SSL proxy,
511
+ * otherwise <code>false</code>.
512
+ *
513
+ * @since 1.7.12
514
+ */
515
+ public boolean isUseRelativeURIsWithSSLProxies () {
516
+ return useRelativeURIsWithSSLProxies ;
517
+ }
518
+
506
519
/**
507
520
* Return the maximum time in millisecond an {@link com.ning.http.client.AsyncHttpClient} will keep connection in the pool, or -1 to keep connection while possible.
508
521
*
@@ -530,6 +543,7 @@ public static class Builder {
530
543
private String userAgent = System .getProperty (ASYNC_CLIENT + "userAgent" , "AsyncHttpClient/" + AHC_VERSION );
531
544
private boolean useProxyProperties = Boolean .getBoolean (ASYNC_CLIENT + "useProxyProperties" );
532
545
private boolean allowPoolingConnection = true ;
546
+ private boolean useRelativeURIsWithSSLProxies = Boolean .getBoolean (ASYNC_CLIENT + "useRelativeURIsWithSSLProxies" );
533
547
private ScheduledExecutorService reaper = Executors .newScheduledThreadPool (Runtime .getRuntime ().availableProcessors (), new ThreadFactory () {
534
548
public Thread newThread (Runnable r ) {
535
549
Thread t = new Thread (r , "AsyncHttpClient-Reaper" );
@@ -1004,6 +1018,19 @@ public Builder setMaxConnectionLifeTimeInMs(int maxConnectionLifeTimeInMs) {
1004
1018
return this ;
1005
1019
}
1006
1020
1021
+ /**
1022
+ * Configures this AHC instance to use relative URIs instead of absolute ones when talking with a SSL proxy.
1023
+ *
1024
+ * @param useRelativeURIsWithSSLProxies
1025
+ * @return this
1026
+ *
1027
+ * @since 1.7.2
1028
+ */
1029
+ public Builder setUseRelativeURIsWithSSLProxies (boolean useRelativeURIsWithSSLProxies ) {
1030
+ this .useRelativeURIsWithSSLProxies = useRelativeURIsWithSSLProxies ;
1031
+ return this ;
1032
+ }
1033
+
1007
1034
/**
1008
1035
* Create a config builder with values taken from the given prototype configuration.
1009
1036
*
@@ -1047,6 +1074,7 @@ public Builder(AsyncHttpClientConfig prototype) {
1047
1074
removeQueryParamOnRedirect = prototype .isRemoveQueryParamOnRedirect ();
1048
1075
hostnameVerifier = prototype .getHostnameVerifier ();
1049
1076
strict302Handling = prototype .isStrict302Handling ();
1077
+ useRelativeURIsWithSSLProxies = prototype .isUseRelativeURIsWithSSLProxies ();
1050
1078
}
1051
1079
1052
1080
/**
@@ -1095,7 +1123,8 @@ public AsyncHttpClientConfig build() {
1095
1123
removeQueryParamOnRedirect ,
1096
1124
hostnameVerifier ,
1097
1125
ioThreadMultiplier ,
1098
- strict302Handling );
1126
+ strict302Handling ,
1127
+ useRelativeURIsWithSSLProxies );
1099
1128
}
1100
1129
}
1101
1130
}
0 commit comments