]> git.tdb.fi Git - libs/net.git/blobdiff - source/http/server.h
Reserve space for strings before appending characters
[libs/net.git] / source / http / server.h
index 41894db99d6141dc89c901c354d06b4f25ca25b3..4835de039c87b46781499a52e54cb901782b5188 100644 (file)
@@ -4,6 +4,7 @@
 #include <msp/core/refptr.h>
 #include <msp/io/eventdispatcher.h>
 #include <msp/net/streamserversocket.h>
+#include <msp/time/timedelta.h>
 
 namespace Msp {
 namespace Http {
@@ -23,6 +24,7 @@ private:
                std::string in_buf;
                Request *request;
                Response *response;
+               bool keepalive;
                bool async;
                bool stale;
 
@@ -32,17 +34,25 @@ private:
 
        Net::StreamServerSocket sock;
        std::list<Client> clients;
+       std::map<Response *, Client *> responses;
        IO::EventDispatcher *event_disp;
 
 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 &);
 };