MinimalClientExec.java (httpcomponents-client-4.5.7-src) | : | MinimalClientExec.java (httpcomponents-client-4.5.8-src) | ||
---|---|---|---|---|
skipping to change at line 72 | skipping to change at line 72 | |||
import org.apache.http.protocol.HttpCoreContext; | import org.apache.http.protocol.HttpCoreContext; | |||
import org.apache.http.protocol.HttpProcessor; | import org.apache.http.protocol.HttpProcessor; | |||
import org.apache.http.protocol.HttpRequestExecutor; | import org.apache.http.protocol.HttpRequestExecutor; | |||
import org.apache.http.protocol.ImmutableHttpProcessor; | import org.apache.http.protocol.ImmutableHttpProcessor; | |||
import org.apache.http.protocol.RequestContent; | import org.apache.http.protocol.RequestContent; | |||
import org.apache.http.protocol.RequestTargetHost; | import org.apache.http.protocol.RequestTargetHost; | |||
import org.apache.http.protocol.RequestUserAgent; | import org.apache.http.protocol.RequestUserAgent; | |||
import org.apache.http.util.Args; | import org.apache.http.util.Args; | |||
import org.apache.http.util.VersionInfo; | import org.apache.http.util.VersionInfo; | |||
import static org.apache.http.client.utils.URIUtils.DROP_FRAGMENT; | ||||
import static org.apache.http.client.utils.URIUtils.DROP_FRAGMENT_AND_NORMALIZE; | ||||
/** | /** | |||
* Request executor that implements the most fundamental aspects of | * Request executor that implements the most fundamental aspects of | |||
* the HTTP specification and the most straight-forward request / response | * the HTTP specification and the most straight-forward request / response | |||
* exchange with the target server. This executor does not support | * exchange with the target server. This executor does not support | |||
* execution via proxy and will make no attempts to retry the request | * execution via proxy and will make no attempts to retry the request | |||
* in case of a redirect, authentication challenge or I/O error. | * in case of a redirect, authentication challenge or I/O error. | |||
* | * | |||
* @since 4.3 | * @since 4.3 | |||
*/ | */ | |||
@Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL) | @Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL) | |||
skipping to change at line 115 | skipping to change at line 118 | |||
new RequestUserAgent(VersionInfo.getUserAgent( | new RequestUserAgent(VersionInfo.getUserAgent( | |||
"Apache-HttpClient", "org.apache.http.client", getClass( )))); | "Apache-HttpClient", "org.apache.http.client", getClass( )))); | |||
this.requestExecutor = requestExecutor; | this.requestExecutor = requestExecutor; | |||
this.connManager = connManager; | this.connManager = connManager; | |||
this.reuseStrategy = reuseStrategy; | this.reuseStrategy = reuseStrategy; | |||
this.keepAliveStrategy = keepAliveStrategy; | this.keepAliveStrategy = keepAliveStrategy; | |||
} | } | |||
static void rewriteRequestURI( | static void rewriteRequestURI( | |||
final HttpRequestWrapper request, | final HttpRequestWrapper request, | |||
final HttpRoute route) throws ProtocolException { | final HttpRoute route, | |||
final boolean normalizeUri) throws ProtocolException { | ||||
try { | try { | |||
URI uri = request.getURI(); | URI uri = request.getURI(); | |||
if (uri != null) { | if (uri != null) { | |||
// Make sure the request URI is relative | // Make sure the request URI is relative | |||
if (uri.isAbsolute()) { | if (uri.isAbsolute()) { | |||
uri = URIUtils.rewriteURI(uri, null, true); | uri = URIUtils.rewriteURI(uri, null, normalizeUri ? DROP_FRA GMENT_AND_NORMALIZE : DROP_FRAGMENT); | |||
} else { | } else { | |||
uri = URIUtils.rewriteURI(uri); | uri = URIUtils.rewriteURI(uri); | |||
} | } | |||
request.setURI(uri); | request.setURI(uri); | |||
} | } | |||
} catch (final URISyntaxException ex) { | } catch (final URISyntaxException ex) { | |||
throw new ProtocolException("Invalid URI: " + request.getRequestLine ().getUri(), ex); | throw new ProtocolException("Invalid URI: " + request.getRequestLine ().getUri(), ex); | |||
} | } | |||
} | } | |||
@Override | @Override | |||
public CloseableHttpResponse execute( | public CloseableHttpResponse execute( | |||
final HttpRoute route, | final HttpRoute route, | |||
final HttpRequestWrapper request, | final HttpRequestWrapper request, | |||
final HttpClientContext context, | final HttpClientContext context, | |||
final HttpExecutionAware execAware) throws IOException, HttpExceptio n { | final HttpExecutionAware execAware) throws IOException, HttpExceptio n { | |||
Args.notNull(route, "HTTP route"); | Args.notNull(route, "HTTP route"); | |||
Args.notNull(request, "HTTP request"); | Args.notNull(request, "HTTP request"); | |||
Args.notNull(context, "HTTP context"); | Args.notNull(context, "HTTP context"); | |||
rewriteRequestURI(request, route); | rewriteRequestURI(request, route, context.getRequestConfig().isNormalize Uri()); | |||
final ConnectionRequest connRequest = connManager.requestConnection(rout e, null); | final ConnectionRequest connRequest = connManager.requestConnection(rout e, null); | |||
if (execAware != null) { | if (execAware != null) { | |||
if (execAware.isAborted()) { | if (execAware.isAborted()) { | |||
connRequest.cancel(); | connRequest.cancel(); | |||
throw new RequestAbortedException("Request aborted"); | throw new RequestAbortedException("Request aborted"); | |||
} | } | |||
execAware.setCancellable(connRequest); | execAware.setCancellable(connRequest); | |||
} | } | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 7 lines changed or added |