You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by ki...@apache.org on 2014/04/24 00:08:20 UTC
svn commit: r1589529 - in
/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs:
CHANGES.txt src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsContentLength.java
Author: kihwal
Date: Wed Apr 23 22:08:19 2014
New Revision: 1589529
URL: http://svn.apache.org/r1589529
Log:
svn merge -c 1589528 merging from trunk to branch-2 to fix:HDFS-6217. Webhdfs PUT operations may not work via a http proxy. Contributed by Daryn Sharp.
Added:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsContentLength.java
- copied unchanged from r1589528, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsContentLength.java
Modified:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1589529&r1=1589528&r2=1589529&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Wed Apr 23 22:08:19 2014
@@ -127,6 +127,9 @@ Release 2.5.0 - UNRELEASED
HDFS-6275. Fix warnings - type arguments can be inferred and redudant
local variable. (suresh)
+ HDFS-6217. Webhdfs PUT operations may not work via a http proxy.
+ (Daryn Sharp via kihwal)
+
Release 2.4.1 - UNRELEASED
INCOMPATIBLE CHANGES
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java?rev=1589529&r1=1589528&r2=1589529&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java Wed Apr 23 22:08:19 2014
@@ -490,8 +490,25 @@ public class WebHdfsFileSystem extends F
private void connect(boolean doOutput) throws IOException {
conn.setRequestMethod(op.getType().toString());
- conn.setDoOutput(doOutput);
conn.setInstanceFollowRedirects(false);
+ switch (op.getType()) {
+ // if not sending a message body for a POST or PUT operation, need
+ // to ensure the server/proxy knows this
+ case POST:
+ case PUT: {
+ conn.setDoOutput(true);
+ if (!doOutput) {
+ // explicitly setting content-length to 0 won't do spnego!!
+ // opening and closing the stream will send "Content-Length: 0"
+ conn.getOutputStream().close();
+ }
+ break;
+ }
+ default: {
+ conn.setDoOutput(doOutput);
+ break;
+ }
+ }
conn.connect();
}