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 2023/04/27 15:17:00 UTC

[jira] [Resolved] (HTTPCORE-742) Cannot change requestUri of BasicHttpRequest if it has been set once

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

Oleg Kalnichevski resolved HTTPCORE-742.
----------------------------------------
    Fix Version/s: 5.2.2
                   5.3-alpha1
       Resolution: Fixed

[~pschusser] Fixed in master and 5.3.x

Oleg

> Cannot change requestUri of BasicHttpRequest if it has been set once
> --------------------------------------------------------------------
>
>                 Key: HTTPCORE-742
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-742
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore
>    Affects Versions: 5.2, 5.2.1
>            Reporter: Philipp Schusser
>            Priority: Minor
>             Fix For: 5.2.2, 5.3-alpha1
>
>         Attachments: TestBasicHttpRequest.java
>
>
> If the requestUri of a BasicHttpRequest isn’t null and needs to be set to a new value using setUri(newUri), e.g. because a parameter needs to be added to an existing URI, path is changed but not requestUri itself. Thus, the repeated query with getUri() returns the initially set value.
> I assume this could be fixed by setting the requestURI to null at the end of setUri(), as it is done in the other setters. This way it would be reassembled correctly next time it is queried, without caching.
> {code:java}
> URI uri = URI.create("http://example.org");
> HttpGet req = new HttpGet(uri);
> System.out.println(req.getUri());
> URI newUri = URI.create("http://not-example.org");
> req.setUri(newUri);
> System.out.println(req.getUri() == newUri); // would expect true {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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