Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
24.3k views
in Java FTP by
hi :)

i am trying to make the ftp client going out through proxy (Proxy+ 3.0). The proxy can be set to use defined port but the ftp connection accures on variables. The proxy is working fine with the web browser, so i have to find solution in the ftp client.
any ideas ?????
thanks :)

16 Answers

0 votes
by (400 points)
OK, but my test failed with a connection refused exception. This attempt may be the wrong :cry:

I don't understand, why browsers (IE, Netscape) or some tools (e.g. Total Commander) can work with our proxy to handle FTP, but not your library or some other tools (e.g. WS_FTP).


The connection mode is irrelevant when logging in - it is only used for data transfers such as get/put and directory listing.

So set the SOCKS proxy first - it's a static method - and then call the constructor.

After logging in change to PASV.

0 votes
by (161k points)
Sorry, we don't know why either!

If you find out, please post the solution here.

OK, but my test failed with a connection refused exception. This attempt may be the wrong :cry:

I don't understand, why browsers (IE, Netscape) or some tools (e.g. Total Commander) can work with our proxy to handle FTP, but not your library or some other tools (e.g. WS_FTP).
0 votes
by (400 points)
The result of some additional tests using the debugger:

First problem is, that the proxy delivers no response after socket connet. Therefore I disabled the method call validateConnection() in the constructor of FTPControlSocket().

The next problem may be the ftp-communication throught the http-proxy. Login e.g. with ftp.login("ftp.microsoft.com", ""); returns an error 400 created by the proxy and login with ftp.login("ftp://ftp.microsoft.com", ""); delivers no response.

May be the Total Commander communicates with pure http and evaluates the http structured answer. I fear, this is the only possible way :cry:

Sorry, we don't know why either!

If you find out, please post the solution here.

OK, but my test failed with a connection refused exception. This attempt may be the wrong :cry:

I don't understand, why browsers (IE, Netscape) or some tools (e.g. Total Commander) can work with our proxy to handle FTP, but not your library or some other tools (e.g. WS_FTP).
0 votes
by
Is an HTTP Proxy supported at all? The built in SOCKS methods only apply to a SOCKS v4/v5 firewall, but many companies use http proxies (with or without ftp support).

Also, setting the htp/ftp proxy via system properties doesn't seem to influence the ftp class since it's based on Sockets directly.
0 votes
by
Wouldn't it be possible to modify the FTPControlSocket and FTPDataSocket constructors to support a "HTTP Connect" to an HTTP Proxy.

Something like:


String authString = "username" + ":" + "password";
String auth = "Basic " + new sun.misc.BASE64Encoder().encode(authString.getBytes());
Socket socket = new Socket("vsnlproxy.iitk.ac.in", 3128);
OutputStream out = socket.getOutputStream();

out.write(("CONNECT toc.oscar.aol.com:9898 HTTP/1.1" + CRLF + "Host: toc.oscar.aol.com:9898" + CRLF).getBytes());
out.write(("Proxy-Authorization: " + auth + CRLF).getBytes());
out.write(CRLF.getBytes());


I grabbed the code from this site:
http://resolute.ucsd.edu/~diwaker/artic ... proxy.html
0 votes
by (400 points)
OK, I tried this and I get a connection to the requested FTP-server through our proxy. Unfortunately any further traffic on that socket will be inspected by the proxy. Only few proxies support this way for direct tcp connection (see http://www.netknowledgebase.com/tutoria ... proxy.html).

Wouldn't it be possible to modify the FTPControlSocket and FTPDataSocket constructors to support a "HTTP Connect" to an HTTP Proxy.

Something like:


String authString = "username" + ":" + "password";
String auth = "Basic " + new sun.misc.BASE64Encoder().encode(authString.getBytes());
Socket socket = new Socket("vsnlproxy.iitk.ac.in", 3128);
OutputStream out = socket.getOutputStream();

out.write(("CONNECT toc.oscar.aol.com:9898 HTTP/1.1" + CRLF + "Host: toc.oscar.aol.com:9898" + CRLF).getBytes());
out.write(("Proxy-Authorization: " + auth + CRLF).getBytes());
out.write(CRLF.getBytes());


I grabbed the code from this site:
http://resolute.ucsd.edu/~diwaker/artic ... proxy.html

Categories

...