| 169 | }; |
| 170 | |
| 171 | class HTTPSCacheServer : public HTTPSServer |
| 172 | { |
| 173 | public: |
| 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 | |
| 186 | protected: |
| 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 | |
| 192 | protected: |
| 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 | |
| 200 | TEST_CASE("HTTPS server & client test", "[CppServer][HTTP]") |
| 201 | { |
nothing calls this directly
no outgoing calls
no test coverage detected