306 |
306 |
307 mainFrameRequest = frame == self.mainFrame() |
307 mainFrameRequest = frame == self.mainFrame() |
308 |
308 |
309 if mainFrameRequest and \ |
309 if mainFrameRequest and \ |
310 self.__sslInfo is not None and \ |
310 self.__sslInfo is not None and \ |
311 not self.__domainSchemeMatch(reply.url(), self.__sslInfo.url): |
311 reply.url() == self.mainFrame().url(): |
312 self.__sslInfo = None |
312 self.__sslInfo = None |
313 |
313 |
314 if reply.error() == QNetworkReply.NoError and \ |
314 if reply.error() == QNetworkReply.NoError and \ |
315 mainFrameRequest and \ |
315 mainFrameRequest and \ |
316 self.__sslInfo is None and \ |
316 self.__sslInfo is None and \ |
317 reply.url().scheme().lower() == "https": |
317 reply.url().scheme().lower() == "https" and \ |
|
318 reply.url() == self.mainFrame().url(): |
318 self.__sslInfo = reply.sslConfiguration().peerCertificate() |
319 self.__sslInfo = reply.sslConfiguration().peerCertificate() |
319 self.__sslInfo.url = QUrl(reply.url()) |
320 self.__sslInfo.url = QUrl(reply.url()) |
320 |
321 |
321 def __domainSchemeMatch(self, url1, url2): |
322 def getSslInfo(self): |
322 """ |
323 """ |
323 Private method to check, if to URLs belong to the same domain. |
324 Public method to get a reference to the SSL info object. |
324 |
325 |
325 @param url1 first URL (QUrl) |
326 @return reference to the SSL info (QSslCertificate) |
326 @param url2 second URL (QUrl) |
327 """ |
327 @return flag indicating a match (boolean) |
328 return self.__sslInfo |
328 """ |
|
329 if url1.scheme() != url2.scheme(): |
|
330 return False |
|
331 |
|
332 url1L = url1.host().lower().split(".") |
|
333 url2L = url2.host().lower().split(".") |
|
334 if min(len(url1L), len(url2L)) < 2: |
|
335 return False |
|
336 |
|
337 return url1L[-2:] == url2L[-2:] |
|
338 |
329 |
339 ########################################################################################## |
330 ########################################################################################## |
340 |
331 |
341 class HelpBrowser(QWebView): |
332 class HelpBrowser(QWebView): |
342 """ |
333 """ |