| 15 | using namespace CppServer::HTTP; |
| 16 | |
| 17 | class HTTPSTraceSession : public HTTPSSession |
| 18 | { |
| 19 | public: |
| 20 | using HTTPSSession::HTTPSSession; |
| 21 | |
| 22 | protected: |
| 23 | void onReceivedRequest(const HTTPRequest& request) override |
| 24 | { |
| 25 | // Process HTTP request methods |
| 26 | if (request.method() == "TRACE") |
| 27 | SendResponseAsync(response().MakeTraceResponse(request.cache())); |
| 28 | else |
| 29 | SendResponseAsync(response().MakeErrorResponse("Unsupported HTTP method: " + std::string(request.method()))); |
| 30 | } |
| 31 | |
| 32 | void onReceivedRequestError(const HTTPRequest& request, const std::string& error) override |
| 33 | { |
| 34 | std::cout << "Request error: " << error << std::endl; |
| 35 | } |
| 36 | |
| 37 | void onError(int error, const std::string& category, const std::string& message) override |
| 38 | { |
| 39 | std::cout << "HTTPS Trace session caught an error with code " << error << " and category '" << category << "': " << message << std::endl; |
| 40 | } |
| 41 | }; |
| 42 | |
| 43 | class HTTPSTraceServer : public HTTPSServer |
| 44 | { |
nothing calls this directly
no outgoing calls
no test coverage detected