mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 11:45:11 +00:00

The DownloadFinished message from the server now includes a buffer ID that can be mapped into the client program. To avoid prematurely destroying the buffer, the server will hang on to it until the client lets it know that they're all good. That's what the ProtocolServer::DisownSharedBuffer message is about. In the future it would be nice if the kernel had a mechanism to allow passing ownership of a shared buffer along with an IPC message somehow.
22 lines
604 B
C++
22 lines
604 B
C++
#include <LibCore/CHttpJob.h>
|
|
#include <LibCore/CHttpResponse.h>
|
|
#include <ProtocolServer/HttpDownload.h>
|
|
|
|
HttpDownload::HttpDownload(PSClientConnection& client, NonnullRefPtr<CHttpJob>&& job)
|
|
: Download(client)
|
|
, m_job(job)
|
|
{
|
|
m_job->on_finish = [this](bool success) {
|
|
set_payload(m_job->response()->payload());
|
|
did_finish(success);
|
|
};
|
|
}
|
|
|
|
HttpDownload::~HttpDownload()
|
|
{
|
|
}
|
|
|
|
NonnullRefPtr<HttpDownload> HttpDownload::create_with_job(Badge<HttpProtocol>, PSClientConnection& client, NonnullRefPtr<CHttpJob>&& job)
|
|
{
|
|
return adopt(*new HttpDownload(client, move(job)));
|
|
}
|