X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhttp%2Fserver.h;h=e6de22781d17077a8e26a66925231780de4c518d;hb=3ab65d35cfd696002e09768a38f98e6a2e1ade81;hp=04c2d06b5cf6d386fa7d3f357036f3efaabba4df;hpb=f839e84e68924129a9fa5941ad82e4e9cc1def4d;p=libs%2Fnet.git diff --git a/source/http/server.h b/source/http/server.h index 04c2d06..e6de227 100644 --- a/source/http/server.h +++ b/source/http/server.h @@ -4,6 +4,7 @@ #include #include #include +#include namespace Msp { namespace Http { @@ -21,10 +22,11 @@ private: { RefPtr sock; std::string in_buf; - Request *request; - Response *response; - bool async; - bool stale; + Request *request = nullptr; + Response *response = nullptr; + bool keepalive = false; + bool async = false; + bool stale = false; Client(RefPtr); ~Client(); @@ -33,19 +35,24 @@ private: Net::StreamServerSocket sock; std::list clients; std::map responses; - IO::EventDispatcher *event_disp; + IO::EventDispatcher *event_disp = nullptr; public: + Server(); Server(unsigned); ~Server(); + void listen(unsigned); unsigned get_port() const; void use_event_dispatcher(IO::EventDispatcher *); void delay_response(Response &); void submit_response(Response &); + void cancel_keepalive(Response &); + void close_connections(const Time::TimeDelta &); private: void data_available(); void client_data_available(Client &); + void send_response(Client &, Response &); void client_end_of_file(Client &); Client &get_client_by_response(Response &); };