harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3113) [classlib][luni] can't http connect thru a proxy
Date Fri, 02 Feb 2007 15:02:06 GMT

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


Mime
View raw message