| 68 | } |
| 69 | |
| 70 | void HTTPSSession::onReceivedRequestInternal(const HTTPRequest& request) |
| 71 | { |
| 72 | // Try to get the cached response |
| 73 | if (request.method() == "GET") |
| 74 | { |
| 75 | std::string_view url = request.url(); |
| 76 | size_t index = url.find('?'); |
| 77 | auto response = cache().find(std::string((index == std::string_view::npos) ? url : url.substr(0, index))); |
| 78 | if (response.first) |
| 79 | { |
| 80 | // Process the request with the cached response |
| 81 | onReceivedCachedRequest(request, response.second); |
| 82 | return; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | // Process the request |
| 87 | onReceivedRequest(request); |
| 88 | } |
| 89 | |
| 90 | } // namespace HTTP |
| 91 | } // namespace CppServer |