mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
ProtocolServer+LibProtocol: Reject unhandled URLs instead of asserting
StartDownload requests for unhandled protocols (or invalid URLs) will now refuse to load instead of asserting. A failure code is sent back to LibProtocol and Protocol::Client::start_download() returns nullptr. Fixes #1604.
This commit is contained in:
parent
53d0ca2ad8
commit
fc5067afd2
4 changed files with 15 additions and 2 deletions
|
@ -57,9 +57,11 @@ OwnPtr<Messages::ProtocolServer::IsSupportedProtocolResponse> PSClientConnection
|
|||
OwnPtr<Messages::ProtocolServer::StartDownloadResponse> PSClientConnection::handle(const Messages::ProtocolServer::StartDownload& message)
|
||||
{
|
||||
URL url(message.url());
|
||||
ASSERT(url.is_valid());
|
||||
if (!url.is_valid())
|
||||
return make<Messages::ProtocolServer::StartDownloadResponse>(-1);
|
||||
auto* protocol = Protocol::find_by_name(url.protocol());
|
||||
ASSERT(protocol);
|
||||
if (!protocol)
|
||||
return make<Messages::ProtocolServer::StartDownloadResponse>(-1);
|
||||
auto download = protocol->start_download(*this, url);
|
||||
return make<Messages::ProtocolServer::StartDownloadResponse>(download->id());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue