Apply patch for VFS-261

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/vfs/branches/VFS281@833832 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java b/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
index cadc5d4..2de8de4 100644
--- a/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
+++ b/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
@@ -21,7 +21,7 @@
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.URIException;
 import org.apache.commons.httpclient.methods.RequestEntity;
-import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
 import org.apache.commons.httpclient.util.DateUtil;
 import org.apache.commons.vfs.provider.URLFileName;
 import org.apache.commons.vfs.provider.DefaultFileContent;
@@ -562,7 +562,7 @@
          */
         protected void onClose() throws IOException
         {
-            RequestEntity entity = new StringRequestEntity(out.toString());
+            RequestEntity entity = new ByteArrayRequestEntity(((ByteArrayOutputStream) out).toByteArray());
             URLFileName fileName = (URLFileName) getName();
             String urlStr = urlString(fileName);
             WebdavFileSystemOptions opts = fileSystem.getFileSystemOptions();
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 4f99b2a..1c5d422 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -23,6 +23,9 @@
 
   <body>
     <release version="2.0" date="in SVN" description="">
+      <action dev="rgoers" type="fix" issue="VFS-261" due-to="Simon Olofsson">
+        WebDAV upload corrupts binary files
+      </action>
       <action dev="rgoers" type="fix" issue="VFS-276" due-to="Vince Bonfanti">
         add ProviderTestConfig.getDefaultFileSystemManager() method
       </action>