You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2019/11/16 13:10:15 UTC
[httpcomponents-core] branch master updated: HTTPCLIENT-2029:
URIBuilder to support parsing of non-UTF8 URIs
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
The following commit(s) were added to refs/heads/master by this push:
new d4def3a HTTPCLIENT-2029: URIBuilder to support parsing of non-UTF8 URIs
d4def3a is described below
commit d4def3a24a05e5f47fd3c69924d73683e05a38a5
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Nov 16 13:46:54 2019 +0100
HTTPCLIENT-2029: URIBuilder to support parsing of non-UTF8 URIs
---
.../java/org/apache/hc/core5/net/URIBuilder.java | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java b/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
index 4857719..9863d6e 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
@@ -98,8 +98,7 @@ public class URIBuilder {
* @throws URISyntaxException if the input is not a valid URI
*/
public URIBuilder(final String string) throws URISyntaxException {
- super();
- digestURI(new URI(string));
+ this(new URI(string), null);
}
/**
@@ -107,7 +106,26 @@ public class URIBuilder {
* @param uri
*/
public URIBuilder(final URI uri) {
+ this(uri, null);
+ }
+
+ /**
+ * Construct an instance from the string which must be a valid URI.
+ *
+ * @param string a valid URI in string form
+ * @throws URISyntaxException if the input is not a valid URI
+ */
+ public URIBuilder(final String string, final Charset charset) throws URISyntaxException {
+ this(new URI(string), charset);
+ }
+
+ /**
+ * Construct an instance from the provided URI.
+ * @param uri
+ */
+ public URIBuilder(final URI uri, final Charset charset) {
super();
+ setCharset(charset);
digestURI(uri);
}