mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-25 19:02:07 -05:00
71d27abb97
The current ProtocolServer was really only used for requests, and with the recent introduction of the WebSocket service, long-lasting connections with another server are not part of it. To better reflect this, this commit renames it to RequestServer. This commit also changes the existing 'protocol' portal to 'request', the existing 'protocol' user and group to 'request', and most mentions of the 'download' aspect of the request to 'request' when relevant, to make everything consistent across the system. Note that LibProtocol still exists as-is, but the more generic Client class and the more specific Download class have both been renamed to a more accurate RequestClient and Request to match the new names. This commit only change names, not behaviors.
37 lines
800 B
C++
37 lines
800 B
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/RefPtr.h>
|
|
#include <AK/Result.h>
|
|
#include <AK/URL.h>
|
|
#include <RequestServer/Forward.h>
|
|
|
|
namespace RequestServer {
|
|
|
|
class Protocol {
|
|
public:
|
|
virtual ~Protocol();
|
|
|
|
const String& name() const { return m_name; }
|
|
virtual OwnPtr<Request> start_request(ClientConnection&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) = 0;
|
|
|
|
static Protocol* find_by_name(const String&);
|
|
|
|
protected:
|
|
explicit Protocol(const String& name);
|
|
struct Pipe {
|
|
int read_fd { -1 };
|
|
int write_fd { -1 };
|
|
};
|
|
static Result<Pipe, String> get_pipe_for_request();
|
|
|
|
private:
|
|
String m_name;
|
|
};
|
|
|
|
}
|