Discuss edtFTPj (FTP) and edtFTPj/PRO (SFTP, FTPS and SCP), our Java file transfer clients.
no avatar
User

Guest

by Guest » Tue Aug 10, 2004 3:40 am

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
no avatar
User

uzimmi

Posts

8

Joined

Wed Aug 04, 2004 6:19 pm

Location

Germany / Hessen

by uzimmi » Sat Aug 14, 2004 6:12 pm

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).

Anonymous wrote: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
Previous

Who is online

Users browsing this forum: No registered users and 2 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign