You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2007/10/29 14:58:50 UTC

[jira] Resolved: (HTTPCLIENT-698) DefaultRedirectHandler not resolving relative location URI wrt the request URI

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-698.
------------------------------------------

    Resolution: Fixed

All right. I added the test case and applied the fix.

Oleg

> DefaultRedirectHandler not resolving relative location URI wrt the request URI
> ------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-698
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-698
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.0 Alpha 1
>            Reporter: Johannes Koch
>             Fix For: 4.0 Alpha 2
>
>
> The adjustment of a relative URI in the Location header value does not take the request URI into account. So you may want to replace ...
> ------------------------------
> try {
>     uri = new URI(
>             target.getSchemeName(),
>             null,
>             target.getHostName(),
>             target.getPort(),
>             uri.getPath(),
>             uri.getQuery(),
>             uri.getFragment());
> ------------------------------
> ... with ...
> ------------------------------
> HttpRequest request = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
> try {
>     URI requestURI = new URI(request.getRequestLine().getUri());
>     URI absoluteRequestURI = new URI(
>             target.getSchemeName(),
>             null,
>             target.getHostName(),
>             target.getPort(),
>             requestURI.getPath(),
>             requestURI.getQuery(),
>             requestURI.getFragment());
>     uri = absoluteRequestURI.resolve(uri);
> ------------------------------
> ... or get the request URI from somewhere else.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org