Fix litmus test failure:
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 2 Apr 2009 16:22:13 +0000 (16:22 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 2 Apr 2009 16:22:13 +0000 (16:22 +0000)
MKCOL with weird body must fail with 415 (RFC2518:8.3.1)

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@761338 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/servlets/WebdavServlet.java

index 7ce2ab9..cfa0125 100644 (file)
@@ -734,7 +734,7 @@ public class WebdavServlet
             return;
         }
 
-        if (req.getInputStream().available() > 0) {
+        if (req.getContentLength() > 0) {
             DocumentBuilder documentBuilder = getDocumentBuilder();
             try {
                 // Document document =
@@ -745,7 +745,7 @@ public class WebdavServlet
 
             } catch(SAXException saxe) {
                 // Parse error - assume invalid content
-                resp.sendError(WebdavStatus.SC_BAD_REQUEST);
+                resp.sendError(WebdavStatus.SC_UNSUPPORTED_MEDIA_TYPE);
                 return;
             }
         }