1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 17:15:08 +00:00

ProtocolServer+LibTLS: Pipe certificate requests from LibTLS to clients

This makes gemini.circumlunar.space (and some more gemini pages) work
again :^)
This commit is contained in:
AnotherTest 2020-08-02 05:27:42 +04:30 committed by Andreas Kling
parent 9d3ffa096a
commit 97256ad977
22 changed files with 161 additions and 3 deletions

View file

@ -68,6 +68,13 @@ bool Client::stop_download(Badge<Download>, Download& download)
return send_sync<Messages::ProtocolServer::StopDownload>(download.id())->success();
}
bool Client::set_certificate(Badge<Download>, Download& download, String certificate, String key)
{
if (!m_downloads.contains(download.id()))
return false;
return send_sync<Messages::ProtocolServer::SetCertificate>(download.id(), move(certificate), move(key))->success();
}
void Client::handle(const Messages::ProtocolClient::DownloadFinished& message)
{
RefPtr<Download> download;
@ -85,4 +92,13 @@ void Client::handle(const Messages::ProtocolClient::DownloadProgress& message)
}
}
OwnPtr<Messages::ProtocolClient::CertificateRequestedResponse> Client::handle(const Messages::ProtocolClient::CertificateRequested& message)
{
if (auto download = const_cast<Download*>(m_downloads.get(message.download_id()).value_or(nullptr))) {
download->did_request_certificates({});
}
return make<Messages::ProtocolClient::CertificateRequestedResponse>();
}
}