解决用GoogleAppEngineLauncher部署应用时的InvalidCertificateException错误
2012 4 28 02:15 AM 2575次查看
分类:Google App Engine 标签:Google App Engine
Traceback (most recent call last):
……
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line 170, in connect
'hostname mismatch')
fancy_urllib.InvalidCertificateException: Host appengine.google.com returned an invalid certificate (hostname mismatch): {'notAfter': 'Apr 11 00:14:07 2013 GMT', 'subjectAltName': (('DNS', '*.mail.google.com'), ('DNS', '*.docs.google.com'), ('DNS', '*.talkgadget.google.com'), ('DNS', '*.sites.google.com'), ('DNS', '*.plus.google.com'), ('DNS', '*.drive.google.com')), 'subject': ((('countryName', u'US'),), (('stateOrProvinceName', u'California'),), (('localityName', u'Mountain View'),), (('organizationName', u'Google Inc'),), (('commonName', u'*.mail.google.com'),))}
To learn more, see http://code.google.com/appengine/kb/general.html#rpcssl
原因就是我为了避免被墙而改了hosts文件,在验证appengine.google.com的证书时就不认可了。不过解决办法也很简单,打开刚才报错的那个文件,把165~170行的这段验证代码删掉就行了:
if self.cert_reqs & ssl.CERT_REQUIRED:
cert = self.sock.getpeercert()
hostname = self.host.split(':', 0)[0]
if not self._validate_certificate_hostname(cert, hostname):
raise InvalidCertificateException(hostname, cert,
'hostname mismatch')
不过每次SDK更新后都要重新修改一次。今天正好又遇到这个问题,于是干脆分享出来。
向下滚动可载入更多评论,或者点这里禁止自动加载。