mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 00:55:06 +00:00

This patch adds ProtocolServer, a server that handles network requests on behalf of its clients. The first protocol implemented is HTTP. The idea here is to use a plug-in architecture where any number of protocols can be added and implemented without having to mess around with each client program that wants to use the protocol. A simple client API is provided through LibProtocol::Client. :^)
20 lines
518 B
C++
20 lines
518 B
C++
#include <LibCore/CHttpJob.h>
|
|
#include <ProtocolServer/HttpDownload.h>
|
|
|
|
HttpDownload::HttpDownload(PSClientConnection& client, NonnullRefPtr<CHttpJob>&& job)
|
|
: Download(client)
|
|
, m_job(job)
|
|
{
|
|
m_job->on_finish = [this](bool success) {
|
|
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)));
|
|
}
|