Author: dhruba
Date: Mon May 10 19:07:00 2010
New Revision: 942847
URL: http://svn.apache.org/viewvc?rev=942847&view=rev
Log:
HDFS-1109. HFTP supports filenames that contains the character "+".
(Dmytro Molkov via dhruba)
Modified:
hadoop/hdfs/trunk/CHANGES.txt
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFileDataServlet.java
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFileForward.java
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestAuthorizationFilter.java
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestLdapIpDirFilter.java
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/StreamFile.java
Modified: hadoop/hdfs/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=942847&r1=942846&r2=942847&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Mon May 10 19:07:00 2010
@@ -502,6 +502,9 @@ Release 0.21.0 - Unreleased
HDFS-1028. Efficient splitting of path components reduces the time
to load in fsimage by 20%. (Dmytro Molkov via dhruba)
+ HDFS-1109. HFTP supports filenames that contains the character "+".
+ (Dmytro Molkov via dhruba)
+
OPTIMIZATIONS
HDFS-946. NameNode should not return full path name when lisitng a
Modified:
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFileDataServlet.java
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFileDataServlet.java?rev=942847&r1=942846&r2=942847&view=diff
==============================================================================
---
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFileDataServlet.java
(original)
+++
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFileDataServlet.java
Mon May 10 19:07:00 2010
@@ -40,8 +40,8 @@ public class ProxyFileDataServlet extend
ClientProtocol nnproxy, HttpServletRequest request) throws IOException,
URISyntaxException {
return new URI(request.getScheme(), null, request.getServerName(), request
- .getServerPort(), "/streamFile", "filename=" + i.getFullName(parent)
- + "&ugi=" + ugi.getShortUserName(), null);
+ .getServerPort(), "/streamFile" + i.getFullName(parent),
+ "&ugi=" + ugi.getShortUserName(), null);
}
/** {...@inheritdoc} */
Modified:
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFileForward.java
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFileForward.java?rev=942847&r1=942846&r2=942847&view=diff
==============================================================================
---
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFileForward.java
(original)
+++
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyFileForward.java
Mon May 10 19:07:00 2010
@@ -30,12 +30,12 @@ public class ProxyFileForward extends Pr
@Override
protected String buildForwardPath(HttpServletRequest request, String
pathInfo) {
String path = "/streamFile";
- path += "?filename=" + request.getPathInfo();
+ path += request.getPathInfo();
String userID = (String) request.
getAttribute("org.apache.hadoop.hdfsproxy.authorized.userID");
UserGroupInformation ugi = ProxyUtil.getProxyUGIFor(userID);
if (ugi != null) {
- path += "&ugi=" + ugi.getShortUserName();
+ path += "?ugi=" + ugi.getShortUserName();
}
return path;
}
Modified:
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestAuthorizationFilter.java
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestAuthorizationFilter.java?rev=942847&r1=942846&r2=942847&view=diff
==============================================================================
---
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestAuthorizationFilter.java
(original)
+++
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestAuthorizationFilter.java
Mon May 10 19:07:00 2010
@@ -63,8 +63,8 @@ public class TestAuthorizationFilter ext
}
public void beginPathRestriction(WebRequest theRequest) {
- theRequest.setURL("proxy-test:0", null, "/streamFile", null,
- "filename=/nontestdir");
+ theRequest.setURL("proxy-test:0", null, "/streamFile/nontestdir",
+ null,null);
}
public void testPathRestriction() throws ServletException, IOException {
@@ -91,8 +91,8 @@ public class TestAuthorizationFilter ext
}
public void beginPathPermit(WebRequest theRequest) {
- theRequest.setURL("proxy-test:0", null, "/streamFile", null,
- "filename=/data/file");
+ theRequest.setURL("proxy-test:0", null, "/streamFile/data/file",
+ null, null);
}
public void testPathPermit() throws ServletException, IOException {
@@ -114,8 +114,8 @@ public class TestAuthorizationFilter ext
}
public void beginPathPermitQualified(WebRequest theRequest) {
- theRequest.setURL("proxy-test:0", null, "/streamFile", null,
- "filename=/data/file");
+ theRequest.setURL("proxy-test:0", null, "/streamFile/data/file",
+ null, null);
}
public void testPathPermitQualified() throws ServletException, IOException {
@@ -137,8 +137,8 @@ public class TestAuthorizationFilter ext
}
public void beginPathQualifiediReject(WebRequest theRequest) {
- theRequest.setURL("proxy-test:0", null, "/streamFile", null,
- "filename=/data/file");
+ theRequest.setURL("proxy-test:0", null, "/streamFile/data/file",
+ null, null);
}
public void testPathQualifiedReject() throws ServletException, IOException {
Modified:
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestLdapIpDirFilter.java
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestLdapIpDirFilter.java?rev=942847&r1=942846&r2=942847&view=diff
==============================================================================
---
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestLdapIpDirFilter.java
(original)
+++
hadoop/hdfs/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestLdapIpDirFilter.java
Mon May 10 19:07:00 2010
@@ -76,8 +76,8 @@ public class TestLdapIpDirFilter extends
}
public void beginDoFilter(WebRequest theRequest) {
- theRequest.setURL("proxy-test:0", null, "/streamFile", null,
- "filename=/testdir");
+ theRequest.setURL("proxy-test:0", null, "/streamFile/testdir",
+ null, null);
}
public void testDoFilter() throws ServletException, IOException,
Modified:
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java?rev=942847&r1=942846&r2=942847&view=diff
==============================================================================
---
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java
(original)
+++
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DatanodeJspHelper.java
Mon May 10 19:07:00 2010
@@ -236,7 +236,9 @@ public class DatanodeJspHelper {
else
startOffset = Long.parseLong(startOffsetStr);
- final String filename=JspHelper.validatePath(req.getParameter("filename"));
+ final String filename=JspHelper.validatePath(
+ req.getPathInfo() == null ?
+ "/" : req.getPathInfo());
if (filename == null) {
out.print("Invalid input");
return;
Modified:
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java?rev=942847&r1=942846&r2=942847&view=diff
==============================================================================
---
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java
(original)
+++
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java
Mon May 10 19:07:00 2010
@@ -59,8 +59,8 @@ public class FileDataServlet extends Dfs
"https".equals(scheme)
? (Integer)getServletContext().getAttribute("datanode.https.port")
: host.getInfoPort(),
- "/streamFile", "filename=" + i.getFullName(parent) +
- "&ugi=" + ugi.getShortUserName(), null);
+ "/streamFile" + i.getFullName(parent),
+ "ugi=" + ugi.getShortUserName(), null);
}
/** Select a datanode to service this request.
@@ -105,8 +105,9 @@ public class FileDataServlet extends Dfs
request.getPathInfo() :
"/";
HdfsFileStatus info = nnproxy.getFileInfo(path);
if ((info != null) && !info.isDir()) {
- response.sendRedirect(createUri(path, info, ugi, nnproxy,
- request).toURL().toString());
+ String redirect = createUri(path, info, ugi, nnproxy,
+ request).toURL().toString();
+ response.sendRedirect(redirect);
} else if (info == null){
response.sendError(400, "cat: File not found " + path);
} else {
Modified:
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/StreamFile.java
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/StreamFile.java?rev=942847&r1=942846&r2=942847&view=diff
==============================================================================
---
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/StreamFile.java
(original)
+++
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/StreamFile.java
Mon May 10 19:07:00 2010
@@ -52,7 +52,7 @@ public class StreamFile extends DfsServl
protected DFSClient getDFSClient(HttpServletRequest request)
throws IOException, InterruptedException {
final Configuration conf =
- (Configuration) getServletContext().getAttribute("name.conf");
+ (Configuration) getServletContext().getAttribute("datanode.conf");
UserGroupInformation ugi = getUGI(request, conf);
DFSClient client = ugi.doAs(new PrivilegedExceptionAction<DFSClient>() {
@@ -67,8 +67,9 @@ public class StreamFile extends DfsServl
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- final String filename = JspHelper.validatePath(
- request.getParameter("filename"));
+ final String path = request.getPathInfo() != null ?
+ request.getPathInfo() : "/";
+ final String filename = JspHelper.validatePath(path);
if (filename == null) {
response.setContentType("text/plain");
PrintWriter out = response.getWriter();