1 #ifndef MSP_HTTP_SERVER_H_
2 #define MSP_HTTP_SERVER_H_
4 #include <msp/io/eventdispatcher.h>
5 #include <msp/net/streamserversocket.h>
6 #include <msp/time/timedelta.h>
17 sigc::signal<void, const Request &, Response &> signal_request;
22 std::unique_ptr<Net::StreamSocket> sock;
24 std::unique_ptr<Request> request;
25 std::unique_ptr<Response> response;
26 bool keepalive = false;
30 Client(std::unique_ptr<Net::StreamSocket>);
33 Net::StreamServerSocket sock;
34 std::list<Client> clients;
35 std::map<Response *, Client *> responses;
36 IO::EventDispatcher *event_disp = nullptr;
43 void listen(unsigned);
44 unsigned get_port() const;
45 void use_event_dispatcher(IO::EventDispatcher *);
46 void delay_response(Response &);
47 void submit_response(Response &);
48 void cancel_keepalive(Response &);
49 void close_connections(const Time::TimeDelta &);
51 void data_available();
52 void client_data_available(Client &);
53 void send_response(Client &, Response &);
54 void client_end_of_file(Client &);
55 Client &get_client_by_response(Response &);