diff --git a/Services/ProtocolServer/ClientConnection.cpp b/Services/ProtocolServer/ClientConnection.cpp index 2d80c924e0..e966d2f2f4 100644 --- a/Services/ProtocolServer/ClientConnection.cpp +++ b/Services/ProtocolServer/ClientConnection.cpp @@ -60,15 +60,21 @@ OwnPtr ClientConnection:: OwnPtr ClientConnection::handle(const Messages::ProtocolServer::StartDownload& message) { - URL url(message.url()); - if (!url.is_valid()) + const auto& url = message.url(); + if (!url.is_valid()) { + dbgln("StartDownload: Invalid URL requested: '{}'", url); return make(-1, Optional {}); + } auto* protocol = Protocol::find_by_name(url.protocol()); - if (!protocol) + if (!protocol) { + dbgln("StartDownload: No protocol handler for URL: '{}'", url); return make(-1, Optional {}); + } auto download = protocol->start_download(*this, message.method(), url, message.request_headers().entries(), message.request_body()); - if (!download) + if (!download) { + dbgln("StartDownload: Protocol handler failed to start download: '{}'", url); return make(-1, Optional {}); + } auto id = download->id(); auto fd = download->download_fd(); m_downloads.set(id, move(download));