Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
5.0M15
-
None
-
None
-
All
-
Patch Available
Description
The root cause is we set port is -1. Below is the description:
1. -1 is set to be the default port. For example, http will set port to 80, https will set port to 443. See org.apache.harmony.luni.internal.net.www.protocol.http.HttpConfiguration.
2. The uri in the HttpConfiguration is from the url.toURI(). If the url's port is -1, url.toURI().getHost() will return null (as expected).
3. The connection will new a InetSocketAddress, whose parameter will be host(null) and port(default port). This will cause a IllegalArgumentException.
What's in the patch:
1. use uri.toURL().getHost() to get the orignal host instead of null.
2. add the test case
3. remove the unused code in the HttpConfiguration(URI uri, Proxy proxy).