mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
ProtocolServer: Add some debug log output for failed downloads
To make it easier to work out what went wrong.
This commit is contained in:
parent
7be2c9864e
commit
3e8050f002
Notes:
sideshowbarker
2024-07-19 00:10:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3e8050f0027
1 changed files with 10 additions and 4 deletions
|
@ -60,15 +60,21 @@ OwnPtr<Messages::ProtocolServer::IsSupportedProtocolResponse> ClientConnection::
|
|||
|
||||
OwnPtr<Messages::ProtocolServer::StartDownloadResponse> 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<Messages::ProtocolServer::StartDownloadResponse>(-1, Optional<IPC::File> {});
|
||||
}
|
||||
auto* protocol = Protocol::find_by_name(url.protocol());
|
||||
if (!protocol)
|
||||
if (!protocol) {
|
||||
dbgln("StartDownload: No protocol handler for URL: '{}'", url);
|
||||
return make<Messages::ProtocolServer::StartDownloadResponse>(-1, Optional<IPC::File> {});
|
||||
}
|
||||
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<Messages::ProtocolServer::StartDownloadResponse>(-1, Optional<IPC::File> {});
|
||||
}
|
||||
auto id = download->id();
|
||||
auto fd = download->download_fd();
|
||||
m_downloads.set(id, move(download));
|
||||
|
|
Loading…
Add table
Reference in a new issue