aboutsummaryrefslogtreecommitdiff
path: root/lib/network/http_file.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/network/http_file.h')
-rw-r--r--lib/network/http_file.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/network/http_file.h b/lib/network/http_file.h
new file mode 100644
index 00000000..88bffc60
--- /dev/null
+++ b/lib/network/http_file.h
@@ -0,0 +1,37 @@
+#ifndef __http_file_h
+#define __http_file_h
+
+#include "httpd.h"
+
+class eHTTPFile: public eHTTPDataSource
+{
+ int fd, size;
+ const char *mime;
+ int method;
+public:
+ enum { methodGET, methodPUT };
+ eHTTPFile(eHTTPConnection *c, int fd, int method, const char *mime);
+ ~eHTTPFile();
+ int doWrite(int);
+ void haveData(void *data, int len);
+};
+
+class eHTTPFilePathResolver: public eHTTPPathResolver
+{
+ struct eHTTPFilePath
+ {
+ eString path;
+ eString root;
+ int authorized; // must be authorized (1 means read, 2 write)
+ eHTTPFilePath(eString path, eString root, int authorized): path(path), root(root), authorized(authorized)
+ {
+ }
+ };
+ ePtrList<eHTTPFilePath> translate;
+public:
+ eHTTPFilePathResolver();
+ eHTTPDataSource *getDataSource(eString request, eString path, eHTTPConnection *conn);
+ void addTranslation(eString path, eString root, int auth);
+};
+
+#endif