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 2025/03/14 11:33:00 UTC
[jira] [Commented] (HTTPCORE-778) Inconsistency in encoding method for query and fragment components by URIBuilder
[ https://issues.apache.org/jira/browse/HTTPCORE-778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17935489#comment-17935489 ]
Oleg Kalnichevski commented on HTTPCORE-778:
--------------------------------------------
[~peterhalicky] Here is the proposed fix for the stable 5.3.x branch [1] and here is a change-set with further improvement for the master [2]. Feel free to review / participate.
Oleg
[1] https://github.com/apache/httpcomponents-core/pull/518
[2] https://github.com/apache/httpcomponents-core/pull/517
> Inconsistency in encoding method for query and fragment components by URIBuilder
> --------------------------------------------------------------------------------
>
> Key: HTTPCORE-778
> URL: https://issues.apache.org/jira/browse/HTTPCORE-778
> Project: HttpComponents HttpCore
> Issue Type: Bug
> Components: HttpCore
> Affects Versions: 5.3.3
> Reporter: Peter Halicky
> Priority: Minor
> Fix For: 5.3.4, 5.4-alpha1
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> URI fragment is encoded in URIBuilder using:
> {code:java}
> PercentCodec.encode(sb, this.fragment, this.charset); {code}
> (line 401, end of buildString method)
> This encodes all characters except UNRESERVED using the percent-format.
> As per (obsoleted) RFC2396, URI fragment should use URIC safe-chars.
> As per RFC3986, quite a bit more characters should not be encoded:
> {code:java}
> pct-encoded = "%" HEXDIG HEXDIG
> unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
> sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
> pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
> fragment = *( pchar / "/" / "?" ) {code}
> Note that URIBuilder in httpclient 4.5.13 conforms to at least the old RFC2396, as it uses URIC set of safe characters (i.e. this is in fact a regression).
--
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