mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-10 03:56:17 +00:00
Classic exec runtime to establish connection automatically if the connection endpoint is disconnected
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1794169 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
196ee3363e
commit
ecf4e93842
@ -202,10 +202,6 @@ private boolean createTunnelToTarget(
|
|||||||
this.proxyHttpProcessor.process(connect, null, context);
|
this.proxyHttpProcessor.process(connect, null, context);
|
||||||
|
|
||||||
while (response == null) {
|
while (response == null) {
|
||||||
if (!execRuntime.isConnected()) {
|
|
||||||
execRuntime.connect(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
connect.removeHeaders(HttpHeaders.PROXY_AUTHORIZATION);
|
connect.removeHeaders(HttpHeaders.PROXY_AUTHORIZATION);
|
||||||
this.authenticator.addAuthResponse(proxy, ChallengeType.PROXY, connect, proxyAuthExchange, context);
|
this.authenticator.addAuthResponse(proxy, ChallengeType.PROXY, connect, proxyAuthExchange, context);
|
||||||
|
|
||||||
|
@ -141,10 +141,7 @@ public boolean isConnected() {
|
|||||||
return endpoint != null && endpoint.isConnected();
|
return endpoint != null && endpoint.isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void connectEndpoint(final ConnectionEndpoint endpoint, final HttpClientContext context) throws IOException {
|
||||||
public void connect(final HttpClientContext context) throws IOException {
|
|
||||||
final ConnectionEndpoint endpoint = ensureValid();
|
|
||||||
if (!endpoint.isConnected()) {
|
|
||||||
if (cancellableAware != null) {
|
if (cancellableAware != null) {
|
||||||
if (cancellableAware.isCancelled()) {
|
if (cancellableAware.isCancelled()) {
|
||||||
throw new RequestFailedException("Request aborted");
|
throw new RequestFailedException("Request aborted");
|
||||||
@ -158,6 +155,13 @@ public void connect(final HttpClientContext context) throws IOException {
|
|||||||
endpoint.setSocketTimeout(socketTimeout.toMillisIntBound());
|
endpoint.setSocketTimeout(socketTimeout.toMillisIntBound());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void connect(final HttpClientContext context) throws IOException {
|
||||||
|
final ConnectionEndpoint endpoint = ensureValid();
|
||||||
|
if (!endpoint.isConnected()) {
|
||||||
|
connectEndpoint(endpoint, context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -178,6 +182,9 @@ public void upgradeTls(final HttpClientContext context) throws IOException {
|
|||||||
@Override
|
@Override
|
||||||
public ClassicHttpResponse execute(final ClassicHttpRequest request, final HttpClientContext context) throws IOException, HttpException {
|
public ClassicHttpResponse execute(final ClassicHttpRequest request, final HttpClientContext context) throws IOException, HttpException {
|
||||||
final ConnectionEndpoint endpoint = ensureValid();
|
final ConnectionEndpoint endpoint = ensureValid();
|
||||||
|
if (!endpoint.isConnected()) {
|
||||||
|
connectEndpoint(endpoint, context);
|
||||||
|
}
|
||||||
return endpoint.execute(request, requestExecutor, context);
|
return endpoint.execute(request, requestExecutor, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user