Discussion:
java client and ntlm proxy - Another try
Pierre Gilquin
2011-03-29 10:29:12 UTC
Permalink
Hi all,

I have try another way for passing a ntml proxy with a java client.
I use the WebProxyTunnelSocket from mindbright. The java code is
http://www.sethi.org/tmp/ssh/src/com/mindbright/net/WebProxyTunnelSocket.java
I have tested with the following small code :

socket = WebProxyTunnelSocket.getProxy("www.myserver.com", 80, pro.getProperty("http.proxyHost"),Integer.parseInt(pro.getProperty("http.proxyPort"))
, null,this,sun.net.www.protocol.http.HttpURLConnection.userAgent);
Writer out = new OutputStreamWriter(socket.getOutputStream(), "ASCII");
out.write("GET http://www.myserver.com/cgi-bin/WebObjects/Mara2.woa/wa/com.webobjects.eodistribution._EOHTTPInitialAction/componentURLpage=GuiServer
HTTP/1.1\r\n");
out.write("Host: www.myserver.com\r\n");
out.write("Agent: whatever\r\n");
out.write("\r\n");
out.flush();
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream(), "ASCII"));
String line = null;
while ((line = in.readLine()) != null) {System.out.println(line);}

and it works as I get :

HTTP/1.1 200 Apple
content-length: 612
Content-Type: x-eojavaclient-message
...


I have implemented createSocket in my class extending EOHTTPChanel with the same WebProxyTunnelSocket socket but it fails.
At some point in the connection, the content send by the socket refers to the proxy (get myproxyIP/cgi-bin/WebObjects/Mara2.woa/wa/com.webobjects.eodistribution ... ) instead of the target server in the
application url.
How can I can make a clear distinction between proxy and server in EODistribution framework ?

Thanks in advance for any idea.

Pierre

Loading...