hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johannes Koch (JIRA)" <j...@apache.org>
Subject [jira] Created: (HTTPCLIENT-698) DefaultRedirectHandler not resolving relative location URI wrt the request URI
Date Thu, 25 Oct 2007 14:02:50 GMT
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
            Reporter: Johannes Koch


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


Mime
View raw message