10 #include <winsock.h>
\r
12 #include "Raym/Raym.h"
\r
14 #include "net/HTTPRequest.h"
\r
15 #include "net/HTTPResponse.h"
\r
21 class HTTPDaemonDelegate
\r
24 virtual HTTPResponse *request(HTTPRequest *request, struct sockaddr_in *client) = 0;
\r
28 class HTTPDaemon : public Raym::Object
\r
33 HTTPDaemonDelegate * _delegate;
\r
34 Raym::String * _rootPath;
\r
48 static HTTPDaemon *alloc();
\r
49 HTTPDaemon *initWithPort(int port, int backlog);
\r
51 void setDelegate(HTTPDaemonDelegate *delegate);
\r
52 void setRootPath(Raym::String *path);
\r
53 Raym::String *rootPath();
\r
59 HTTPResponse *responseWithReason(Raym::String *reason, int status, Raym::String *version);
\r
60 HTTPResponse *responseWithPath(Raym::String *path, HTTPRequest *request);
\r
61 static Raym::String *reasonForStatus(int status);
\r
64 Raym::Array * _sockets;
\r
65 void session(SOCKET sock, struct sockaddr_in *client);
\r
67 virtual const char *className();
\r
71 class HTTPDaemonSessionArgs
\r
74 HTTPDaemon * _daemon;
\r
76 struct sockaddr_in _client;
\r