You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mikhail Loenko (JIRA)" <ji...@apache.org> on 2007/02/02 10:55:05 UTC
[jira] Created: (HARMONY-3113) [classlib][luni] can't http connect
thru a proxy
[classlib][luni] can't http connect thru a proxy
------------------------------------------------
Key: HARMONY-3113
URL: https://issues.apache.org/jira/browse/HARMONY-3113
Project: Harmony
Issue Type: Bug
Components: Classlib
Reporter: Mikhail Loenko
Assigned To: Mikhail Loenko
I'm trying to build classlib using Harmony JDK
"ant fetch-depends" cannot connect to get a yoko jar
the problem seems to be that the proxy SocketAddress is unresolved, please review my patch (sure I grant ASF license):
Index: modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java
===================================================================
--- modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (revision 502526)
+++ modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (working copy)
@@ -34,6 +34,7 @@
import java.net.ProxySelector;
import java.net.ResponseCache;
import java.net.Socket;
+import java.net.SocketAddress;
import java.net.SocketPermission;
import java.net.URI;
import java.net.URISyntaxException;
@@ -635,7 +636,17 @@
getConnectTimeout());
} else if (proxy.type() == Proxy.Type.HTTP) {
socket = new Socket();
- socket.connect(proxy.address(), getConnectTimeout());
+
+ SocketAddress proxyAddr = proxy.address();
+
+ if (!(proxyAddr instanceof InetSocketAddress)) {
+ throw new IllegalArgumentException(Msg.getString(
+ "K0316", proxyAddr.getClass())); //$NON-NLS-1$
+ }
+ socket.connect(new InetSocketAddress(
+ ((InetSocketAddress) proxyAddr).getHostName(),
+ ((InetSocketAddress) proxyAddr).getPort()),
+ getConnectTimeout());
} else {
// using SOCKS proxy
socket = new Socket(proxy);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HARMONY-3113) [classlib][luni] can't http
connect thru a proxy
Posted by "Mikhail Markov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-3113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469734 ]
Mikhail Markov commented on HARMONY-3113:
-----------------------------------------
Hi Mikhail!
proxyAddr.getAddress() is indeed null meaning that is's not resolved.
I've reviewed your patch and it looks good to me. I've verified it with my environment and it fixes the problem.
So, +1 for integration.
> [classlib][luni] can't http connect thru a proxy
> ------------------------------------------------
>
> Key: HARMONY-3113
> URL: https://issues.apache.org/jira/browse/HARMONY-3113
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Mikhail Loenko
> Assigned To: Mikhail Loenko
>
> I'm trying to build classlib using Harmony JDK
> "ant fetch-depends" cannot connect to get a yoko jar
> the problem seems to be that the proxy SocketAddress is unresolved, please review my patch (sure I grant ASF license):
> Index: modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java
> ===================================================================
> --- modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (revision 502526)
> +++ modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (working copy)
> @@ -34,6 +34,7 @@
> import java.net.ProxySelector;
> import java.net.ResponseCache;
> import java.net.Socket;
> +import java.net.SocketAddress;
> import java.net.SocketPermission;
> import java.net.URI;
> import java.net.URISyntaxException;
> @@ -635,7 +636,17 @@
> getConnectTimeout());
> } else if (proxy.type() == Proxy.Type.HTTP) {
> socket = new Socket();
> - socket.connect(proxy.address(), getConnectTimeout());
> +
> + SocketAddress proxyAddr = proxy.address();
> +
> + if (!(proxyAddr instanceof InetSocketAddress)) {
> + throw new IllegalArgumentException(Msg.getString(
> + "K0316", proxyAddr.getClass())); //$NON-NLS-1$
> + }
> + socket.connect(new InetSocketAddress(
> + ((InetSocketAddress) proxyAddr).getHostName(),
> + ((InetSocketAddress) proxyAddr).getPort()),
> + getConnectTimeout());
> } else {
> // using SOCKS proxy
> socket = new Socket(proxy);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HARMONY-3113) [classlib][luni] can't http
connect thru a proxy
Posted by "Mikhail Markov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-3113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469796 ]
Mikhail Markov commented on HARMONY-3113:
-----------------------------------------
Hi Geir, I've added the explanation to teh dev-list.
> [classlib][luni] can't http connect thru a proxy
> ------------------------------------------------
>
> Key: HARMONY-3113
> URL: https://issues.apache.org/jira/browse/HARMONY-3113
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Mikhail Loenko
> Assigned To: Mikhail Loenko
>
> I'm trying to build classlib using Harmony JDK
> "ant fetch-depends" cannot connect to get a yoko jar
> the problem seems to be that the proxy SocketAddress is unresolved, please review my patch (sure I grant ASF license):
> Index: modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java
> ===================================================================
> --- modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (revision 502526)
> +++ modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (working copy)
> @@ -34,6 +34,7 @@
> import java.net.ProxySelector;
> import java.net.ResponseCache;
> import java.net.Socket;
> +import java.net.SocketAddress;
> import java.net.SocketPermission;
> import java.net.URI;
> import java.net.URISyntaxException;
> @@ -635,7 +636,17 @@
> getConnectTimeout());
> } else if (proxy.type() == Proxy.Type.HTTP) {
> socket = new Socket();
> - socket.connect(proxy.address(), getConnectTimeout());
> +
> + SocketAddress proxyAddr = proxy.address();
> +
> + if (!(proxyAddr instanceof InetSocketAddress)) {
> + throw new IllegalArgumentException(Msg.getString(
> + "K0316", proxyAddr.getClass())); //$NON-NLS-1$
> + }
> + socket.connect(new InetSocketAddress(
> + ((InetSocketAddress) proxyAddr).getHostName(),
> + ((InetSocketAddress) proxyAddr).getPort()),
> + getConnectTimeout());
> } else {
> // using SOCKS proxy
> socket = new Socket(proxy);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HARMONY-3113) [classlib][luni] can't http
connect thru a proxy
Posted by "Geir Magnusson Jr (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-3113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469774 ]
Geir Magnusson Jr commented on HARMONY-3113:
--------------------------------------------
Please see my post ont he dev list re this - I don't grok why this isn't a workaround for a problem elsewhere...
> [classlib][luni] can't http connect thru a proxy
> ------------------------------------------------
>
> Key: HARMONY-3113
> URL: https://issues.apache.org/jira/browse/HARMONY-3113
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Mikhail Loenko
> Assigned To: Mikhail Loenko
>
> I'm trying to build classlib using Harmony JDK
> "ant fetch-depends" cannot connect to get a yoko jar
> the problem seems to be that the proxy SocketAddress is unresolved, please review my patch (sure I grant ASF license):
> Index: modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java
> ===================================================================
> --- modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (revision 502526)
> +++ modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (working copy)
> @@ -34,6 +34,7 @@
> import java.net.ProxySelector;
> import java.net.ResponseCache;
> import java.net.Socket;
> +import java.net.SocketAddress;
> import java.net.SocketPermission;
> import java.net.URI;
> import java.net.URISyntaxException;
> @@ -635,7 +636,17 @@
> getConnectTimeout());
> } else if (proxy.type() == Proxy.Type.HTTP) {
> socket = new Socket();
> - socket.connect(proxy.address(), getConnectTimeout());
> +
> + SocketAddress proxyAddr = proxy.address();
> +
> + if (!(proxyAddr instanceof InetSocketAddress)) {
> + throw new IllegalArgumentException(Msg.getString(
> + "K0316", proxyAddr.getClass())); //$NON-NLS-1$
> + }
> + socket.connect(new InetSocketAddress(
> + ((InetSocketAddress) proxyAddr).getHostName(),
> + ((InetSocketAddress) proxyAddr).getPort()),
> + getConnectTimeout());
> } else {
> // using SOCKS proxy
> socket = new Socket(proxy);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (HARMONY-3113) [classlib][luni] can't http connect
thru a proxy
Posted by "Mikhail Loenko (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-3113?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mikhail Loenko resolved HARMONY-3113.
-------------------------------------
Resolution: Fixed
fixed in revision 503570 as discussed on the dev-list
(no regression test since the bug is configuration-dependent)
> [classlib][luni] can't http connect thru a proxy
> ------------------------------------------------
>
> Key: HARMONY-3113
> URL: https://issues.apache.org/jira/browse/HARMONY-3113
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Mikhail Loenko
> Assigned To: Mikhail Loenko
>
> I'm trying to build classlib using Harmony JDK
> "ant fetch-depends" cannot connect to get a yoko jar
> the problem seems to be that the proxy SocketAddress is unresolved, please review my patch (sure I grant ASF license):
> Index: modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java
> ===================================================================
> --- modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (revision 502526)
> +++ modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (working copy)
> @@ -34,6 +34,7 @@
> import java.net.ProxySelector;
> import java.net.ResponseCache;
> import java.net.Socket;
> +import java.net.SocketAddress;
> import java.net.SocketPermission;
> import java.net.URI;
> import java.net.URISyntaxException;
> @@ -635,7 +636,17 @@
> getConnectTimeout());
> } else if (proxy.type() == Proxy.Type.HTTP) {
> socket = new Socket();
> - socket.connect(proxy.address(), getConnectTimeout());
> +
> + SocketAddress proxyAddr = proxy.address();
> +
> + if (!(proxyAddr instanceof InetSocketAddress)) {
> + throw new IllegalArgumentException(Msg.getString(
> + "K0316", proxyAddr.getClass())); //$NON-NLS-1$
> + }
> + socket.connect(new InetSocketAddress(
> + ((InetSocketAddress) proxyAddr).getHostName(),
> + ((InetSocketAddress) proxyAddr).getPort()),
> + getConnectTimeout());
> } else {
> // using SOCKS proxy
> socket = new Socket(proxy);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (HARMONY-3113) [classlib][luni] can't http connect
thru a proxy
Posted by "Mikhail Loenko (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-3113?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mikhail Loenko closed HARMONY-3113.
-----------------------------------
> [classlib][luni] can't http connect thru a proxy
> ------------------------------------------------
>
> Key: HARMONY-3113
> URL: https://issues.apache.org/jira/browse/HARMONY-3113
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Mikhail Loenko
> Assigned To: Mikhail Loenko
>
> I'm trying to build classlib using Harmony JDK
> "ant fetch-depends" cannot connect to get a yoko jar
> the problem seems to be that the proxy SocketAddress is unresolved, please review my patch (sure I grant ASF license):
> Index: modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java
> ===================================================================
> --- modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (revision 502526)
> +++ modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnection.java (working copy)
> @@ -34,6 +34,7 @@
> import java.net.ProxySelector;
> import java.net.ResponseCache;
> import java.net.Socket;
> +import java.net.SocketAddress;
> import java.net.SocketPermission;
> import java.net.URI;
> import java.net.URISyntaxException;
> @@ -635,7 +636,17 @@
> getConnectTimeout());
> } else if (proxy.type() == Proxy.Type.HTTP) {
> socket = new Socket();
> - socket.connect(proxy.address(), getConnectTimeout());
> +
> + SocketAddress proxyAddr = proxy.address();
> +
> + if (!(proxyAddr instanceof InetSocketAddress)) {
> + throw new IllegalArgumentException(Msg.getString(
> + "K0316", proxyAddr.getClass())); //$NON-NLS-1$
> + }
> + socket.connect(new InetSocketAddress(
> + ((InetSocketAddress) proxyAddr).getHostName(),
> + ((InetSocketAddress) proxyAddr).getPort()),
> + getConnectTimeout());
> } else {
> // using SOCKS proxy
> socket = new Socket(proxy);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.