commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Catrain Laurent (JIRA)" <j...@apache.org>
Subject [jira] Created: (VFS-181) Test with https and url attributes
Date Mon, 03 Dec 2007 09:56:43 GMT
Test with https and url attributes
----------------------------------

                 Key: VFS-181
                 URL: https://issues.apache.org/jira/browse/VFS-181
             Project: Commons VFS
          Issue Type: Bug
    Affects Versions: Nightly Builds
         Environment: Windows XP , Jbuilder2007, java version "1.6.0_03"
            Reporter: Catrain Laurent
            Priority: Minor


Hello,

i have to download several zip files from a https server with url attributes, so i make only
one connection with this server instead of create one connection per file. i use the  property
.setbaseFile of a StandardFileSystemManager object. Every thing works fine for ftp and http
server (local or remote) but when trying with https server with url attributes, it downloads
the first files and then for each other files after, it downloads always the first file...
see the code below...
According my tests, i hope this is a bug and not my unknowlegments...

/*String baseURI = "http://127.0.0.1/"; //or ftp work fine
		String fileURI  = "zip:test1.zip";
		String fileURI2 = "zip:test2.zip";*/
		
		String baseURI = "https://www2.swift.com/bicdownload/";
		String morebicURI = "zip:bicdownloader?action=getfile&productline=bicdirdbplus&product=morebic&content=full&format=txt";
		String bicdbpURI  = "zip:bicdownloader?action=getfile&productline=bicdirdbplus&product=bicdbp&content=full&format=txt";
		
		//https://www2.swift.com/bicdownload/bicdownloader?action=getfile&productline=bicdirdbplus&product=morebic&content=full&format=txt
		//https://www2.swift.com/bicdownload/bicdownloader?action=getfile&productline=bicdirdbplus&product=bicdbp&content=full&format=txt

		//****************************************************
		FileSystemOptions httpOpts = new FileSystemOptions();
		HttpFileSystemConfigBuilder.getInstance().setProxyHost(httpOpts,"10.255.170.65");
		HttpFileSystemConfigBuilder.getInstance().setProxyPort(httpOpts, 8080);
		HttpFileSystemConfigBuilder.getInstance().setProxyAuthenticator(
				httpOpts,
				new StaticUserAuthenticator("", "logonForProxy",
				"pwdForProxy"));
		DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(
				httpOpts,
				new StaticUserAuthenticator("www2.swift.com",
						"logonForSwift", "PwdForSwift"));
		// ***************************************************

		//set only one permanent connection
		StandardFileSystemManager fs = new StandardFileSystemManager();
		fs.setBaseFile(VFS.getManager().resolveFile(baseURI,httpOpts));
		fs.init();
		
		//download first zip
		FileObject moreBic = fs.resolveFile(morebicURI);
		System.out.println("file 1 : " + moreBic.getName());
		// http,ftp and https : ok download the right file
		// return zip:https://www2.swift.com/bicdownload/bicdownloader?action=getfile&productline=bicdirdbplus&product=morebic&content=full&format=txt!
		FileObject[] moreBicZip = moreBic.getChildren();
		for (int i = 0; i < moreBicZip.length; i++)
			System.out.println("Name file : " + moreBicZip[i].getName().getBaseName());
		
		moreBic.close();

		//download second zip
		FileObject bicdbp = fs.resolveFile(bicdbpURI);
		System.out.println("file 2 : " + bicdbp.getName());
		// ftp,http : OK download the second file (bicdbp)
		// return zip:https://www2.swift.com/bicdownload/bicdownloader?action=getfile&productline=bicdirdbplus&product=bicdbp&content=full&format=txt!
		// https : NOT OK download again the first file (moreBic) 
		// return zip:https://www2.swift.com/bicdownload/bicdownloader?action=getfile&productline=bicdirdbplus&product=morebic&content=full&format=txt!
		FileObject[] bicdbpZip = bicdbp.getChildren();
		for (int i = 0; i < bicdbpZip.length; i++)
			System.out.println("Name file : " + bicdbpZip[i].getName().getBaseName());
		//content of bicdbpZip confirm the bug (OK with ftp, http AND NOT OK with https)
		
		bicdbp.close();
		
		fs.close();
		System.out.println("Done");

Rgds
Laurent Catrain

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message