void WebResourceLoader::didReceiveResponseWithCertificateInfo(const ResourceResponse& response, const CertificateInfo& certificateInfo, bool needsContinueDidReceiveResponseMessage) { LOG(Network, "(WebProcess) WebResourceLoader::didReceiveResponseWithCertificateInfo for '%s'. Status %d.", m_coreLoader->url().string().utf8().data(), response.httpStatusCode()); Ref<WebResourceLoader> protect(*this); ResourceResponse responseCopy(response); #if USE(QUICK_LOOK) m_quickLookHandle = QuickLookHandle::create(resourceLoader(), response.nsURLResponse()); if (m_quickLookHandle) responseCopy = ResourceResponse(m_quickLookHandle->nsResponse()); #endif // FIXME: This should use CertificateInfo to avoid the platform ifdefs. See https://bugs.webkit.org/show_bug.cgi?id=124724. #if PLATFORM(COCOA) responseCopy.setCertificateChain(certificateInfo.certificateChain()); #elif USE(SOUP) responseCopy.setSoupMessageCertificate(certificateInfo.certificate()); responseCopy.setSoupMessageTLSErrors(certificateInfo.tlsErrors()); #endif if (m_coreLoader->documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(m_coreLoader.get(), responseCopy)) return; m_coreLoader->didReceiveResponse(responseCopy); // If m_coreLoader becomes null as a result of the didReceiveResponse callback, we can't use the send function(). if (!m_coreLoader) return; if (needsContinueDidReceiveResponseMessage) send(Messages::NetworkResourceLoader::ContinueDidReceiveResponse()); }
bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder& decoder, ResourceError& resourceError) { CertificateInfo certificateInfo; if (!decoder.decode(certificateInfo)) return false; resourceError.setCertificate(certificateInfo.certificate()); resourceError.setTLSErrors(certificateInfo.tlsErrors()); return true; }
bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder& decoder, ResourceError& resourceError) { bool errorIsNull; if (!decoder.decode(errorIsNull)) return false; if (errorIsNull) { resourceError = ResourceError(); return true; } String domain; if (!decoder.decode(domain)) return false; int errorCode; if (!decoder.decode(errorCode)) return false; String failingURL; if (!decoder.decode(failingURL)) return false; String localizedDescription; if (!decoder.decode(localizedDescription)) return false; bool isCancellation; if (!decoder.decode(isCancellation)) return false; bool isTimeout; if (!decoder.decode(isTimeout)) return false; resourceError = ResourceError(domain, errorCode, URL(URL(), failingURL), localizedDescription); resourceError.setIsCancellation(isCancellation); resourceError.setIsTimeout(isTimeout); CertificateInfo certificateInfo; if (!decoder.decode(certificateInfo)) return false; resourceError.setCertificate(certificateInfo.certificate()); resourceError.setTLSErrors(certificateInfo.tlsErrors()); return true; }
void ArgumentCoder<CertificateInfo>::encode(ArgumentEncoder& encoder, const CertificateInfo& certificateInfo) { if (!certificateInfo.certificate()) { encoder << false; return; } GByteArray* certificateData = 0; g_object_get(G_OBJECT(certificateInfo.certificate()), "certificate", &certificateData, NULL); if (!certificateData) { encoder << false; return; } encoder << true; GRefPtr<GByteArray> certificate = adoptGRef(certificateData); encoder.encodeVariableLengthByteArray(IPC::DataReference(certificate->data, certificate->len)); encoder << static_cast<uint32_t>(certificateInfo.tlsErrors()); }