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