[
https://issues.apache.org/jira/browse/HTTPCLIENT-911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12831734#action_12831734
]
Oleg Kalnichevski commented on HTTPCLIENT-911:
----------------------------------------------
Are you sure this has anything to do with the underscore in domain name? The
following test throws a UnknownHostException for me:
---
HttpHost targetHost = new HttpHost("www.what_ever.com", 80, "http");
DefaultHttpClient httpclient = new DefaultHttpClient();
BasicHttpContext localcontext = new BasicHttpContext();
HttpGet httpget = new HttpGet("/");
HttpResponse response = httpclient.execute(targetHost, httpget, localcontext);
System.out.println(response.getStatusLine());
HttpEntity entity = response.getEntity();
if (entity != null) {
entity.consumeContent();
}
---
Exception in thread "main" java.net.UnknownHostException: www.what_ever.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:520)
at
org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123)
---
I suspect you may be trying to execute a request with a relative request URI,
in which case the IllegalArgumentException you are getting seems reasonable.
Oleg
> Support underscore in domain name, or provide better exception
> --------------------------------------------------------------
>
> Key: HTTPCLIENT-911
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-911
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 4.0.1
> Reporter: Ziv Horesh
>
> When calling on HttpClient.execute with a url that contain underscore ('_'),
> you get NullPointerException.
> Tracing it down show that java.net.Uri complains that it is illegal name.
> Which is true according to the RFC.
> But it seems that most browser allow it, and some companies support it.
> I think HttpClient should either support underscores, or atleast provide a
> better exception.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]