[
https://issues.apache.org/jira/browse/HDFS-2235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13081964#comment-13081964
]
Daryn Sharp commented on HDFS-2235:
-----------------------------------
The relationship between some of the methods seems odd. I haven't looked at
the entire patch, but I've noticed the following:
# {{getNamenodeFileURL(Path path)}} is encoding the path and encoding a query
string with the ugi, then calls {{getNamenodeURL(String path, String query)}}.
Then other methods like {{HftpFileSystem#open}} are doing the same encoding as
{{getNamenodeFileURL(Path path)}} before calling {{getNamenodeURL(String path,
String query)}}? Shouldn't the 1-arg just call the 2-arg with a null query
string? Then the 2-arg should do the encoding like the 1-arg used to, thus the
callers of the 2-arg aren't all doing the same redundant work?
# {{URIUtil.encodeQuery}} is being called on the entire query instead of the
values of the query. This means that any special characters (ie. &, =, etc) in
a value can be used to exploit the parsing of the query string. I think you
need something like:
{code}
String encodeKVP(String key, String value) {
return URIUtil.encodeQuery(key) + "=" + URIUtil.encodeQuery(value);
}
{code}
# There's a lot of redundancy in the opening of connections, ie:
{code}
HttpURLConnection connection = openConnection(
"/listPaths" + ServletUtil.encodePath(path),
ServletUtil.encodeQuery("ugi=" + getUgiParameter() + (recur?
"&recursive=yes" : "")));
{code}
Perhaps those could be simplified to avoid redundancy and improve readability:
{code}
HttpURLConnection connection = openServletURL("listPaths", path,
encodeKVP("recursive", "yes"));
{code}
The method could automatically tack on the ugi on to the query string so every
caller doesn't have to do it.
> Hftp doesn't support paths with semicolons
> ------------------------------------------
>
> Key: HDFS-2235
> URL: https://issues.apache.org/jira/browse/HDFS-2235
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: name-node
> Affects Versions: 0.23.0
> Reporter: Eli Collins
> Assignee: Eli Collins
> Fix For: 0.23.0
>
> Attachments: hdfs-2235-1.patch
>
>
> Hftp does not support paths which contain semicolons. The commented out test
> in HDFS-2234 illustrates this.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira