[ https://issues.apache.org/jira/browse/HTTPCLIENT-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16738302#comment-16738302 ]
Oleg Kalnichevski commented on HTTPCLIENT-1959: ----------------------------------------------- [~matf] OK. There is a bit of a mess in {{HttpHost}} that we need to fix in HttpCore first. I am working on it. Oleg > Proxy support not working in 5.0 (IllegalArgumentException: Inet address must > not be null) > ------------------------------------------------------------------------------------------ > > Key: HTTPCLIENT-1959 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1959 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient (classic) > Affects Versions: 5.0 Beta3 > Reporter: Matthias Fritschi > Priority: Major > Fix For: 5.0 Beta4 > > Attachments: ProxyTest.java > > > When a proxy host and port are specified via the JVM properties > https.proxyHost / https.proxyPort, an IllegalArgumentException is thrown on > any HTTP request (see stacktrace below) > h2. Steps to reproduce > 1) Specify a proxy via https.proxyHost/https.proxyPort JVM properties > 2) Execute for example a HTTP GET via httpClient.execute(...) > 3) java.lang.IllegalArgumentException: Inet address must not be null is > thrown (see stacktrace below) > h2. Analysis > The sun.net.spi.DefaultProxySelector deliberately does not resolve the > proxy's address, see > http://hg.openjdk.java.net/jdk10/jdk10/jdk/file/9b8c96f96a0f/src/share/classes/sun/net/spi/DefaultProxySelector.java#l294. > > SystemDefaultRoutePlanner in httpclient5 assumes the address has been > resolved, see > https://github.com/apache/httpcomponents-client/blob/5.0-beta3/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java#L100 > See the attached reproducer test or the code snippet below. > h2. Versions used > org.apache.httpcomponents.client5:httpclient5:5.0-beta3 > Oracle JDK 10.0.2 on OSX and Windows > {code} > java.lang.IllegalArgumentException: Inet address must not be null > at > org.apache.hc.core5.util.Args.illegalArgumentExceptionNotNull(Args.java:101) > at org.apache.hc.core5.util.Args.notNull(Args.java:150) > at org.apache.hc.core5.http.HttpHost.<init>(HttpHost.java:286) > at > org.apache.hc.client5.http.impl.routing.SystemDefaultRoutePlanner.determineProxy(SystemDefaultRoutePlanner.java:100) > at > org.apache.hc.client5.http.impl.routing.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:71) > at > org.apache.hc.client5.http.impl.classic.InternalHttpClient.determineRoute(InternalHttpClient.java:122) > at > org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:166) > at > org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:77) > at > org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:102) > {code} > {code} > System.setProperty("https.proxyHost", "<TODO: Your Proxy Host Here>"); > System.setProperty("https.proxyPort", "8080"); > CloseableHttpClient httpClient = HttpClients.createSystem(); > HttpGet httpGet = new HttpGet("https://www.google.com/"); > CloseableHttpResponse response = httpClient.execute(httpGet); > System.out.println(response.getCode()); > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org