harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Qiu" <sean.xx....@gmail.com>
Subject [classlib]The bind operation of socket with SOCKS proxy
Date Mon, 08 Jan 2007 02:21:12 GMT
In [1], the code means that if constructs a new Socket with Socks proxy,it
will not bind the address at all.So the address and port will remain 0.
It causes the failure which was described in jira 2930 [2].So the
impl.bind(addr,port)
should be called to keep compatible with RI.

But in [3], the method will call the socksBind() method which is used to
implement the BIND request in SOCKS protocol.

According to RFC 1928 [4], it said that "The BIND request is used in
protocols which require the client to accept connections from the
server.Itis expected that the client side of an application protocol
will use the
BIND request only to establish secondary connections after a primary
connection is established using CONNECT."
Obviously, this "BIND" in SOCKS Protocol is quite different from the
java.net.Socket.bind(SocketAddress) method.

So in order to fix the bug, shall we remove both the condition test? Is my
thought wrong?
Thoughts? Concerns?Comments? Thanks.:)


[1] //java.net.Socket
public void bind(SocketAddress localAddr) throws IOException {
...
if (!NetUtil.usingSocks(proxy)) {
impl.bind(addr, port);
}
...
}

[2] http://issues.apache.org/jira/browse/HARMONY-2930

[3] //org.apache.harmony.luni.net.PlainSocketImpl
protected void bind(InetAddress anAddr, int aPort) throws IOException {
if (NetUtil.usingSocks(proxy)) {
socksBind();
return;
}
...

[4] http://rfc.net/rfc1928.html

-- 
Sean Qiu

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message