MainClientExec.java (httpcomponents-client-4.5.5-src) | : | MainClientExec.java (httpcomponents-client-4.5.6-src) | ||
---|---|---|---|---|
skipping to change at line 302 | skipping to change at line 302 | |||
if (needAuthentication( | if (needAuthentication( | |||
targetAuthState, proxyAuthState, route, response, contex t)) { | targetAuthState, proxyAuthState, route, response, contex t)) { | |||
// Make sure the response body is fully consumed, if present | // Make sure the response body is fully consumed, if present | |||
final HttpEntity entity = response.getEntity(); | final HttpEntity entity = response.getEntity(); | |||
if (connHolder.isReusable()) { | if (connHolder.isReusable()) { | |||
EntityUtils.consume(entity); | EntityUtils.consume(entity); | |||
} else { | } else { | |||
managedConn.close(); | managedConn.close(); | |||
if (proxyAuthState.getState() == AuthProtocolState.SUCCE SS | if (proxyAuthState.getState() == AuthProtocolState.SUCCE SS | |||
&& proxyAuthState.getAuthScheme() != null | && proxyAuthState.isConnectionBased()) { | |||
&& proxyAuthState.getAuthScheme().isConnectionBa | ||||
sed()) { | ||||
this.log.debug("Resetting proxy auth state"); | this.log.debug("Resetting proxy auth state"); | |||
proxyAuthState.reset(); | proxyAuthState.reset(); | |||
} | } | |||
if (targetAuthState.getState() == AuthProtocolState.SUCC ESS | if (targetAuthState.getState() == AuthProtocolState.SUCC ESS | |||
&& targetAuthState.getAuthScheme() != null | && targetAuthState.isConnectionBased()) { | |||
&& targetAuthState.getAuthScheme().isConnectionB | ||||
ased()) { | ||||
this.log.debug("Resetting target auth state"); | this.log.debug("Resetting target auth state"); | |||
targetAuthState.reset(); | targetAuthState.reset(); | |||
} | } | |||
} | } | |||
// discard previous auth headers | // discard previous auth headers | |||
final HttpRequest original = request.getOriginal(); | final HttpRequest original = request.getOriginal(); | |||
if (!original.containsHeader(AUTH.WWW_AUTH_RESP)) { | if (!original.containsHeader(AUTH.WWW_AUTH_RESP)) { | |||
request.removeHeaders(AUTH.WWW_AUTH_RESP); | request.removeHeaders(AUTH.WWW_AUTH_RESP); | |||
} | } | |||
if (!original.containsHeader(AUTH.PROXY_AUTH_RESP)) { | if (!original.containsHeader(AUTH.PROXY_AUTH_RESP)) { | |||
skipping to change at line 354 | skipping to change at line 352 | |||
} catch (final ConnectionShutdownException ex) { | } catch (final ConnectionShutdownException ex) { | |||
final InterruptedIOException ioex = new InterruptedIOException( | final InterruptedIOException ioex = new InterruptedIOException( | |||
"Connection has been shut down"); | "Connection has been shut down"); | |||
ioex.initCause(ex); | ioex.initCause(ex); | |||
throw ioex; | throw ioex; | |||
} catch (final HttpException ex) { | } catch (final HttpException ex) { | |||
connHolder.abortConnection(); | connHolder.abortConnection(); | |||
throw ex; | throw ex; | |||
} catch (final IOException ex) { | } catch (final IOException ex) { | |||
connHolder.abortConnection(); | connHolder.abortConnection(); | |||
if (proxyAuthState.isConnectionBased()) { | ||||
proxyAuthState.reset(); | ||||
} | ||||
if (targetAuthState.isConnectionBased()) { | ||||
targetAuthState.reset(); | ||||
} | ||||
throw ex; | throw ex; | |||
} catch (final RuntimeException ex) { | } catch (final RuntimeException ex) { | |||
connHolder.abortConnection(); | connHolder.abortConnection(); | |||
if (proxyAuthState.isConnectionBased()) { | ||||
proxyAuthState.reset(); | ||||
} | ||||
if (targetAuthState.isConnectionBased()) { | ||||
targetAuthState.reset(); | ||||
} | ||||
throw ex; | throw ex; | |||
} catch (final Error error) { | ||||
connManager.shutdown(); | ||||
throw error; | ||||
} | } | |||
} | } | |||
/** | /** | |||
* Establishes the target route. | * Establishes the target route. | |||
*/ | */ | |||
void establishRoute( | void establishRoute( | |||
final AuthState proxyAuthState, | final AuthState proxyAuthState, | |||
final HttpClientConnection managedConn, | final HttpClientConnection managedConn, | |||
final HttpRoute route, | final HttpRoute route, | |||
skipping to change at line 474 | skipping to change at line 487 | |||
managedConn, | managedConn, | |||
route, | route, | |||
timeout > 0 ? timeout : 0, | timeout > 0 ? timeout : 0, | |||
context); | context); | |||
} | } | |||
connect.removeHeaders(AUTH.PROXY_AUTH_RESP); | connect.removeHeaders(AUTH.PROXY_AUTH_RESP); | |||
this.authenticator.generateAuthResponse(connect, proxyAuthState, con text); | this.authenticator.generateAuthResponse(connect, proxyAuthState, con text); | |||
response = this.requestExecutor.execute(connect, managedConn, contex t); | response = this.requestExecutor.execute(connect, managedConn, contex t); | |||
this.requestExecutor.postProcess(response, this.proxyHttpProcessor, context); | ||||
final int status = response.getStatusLine().getStatusCode(); | final int status = response.getStatusLine().getStatusCode(); | |||
if (status < 200) { | if (status < 200) { | |||
throw new HttpException("Unexpected response to CONNECT request: " + | throw new HttpException("Unexpected response to CONNECT request: " + | |||
response.getStatusLine()); | response.getStatusLine()); | |||
} | } | |||
if (config.isAuthenticationEnabled()) { | if (config.isAuthenticationEnabled()) { | |||
if (this.authenticator.isAuthenticationRequested(proxy, response , | if (this.authenticator.isAuthenticationRequested(proxy, response , | |||
this.proxyAuthStrategy, proxyAuthState, context)) { | this.proxyAuthStrategy, proxyAuthState, context)) { | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 18 lines changed or added |