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 HTTPRequest *readRequest(SOCKET sock) = 0;
\r
25 virtual HTTPResponse *request(HTTPRequest *request, SOCKET sock, struct sockaddr_in *client) = 0;
\r
29 class HTTPDaemon : public Raym::Object
\r
34 HTTPDaemonDelegate * _delegate;
\r
35 Raym::String * _rootPath;
\r
49 static HTTPDaemon *alloc();
\r
50 HTTPDaemon *initWithPort(int port, int backlog);
\r
52 void setDelegate(HTTPDaemonDelegate *delegate);
\r
53 void setRootPath(Raym::String *path);
\r
54 Raym::String *rootPath();
\r
60 HTTPResponse *responseWithReason(Raym::String *reason, int status, Raym::String *version);
\r
61 HTTPResponse *responseWithPath(Raym::String *path, HTTPRequest *request);
\r
62 static HTTPResponse *responseOfUnnecessary();
\r
63 static Raym::String *reasonForStatus(int status);
\r
66 Raym::Array * _sockets;
\r
67 void session(SOCKET sock, struct sockaddr_in *client);
\r
69 virtual const char *className();
\r
73 class HTTPDaemonSessionArgs
\r
76 HTTPDaemon * _daemon;
\r
78 struct sockaddr_in _client;
\r