maskit commented on a change in pull request #2888: PIP-25: Token based
authentication
URL: https://github.com/apache/pulsar/pull/2888#discussion_r236862629
##########
File path:
pulsar-common/src/main/java/org/apache/pulsar/client/api/url/DataURLStreamHandler.java
##########
@@ -57,20 +60,23 @@ public void connect() throws IOException {
if (this.uri == null) {
throw new IOException();
}
- Pattern pattern = Pattern.compile(
-
"(?<mimeType>.+?)(;(?<charset>charset=.+?))?(;(?<base64>base64?))?,(?<data>.+)",
Pattern.DOTALL);
+
Matcher matcher =
pattern.matcher(this.uri.getSchemeSpecificPart());
if (matcher.matches()) {
this.contentType = matcher.group("mimeType");
- String charset = matcher.group("charset");
- if (charset == null) {
- charset = "US-ASCII";
+ if (contentType == null) {
+ this.contentType = "application/data";
}
+
+ for (int i =0; i < matcher.groupCount(); i++) {
+ System.out.println("Group: " + matcher.group(i));
+ }
+
if (matcher.group("base64") == null) {
// Support Urlencode but not decode here because already
decoded by URI class.
- this.data = new String(matcher.group("data").getBytes(),
charset);
+ this.data = matcher.group("data").getBytes();
Review comment:
Yeah, I can see that, and we shoud fix that part. So this would be out of
this PR’s scope but we need to return charset as a part of contentType so that
URL class users can convert the data into String after reading the raw data
from InputStream. I think we can do this by removing charset part from the
regex.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services