在twisted中调用connectionMade中的getPeerCertificate返回None我能做什么
class Handler(Protocol):
def dataReceived(self, data):
print self.transport.getPeerCertificate().get_subject().commonName
def connectionMade(self):
print self.transport.getPeerCertificate().get_subject().commonName
不要在
connectionMade
中调用getPeerCertificate
。正如您可能已经观察到的,如果您在dataReceived
中调用它,它将返回一个正确的证书。在相关问题 更多 >
编程相关推荐