SNode.C
Loading...
Searching...
No Matches
SocketContextUpgradeFactorySelector.h
Go to the documentation of this file.
1/*
2 * snode.c - a slim toolkit for network communication
3 * Copyright (C) Volker Christian <me@vchrist.at>
4 * 2020, 2021, 2022, 2023, 2024, 2025
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef WEB_HTTP_SERVER_SOCKETCONTEXTUPGRADEFACTORYSELECTOR_H
21#define WEB_HTTP_SERVER_SOCKETCONTEXTUPGRADEFACTORYSELECTOR_H
22
23#include "web/http/SocketContextUpgradeFactorySelector.h"
24#include "web/http/server/SocketContextUpgradeFactory.h" // IWYU pragma: export
25
26// IWYU pragma: no_include "web/http/SocketContextUpgradeFactorySelector.hpp"
27
28#ifndef DOXYGEN_SHOULD_SKIP_THIS
29
30#endif /* DOXYGEN_SHOULD_SKIP_THIS */
31
32namespace web::http::server {
33
34 class SocketContextUpgradeFactorySelector
35 : public web::http::SocketContextUpgradeFactorySelector<web::http::server::SocketContextUpgradeFactory> {
36 private:
37 using Super = web::http::SocketContextUpgradeFactorySelector<web::http::server::SocketContextUpgradeFactory>;
38
39 using Super::load;
40 SocketContextUpgradeFactory* load(const std::string& socketContextUpgradeName) override;
41
42 public:
43 static SocketContextUpgradeFactorySelector* instance();
44
45 using Super::select;
46 SocketContextUpgradeFactory* select(Request& req, Response& res) override;
47 };
48
49} // namespace web::http::server
50
51extern template class web::http::SocketContextUpgradeFactorySelector<web::http::server::SocketContextUpgradeFactory>;
52
53#endif // WEB_HTTP_SERVER_SOCKETCONTEXTUPGRADEFACTORYSELECTOR_H
virtual void stop()=0
virtual void start()=0
void onSourceData(const char *chunk, std::size_t chunkLen) override
Definition Response.cpp:405
Response(SocketContext *socketContext)
Definition Response.cpp:50
SocketContext * getSocketContext() const
Definition Response.cpp:432
void onSourceConnect(core::pipe::Source *source) override
Definition Response.cpp:391
Response & status(int statusCode)
Definition Response.cpp:80
void send(const std::string &chunk)
Definition Response.cpp:202
void send(const char *chunk, std::size_t chunkLen)
Definition Response.cpp:191
Response & setTrailer(const std::string &field, const std::string &value, bool overwrite=true)
Definition Response.cpp:172
Response & set(const std::map< std::string, std::string > &headers, bool overwrite=true)
Definition Response.cpp:98
Response & set(const std::string &field, const std::string &value, bool overwrite=true)
Definition Response.cpp:106
void upgrade(const std::shared_ptr< Request > &request, const std::function< void(const std::string &)> &status)
Definition Response.cpp:222
Response & type(const std::string &type)
Definition Response.cpp:152
void onSourceError(int errnum) override
Definition Response.cpp:417
Response & sendFragment(const std::string &chunk)
Definition Response.cpp:364
Response & cookie(const std::string &name, const std::string &value, const std::map< std::string, std::string > &options={})
Definition Response.cpp:156
Response & append(const std::string &field, const std::string &value)
Definition Response.cpp:86
void sendStatus(int statusCode)
Definition Response.cpp:210
Response & sendFragment(const char *chunk, std::size_t chunkLen)
Definition Response.cpp:346
void onSourceEof() override
Definition Response.cpp:409
void sendFile(const std::string &file, const std::function< void(int)> &callback)
Definition Response.cpp:270
Response & clearCookie(const std::string &name, const std::map< std::string, std::string > &options={})
Definition Response.cpp:162
const std::string & header(const std::string &field)
Definition Response.cpp:428
#define to_hex_str(int_val)
Definition Request.cpp:49