mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:57:35 +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
|
@ -49,6 +49,10 @@ int main(int argc, char** argv)
|
|||
auto protocol_client = Protocol::Client::construct();
|
||||
|
||||
auto download = protocol_client->start_download(url.to_string());
|
||||
if (!download) {
|
||||
fprintf(stderr, "Failed to start download for '%s'\n", url_string.characters());
|
||||
return 1;
|
||||
}
|
||||
download->on_progress = [](u32 total_size, u32 downloaded_size) {
|
||||
dbgprintf("download progress: %u / %u\n", downloaded_size, total_size);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue