mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
ProtocolServer+LibProtocol: Propagate HTTP status codes to clients
Clients now receive HTTP status codes like 200, 404, etc. Note that a 404 with content is still considered a "successful" download from ProtocolServer's perspective. It's up to the client to interpret the status code. I'm not sure if this is the best API, but it'll work for now.
This commit is contained in:
parent
d9ece296f0
commit
1678aaa555
11 changed files with 20 additions and 10 deletions
|
@ -41,7 +41,7 @@ bool Download::stop()
|
|||
return m_client->stop_download({}, *this);
|
||||
}
|
||||
|
||||
void Download::did_finish(Badge<Client>, bool success, u32 total_size, i32 shbuf_id, const IPC::Dictionary& response_headers)
|
||||
void Download::did_finish(Badge<Client>, bool success, Optional<u32> status_code, u32 total_size, i32 shbuf_id, const IPC::Dictionary& response_headers)
|
||||
{
|
||||
if (!on_finish)
|
||||
return;
|
||||
|
@ -59,7 +59,7 @@ void Download::did_finish(Badge<Client>, bool success, u32 total_size, i32 shbuf
|
|||
caseless_response_headers.set(name, value);
|
||||
});
|
||||
|
||||
on_finish(success, payload, move(shared_buffer), caseless_response_headers);
|
||||
on_finish(success, payload, move(shared_buffer), caseless_response_headers, status_code);
|
||||
}
|
||||
|
||||
void Download::did_progress(Badge<Client>, Optional<u32> total_size, u32 downloaded_size)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue