mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
ProtocolServer+LibProtocol: Introduce a server for handling downloads
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. :^)
This commit is contained in:
parent
61f611bf3c
commit
fd4349a9f2
21 changed files with 475 additions and 0 deletions
23
Servers/ProtocolServer/Protocol.h
Normal file
23
Servers/ProtocolServer/Protocol.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/URL.h>
|
||||
|
||||
class Download;
|
||||
class PSClientConnection;
|
||||
|
||||
class Protocol {
|
||||
public:
|
||||
virtual ~Protocol();
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
virtual RefPtr<Download> start_download(PSClientConnection&, const URL&) = 0;
|
||||
|
||||
static Protocol* find_by_name(const String&);
|
||||
|
||||
protected:
|
||||
explicit Protocol(const String& name);
|
||||
|
||||
private:
|
||||
String m_name;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue