1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 10:55:07 +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

@ -111,6 +111,11 @@ void ClientConnection::did_progress_download(Badge<Download>, Download& download
post_message(Messages::ProtocolClient::DownloadProgress(download.id(), download.total_size(), download.downloaded_size()));
}
void ClientConnection::did_request_certificates(Badge<Download>, Download& download)
{
post_message(Messages::ProtocolClient::CertificateRequested(download.id()));
}
OwnPtr<Messages::ProtocolServer::GreetResponse> ClientConnection::handle(const Messages::ProtocolServer::Greet&)
{
return make<Messages::ProtocolServer::GreetResponse>(client_id());
@ -122,4 +127,15 @@ OwnPtr<Messages::ProtocolServer::DisownSharedBufferResponse> ClientConnection::h
return make<Messages::ProtocolServer::DisownSharedBufferResponse>();
}
OwnPtr<Messages::ProtocolServer::SetCertificateResponse> ClientConnection::handle(const Messages::ProtocolServer::SetCertificate& message)
{
auto* download = const_cast<Download*>(m_downloads.get(message.download_id()).value_or(nullptr));
bool success = false;
if (download) {
download->set_certificate(message.certificate(), message.key());
success = true;
}
return make<Messages::ProtocolServer::SetCertificateResponse>(success);
}
}