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/05 08:00:24 UTC

[jira] Resolved: (HARMONY-3113) [classlib][luni] can't http connect thru a proxy

     [ 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.