75
75
import org .apache .hc .core5 .http .support .BasicRequestBuilder ;
76
76
import org .apache .hc .core5 .io .CloseMode ;
77
77
import org .apache .hc .core5 .io .ModalCloseable ;
78
+ import org .apache .hc .core5 .net .URIAuthority ;
78
79
import org .apache .hc .core5 .reactor .DefaultConnectingIOReactor ;
79
80
import org .apache .hc .core5 .util .TimeValue ;
80
81
import org .slf4j .Logger ;
@@ -193,7 +194,7 @@ private void setupContext(final HttpClientContext context) {
193
194
194
195
@ Override
195
196
protected <T > Future <T > doExecute (
196
- final HttpHost httpHost ,
197
+ final HttpHost target ,
197
198
final AsyncRequestProducer requestProducer ,
198
199
final AsyncResponseConsumer <T > responseConsumer ,
199
200
final HandlerFactory <AsyncPushConsumer > pushHandlerFactory ,
@@ -217,8 +218,15 @@ protected <T> Future<T> doExecute(
217
218
218
219
setupContext (clientContext );
219
220
221
+ final HttpHost resolvedTarget = target != null ? target : RoutingSupport .determineHost (request );
222
+ if (request .getScheme () == null ) {
223
+ request .setScheme (resolvedTarget .getSchemeName ());
224
+ }
225
+ if (request .getAuthority () == null ) {
226
+ request .setAuthority (new URIAuthority (resolvedTarget ));
227
+ }
220
228
final HttpRoute route = determineRoute (
221
- httpHost != null ? httpHost : RoutingSupport . determineHost ( request ) ,
229
+ resolvedTarget ,
222
230
request ,
223
231
clientContext );
224
232
final String exchangeId = ExecSupport .getNextExchangeId ();
0 commit comments