#pragma once // Minimal loopback HTTP/1.1 server for manual verification and the real-HTTP // round-trip test. Sequential accept loop, static caps, no TLS, no HTTP/2. // Gap: real event loop, timeouts, keep-alive, H2, and compression live in // 01-runtime.md; this server exists only to prove the stack end to end. #include #include #include #include #include "App.hpp" namespace molo::example::fw { class Server { public: explicit Server(std::shared_ptr app); ~Server(); Server(const Server&) = delete; Server& operator=(const Server&) = delete; bool start(const std::string& host, int port); void stop(); int port() const; bool running() const; private: void loop(); void handle_one(int fd); std::shared_ptr app_; int listen_fd_ = -1; int port_ = 0; std::atomic running_{false}; std::thread worker_; }; std::string http_roundtrip(const std::string& host, int port, const std::string& raw_request); } // namespace molo::example::fw