X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhttp%2Fserver.h;h=d55b774d961392af735f2381444ba4193de57d05;hb=6625cf0e574406425c35d33110f8d99617e902df;hp=41894db99d6141dc89c901c354d06b4f25ca25b3;hpb=debe1004676d5431e571d9c4361072661dcc88c4;p=libs%2Fnet.git diff --git a/source/http/server.h b/source/http/server.h index 41894db..d55b774 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 = 0; + Response *response = 0; + bool keepalive = false; + bool async = false; + bool stale = false; Client(RefPtr); ~Client(); @@ -32,17 +34,25 @@ private: Net::StreamServerSocket sock; std::list clients; - IO::EventDispatcher *event_disp; + std::map responses; + IO::EventDispatcher *event_disp = 0; 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 &); };