asolfre / typica

Automatically exported from code.google.com/p/typica
Apache License 2.0
0 stars 0 forks source link

possible issue with using 1.7.2 #126

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. using 1.7.2 with httpclient 4.1.2

What is the expected output? What do you see instead?
Caused by: javax.net.ssl.SSLException: hostname in certificate didn't match: 
<ec2.us-west-1.amazonaws.com/204.246.162.140> != <ec2.us-west-1.amazonaws.com> 
OR <ec2.us-west-1.amazonaws.com> OR <us-west-1.ec2.amazonaws.com>
        at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:228)
        at org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify(BrowserCompatHostnameVerifier.java:54)
        at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:149)
        at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:130)
        at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:397)
        at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:495)
        at org.apache.http.conn.scheme.SchemeSocketFactoryAdaptor.connectSocket(SchemeSocketFactoryAdaptor.java:62)
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
        at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
        at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
        at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:573)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
        at com.xerox.amazonws.common.AWSQueryConnection.makeRequest(Unknown Source)
        at com.xerox.amazonws.ec2.Jec2.makeRequestInt(Jec2.java:2357)
at com.xerox.amazonws.ec2.Jec2.makeRequestInt(Jec2.java:2367)
        at com.xerox.amazonws.ec2.Jec2.describeInstances(Jec2.java:826)
        at com.telenav.utility.monitoring.EC2MonitorService.getCurrentInstanceId(Unknown Source)
        at com.telenav.spring.NodeAware.getNodeId(Unknown Source)
        at com.telenav.spring.NodeAware.init(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597) 

What version of the product are you using? On what operating system?
1.7.2 on Windows XP

Please provide any additional information below.
It's working with httpclient 4.1.1. So we filed a bug against httpclient first 
@ https://issues.apache.org/jira/browse/HTTPCLIENT-1118 and got commented that 
the lib is possibly using deprecated method from httpclient. So I checked 
source code of AWSQueryConnection from line 505-545, and it's really using 
deprecated methods of httpclient. Since we are using httpclient as well and 
need to keep up with their bug fixes and updates. We report this in hope that 
you could update the code. Thanks!

Original issue reported on code.google.com by sars...@gmail.com on 22 Aug 2011 at 8:59

GoogleCodeExporter commented 9 years ago
In AWSQueryConnection, changing Scheme initialization to the code below fixes 
the issue.

{{{
        registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
        registry.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
        registry.register(new Scheme("https", 8773, SSLSocketFactory.getSocketFactory()));

}}}

Original comment by gaill...@asperasoft.com on 17 Feb 2012 at 6:05