Author: ecki Date: Fri Sep 18 15:24:25 2015 New Revision: 1703884 URL: http://svn.apache.org/viewvc?rev=1703884&view=rev Log: [VFS-202][http] Allow 405 for HEAD requests.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java commons/proper/vfs/trunk/src/changes/changes.xml Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java?rev=1703884&r1=1703883&r2=1703884&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java Fri Sep 18 15:24:25 2015 @@ -173,7 +173,8 @@ public class HttpFileObject<FS extends H { // Use the HEAD method to probe the file. final int status = this.getHeadMethod().getStatusCode(); - if (status == HttpURLConnection.HTTP_OK) + if (status == HttpURLConnection.HTTP_OK + || status == HttpURLConnection.HTTP_BAD_METHOD /* method is bad, but resource exist */) { return FileType.FILE; } Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java?rev=1703884&r1=1703883&r2=1703884&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java (original) +++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java Fri Sep 18 15:24:25 2015 @@ -202,6 +202,12 @@ public class HttpProviderTestCase extend testResloveFolderSlash(ConnectionUri + "/read-tests/", true); } + public void testHttp405() throws FileSystemException + { + final FileObject f = VFS.getManager().resolveFile("http://www.w3schools.com/webservices/tempconvert.asmx?action=WSDL"); + assert f.getContent().getSize() > 0; + } + /** Ensure VFS-453 options are present. */ public void testHttpTimeoutConfig() throws FileSystemException { Modified: commons/proper/vfs/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1703884&r1=1703883&r2=1703884&view=diff ============================================================================== --- commons/proper/vfs/trunk/src/changes/changes.xml (original) +++ commons/proper/vfs/trunk/src/changes/changes.xml Fri Sep 18 15:24:25 2015 @@ -26,6 +26,9 @@ <!-- <action issue="VFS-443" dev="ggregory" type="update" due-to="nickallen"> --> <!-- [Local] Need an easy way to convert from a FileObject to a File. --> <!-- </action> --> + <action issue="VFS-202" dev="ecki" type="fix" due-to="Sergey Vladimirov, Simon Legner"> + [http] Allow URLs responding with 405 to HEAD requests. + </action> <action issue="VFS-490" dev="ecki" type="fix"> [hdfs] Make OSGi package imports for hdfs resolution=optional. Removed all scopes from dependency management.