Varun Nandi created HTTPCLIENT-1986:
---------------------------------------

             Summary: URIBuilder isPathEmpty method doesn't check if 
encodedPath is empty
                 Key: HTTPCLIENT-1986
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1986
             Project: HttpComponents HttpClient
          Issue Type: Bug
    Affects Versions: 4.5.8
            Reporter: Varun Nandi
             Fix For: 4.5.9


A new method isPathEmpty() is added to URIBuilder recently. The method checks 
if encodedPath  is null but doesn't check if encodedPath is an empty string. 
This method is used in [URIUtils.rewriteURI 
method|[https://github.com/apache/httpcomponents-client/blob/4.5.x/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java#L229-L231]].
 When normalization is enabled, URIBuilder#setPathSegments will make 
encodedPath as null and so uribuilder.isPathEmpty() resolves to true 
[here|[https://github.com/apache/httpcomponents-client/blob/4.5.x/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java#L229]].
 

But when normalization is disabled, uribuilder.isPathEmpty() is evaluated to 
false and the final built URI will not contain a forward slash. This cause API 
calls to fail in my application.

Check the linked PR. It added a unit test that failed before this change is 
made.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to