DefaultRedirectHandler.java (httpcomponents-client-4.5.7-src) | : | DefaultRedirectHandler.java (httpcomponents-client-4.5.8-src) | ||
---|---|---|---|---|
skipping to change at line 140 | skipping to change at line 140 | |||
// Adjust location URI | // Adjust location URI | |||
final HttpHost target = (HttpHost) context.getAttribute( | final HttpHost target = (HttpHost) context.getAttribute( | |||
ExecutionContext.HTTP_TARGET_HOST); | ExecutionContext.HTTP_TARGET_HOST); | |||
Asserts.notNull(target, "Target host"); | Asserts.notNull(target, "Target host"); | |||
final HttpRequest request = (HttpRequest) context.getAttribute( | final HttpRequest request = (HttpRequest) context.getAttribute( | |||
ExecutionContext.HTTP_REQUEST); | ExecutionContext.HTTP_REQUEST); | |||
try { | try { | |||
final URI requestURI = new URI(request.getRequestLine().getUri() ); | final URI requestURI = new URI(request.getRequestLine().getUri() ); | |||
final URI absoluteRequestURI = URIUtils.rewriteURI(requestURI, t arget, true); | final URI absoluteRequestURI = URIUtils.rewriteURI(requestURI, t arget, URIUtils.DROP_FRAGMENT_AND_NORMALIZE); | |||
uri = URIUtils.resolve(absoluteRequestURI, uri); | uri = URIUtils.resolve(absoluteRequestURI, uri); | |||
} catch (final URISyntaxException ex) { | } catch (final URISyntaxException ex) { | |||
throw new ProtocolException(ex.getMessage(), ex); | throw new ProtocolException(ex.getMessage(), ex); | |||
} | } | |||
} | } | |||
if (params.isParameterFalse(ClientPNames.ALLOW_CIRCULAR_REDIRECTS)) { | if (params.isParameterFalse(ClientPNames.ALLOW_CIRCULAR_REDIRECTS)) { | |||
RedirectLocations redirectLocations = (RedirectLocations) context.ge tAttribute( | RedirectLocations redirectLocations = (RedirectLocations) context.ge tAttribute( | |||
REDIRECT_LOCATIONS); | REDIRECT_LOCATIONS); | |||
skipping to change at line 164 | skipping to change at line 164 | |||
context.setAttribute(REDIRECT_LOCATIONS, redirectLocations); | context.setAttribute(REDIRECT_LOCATIONS, redirectLocations); | |||
} | } | |||
final URI redirectURI; | final URI redirectURI; | |||
if (uri.getFragment() != null) { | if (uri.getFragment() != null) { | |||
try { | try { | |||
final HttpHost target = new HttpHost( | final HttpHost target = new HttpHost( | |||
uri.getHost(), | uri.getHost(), | |||
uri.getPort(), | uri.getPort(), | |||
uri.getScheme()); | uri.getScheme()); | |||
redirectURI = URIUtils.rewriteURI(uri, target, true); | redirectURI = URIUtils.rewriteURI(uri, target, URIUtils.DROP _FRAGMENT_AND_NORMALIZE); | |||
} catch (final URISyntaxException ex) { | } catch (final URISyntaxException ex) { | |||
throw new ProtocolException(ex.getMessage(), ex); | throw new ProtocolException(ex.getMessage(), ex); | |||
} | } | |||
} else { | } else { | |||
redirectURI = uri; | redirectURI = uri; | |||
} | } | |||
if (redirectLocations.contains(redirectURI)) { | if (redirectLocations.contains(redirectURI)) { | |||
throw new CircularRedirectException("Circular redirect to '" + | throw new CircularRedirectException("Circular redirect to '" + | |||
redirectURI + "'"); | redirectURI + "'"); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |