You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Varun Nandi (JIRA)" <ji...@apache.org> on 2019/04/24 00:05:00 UTC

[jira] [Commented] (HTTPCLIENT-1986) URIBuilder isPathEmpty method doesn't check if encodedPath is empty

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16824676#comment-16824676 ] 

Varun Nandi commented on HTTPCLIENT-1986:
-----------------------------------------

Check the External issue URL for the pull request. Apologies for the messy formatting (I was not able to figure out how to fix the link formatting).

This issue is related to [https://github.com/aws/aws-sdk-java/issues/1919]

To disable normalization in our library, we need this fix to be released. Otherwise requests will fail for all empty URI paths when using AWS Java SDK.

> 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
>            Priority: Major
>              Labels: Bug, pull-request-available
>             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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org