enterprisedt.com Forum Index CompleteFTP
RegisterSearchFAQMemberlistUsergroupsLog in
Reply to topic Page 2 of 2
Goto page Previous  1, 2
set ftp connection going out through proxy on defined port ?
Author Message
Reply with quote
Post  
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/articles/java-proxy.html

Reply with quote
Post  
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/tutorials/httpproxy.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/articles/java-proxy.html


View user's profile Send private message Visit poster's website
Display posts from previous:
Reply to topic Page 2 of 2
Goto page Previous  1, 2
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum