@@ -84,6 +84,7 @@ public class AsyncHttpClientConfig {
84
84
protected HostnameVerifier hostnameVerifier ;
85
85
protected int ioThreadMultiplier ;
86
86
protected boolean strict302Handling ;
87
+ protected boolean useRelativeURIsWithSSLProxies ;
87
88
88
89
protected AsyncHttpClientConfig () {
89
90
}
@@ -117,7 +118,8 @@ private AsyncHttpClientConfig(int maxTotalConnections,
117
118
boolean removeQueryParamOnRedirect ,
118
119
HostnameVerifier hostnameVerifier ,
119
120
int ioThreadMultiplier ,
120
- boolean strict302Handling ) {
121
+ boolean strict302Handling ,
122
+ boolean useRelativeURIsWithSSLProxies ) {
121
123
122
124
this .maxTotalConnections = maxTotalConnections ;
123
125
this .maxConnectionPerHost = maxConnectionPerHost ;
@@ -476,6 +478,16 @@ public boolean isStrict302Handling() {
476
478
return strict302Handling ;
477
479
}
478
480
481
+ /**
482
+ * @return<code>true</code> if AHC should use relative URIs instead of absolute ones when talking with a SSL proxy,
483
+ * otherwise <code>false</code>.
484
+ *
485
+ * @since 1.7.12
486
+ */
487
+ public boolean isUseRelativeURIsWithSSLProxies () {
488
+ return useRelativeURIsWithSSLProxies ;
489
+ }
490
+
479
491
/**
480
492
* Builder for an {@link AsyncHttpClient}
481
493
*/
@@ -493,6 +505,7 @@ public static class Builder {
493
505
private String userAgent = System .getProperty (ASYNC_CLIENT + "userAgent" , "NING/1.0" );
494
506
private boolean useProxyProperties = Boolean .getBoolean (ASYNC_CLIENT + "useProxyProperties" );
495
507
private boolean allowPoolingConnection = true ;
508
+ private boolean useRelativeURIsWithSSLProxies = Boolean .getBoolean (ASYNC_CLIENT + "useRelativeURIsWithSSLProxies" );
496
509
private ScheduledExecutorService reaper = Executors .newScheduledThreadPool (Runtime .getRuntime ().availableProcessors (), new ThreadFactory () {
497
510
public Thread newThread (Runnable r ) {
498
511
Thread t = new Thread (r , "AsyncHttpClient-Reaper" );
@@ -955,6 +968,19 @@ public Builder setStrict302Handling(final boolean strict302Handling) {
955
968
this .strict302Handling = strict302Handling ;
956
969
return this ;
957
970
}
971
+
972
+ /**
973
+ * Configures this AHC instance to use relative URIs instead of absolute ones when talking with a SSL proxy.
974
+ *
975
+ * @param useRelativeURIsWithSSLProxies
976
+ * @return this
977
+ *
978
+ * @since 1.7.2
979
+ */
980
+ public Builder setUseRelativeURIsWithSSLProxies (boolean useRelativeURIsWithSSLProxies ) {
981
+ this .useRelativeURIsWithSSLProxies = useRelativeURIsWithSSLProxies ;
982
+ return this ;
983
+ }
958
984
959
985
/**
960
986
* Create a config builder with values taken from the given prototype configuration.
@@ -1045,7 +1071,8 @@ public AsyncHttpClientConfig build() {
1045
1071
removeQueryParamOnRedirect ,
1046
1072
hostnameVerifier ,
1047
1073
ioThreadMultiplier ,
1048
- strict302Handling );
1074
+ strict302Handling ,
1075
+ useRelativeURIsWithSSLProxies );
1049
1076
}
1050
1077
}
1051
1078
}
0 commit comments