19 |
|
private: |
20 |
|
virtual int handle(api::TcpSocket* client); |
21 |
|
protected: |
22 |
+ |
enum Status { ok = 200, found = 302, seeOther, bad = 400, notFound = 404, |
23 |
+ |
lengthRequired = 411, mediaType = 415, error = 500, notImplemented, |
24 |
+ |
version = 505 }; |
25 |
+ |
static string crlf; |
26 |
|
Daemon() {} |
27 |
|
void serve(int port, bool fork, Daemon* self); |
28 |
+ |
istream& getline(istream& sin, string& line) { ::getline(sin, line, '\r'); |
29 |
+ |
sin.get(); return sin; } |
30 |
+ |
Status request(istream& sin, Environment& env, ostream& post, ostream& log); |
31 |
+ |
void status(ostream& sout, Status status); |
32 |
|
public: |
33 |
|
Daemon(int port, bool fork) { Person::configure(); serve(port, fork, this); |
34 |
|
} |