MCPcopy Create free account
hub / github.com/chronoxor/CppServer / HTTPSCacheServer

Class HTTPSCacheServer

tests/test_https.cpp:171–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169};
170
171class HTTPSCacheServer : public HTTPSServer
172{
173public:
174 using HTTPSServer::HTTPSServer;
175
176 static std::shared_ptr<SSLContext> CreateContext()
177 {
178 auto context = std::make_shared<SSLContext>(asio::ssl::context::tlsv13);
179 context->set_password_callback([](size_t max_length, asio::ssl::context::password_purpose purpose) -> std::string { return "qwerty"; });
180 context->use_certificate_chain_file("../tools/certificates/server.pem");
181 context->use_private_key_file("../tools/certificates/server.pem", asio::ssl::context::pem);
182 context->use_tmp_dh_file("../tools/certificates/dh4096.pem");
183 return context;
184 }
185
186protected:
187 std::shared_ptr<SSLSession> CreateSession(const std::shared_ptr<SSLServer>& server) override
188 {
189 return std::make_shared<HTTPSCacheSession>(std::dynamic_pointer_cast<HTTPSServer>(server));
190 }
191
192protected:
193 void onError(int error, const std::string& category, const std::string& message) override
194 {
195 std::cout << "HTTPS server caught an error with code " << error << " and category '" << category << "': " << message << std::endl;
196 FAIL();
197 }
198};
199
200TEST_CASE("HTTPS server & client test", "[CppServer][HTTP]")
201{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected