java client and ntlm proxy - Another try
"Pierre Gilquin" <[email protected]> Tue, 29 Mar 2011 12:29:12 +0200
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============0877333025==
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_015E_01CBEE0C.E917CB20"
This is a multi-part message in MIME format.
------=_NextPart_000_015E_01CBEE0C.E917CB20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
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=20
http://www.sethi.org/tmp/ssh/src/com/mindbright/net/WebProxyTunnelSocket.=
java
I have tested with the following small code :
socket =3D 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 =3D new OutputStreamWriter(socket.getOutputStream(), =
"ASCII");
out.write("GET =
http://www.myserver.com/cgi-bin/WebObjects/Mara2.woa/wa/com.webobjects.eo=
distribution._EOHTTPInitialAction/componentURLpage=3DGuiServer=20
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 =3D new BufferedReader(new =
InputStreamReader(socket.getInputStream(), "ASCII"));
String line =3D null;
while ((line =3D in.readLine()) !=3D 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=20
application url.
How can I can make a clear distinction between proxy and server in =
EODistribution framework ?
Thanks in advance for any idea.
Pierre
------=_NextPart_000_015E_01CBEE0C.E917CB20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16915" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>Hi=20
all,<BR><BR>I have try another way for passing a ntml proxy with a java=20
client.<BR>I use the WebProxyTunnelSocket from mindbright. The java code =
is=20
<BR></FONT><A=20
href=3D"http://www.sethi.org/tmp/ssh/src/com/mindbright/net/WebProxyTunne=
lSocket.java"><FONT=20
face=3D"Times New Roman"=20
size=3D3>http://www.sethi.org/tmp/ssh/src/com/mindbright/net/WebProxyTunn=
elSocket.java</FONT></A><BR><FONT=20
face=3D"Times New Roman" size=3D3>I have tested with the following small =
code =20
:<BR><BR> socket =3D=20
WebProxyTunnelSocket.getProxy("</FONT><A =
href=3D"http://www.myserver.com/"><FONT=20
face=3D"Times New Roman" size=3D3>www.myserver.com</FONT></A><FONT=20
face=3D"Times New Roman" size=3D3>", 80,=20
pro.getProperty("http.proxyHost"),Integer.parseInt(pro.getProperty("http.=
proxyPort"))<BR> &nb=
sp; =20
,=20
null,this,sun.net.www.protocol.http.HttpURLConnection.userAgent);<BR>&nbs=
p; =20
Writer out =3D new OutputStreamWriter(socket.getOutputStream(),=20
"ASCII");<BR> out.write("GET </FONT><A=20
href=3D"http://www.myserver.com/cgi-bin/WebObjects/Mara2.woa/wa/com.webob=
jects.eodistribution._EOHTTPInitialAction/componentURLpage=3DGuiServer"><=
FONT=20
face=3D"Times New Roman"=20
size=3D3>http://www.myserver.com/cgi-bin/WebObjects/Mara2.woa/wa/com.webo=
bjects.eodistribution._EOHTTPInitialAction/componentURLpage=3DGuiServer</=
FONT></A><FONT=20
face=3D"Times New Roman" size=3D3> =
<BR>HTTP/1.1\r\n");<BR> =20
out.write("Host: </FONT><A href=3D"http://www.myserver.com/r/n"><FONT=20
face=3D"Times New Roman" size=3D3>www.myserver.com\r\n</FONT></A><FONT=20
face=3D"Times New Roman" size=3D3>");<BR> =
out.write("Agent:=20
whatever\r\n");<BR> =
out.write("\r\n");<BR> =20
out.flush();<BR> BufferedReader in =3D new =
BufferedReader(new=20
InputStreamReader(socket.getInputStream(), =20
"ASCII"));<BR> String line =3D =
null;<BR> while=20
((line =3D in.readLine()) !=3D null) =
{System.out.println(line);}</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3><BR>and it=20
works as I get :<BR><BR>HTTP/1.1 200 Apple<BR>content-length:=20
612<BR>Content-Type: x-eojavaclient-message<BR>...<BR><BR><BR>I have =
implemented=20
createSocket in my class extending EOHTTPChanel with the same=20
WebProxyTunnelSocket socket but it fails.<BR>At some point in the =
connection,=20
the content send by the socket refers to the proxy (get=20
myproxyIP/cgi-bin/WebObjects/Mara2.woa/wa/com.webobjects.eodistribution =
... )=20
instead of the target server in the <BR>application url.<BR>How can I =
can make a=20
clear distinction between proxy and server in EODistribution framework=20
?<BR><BR>Thanks in advance for any=20
idea.<BR><BR>Pierre</FONT><BR><BR></DIV></FONT></BODY></HTML>
------=_NextPart_000_015E_01CBEE0C.E917CB20--
--===============0877333025==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
--===============0877333025==--