aboutsummaryrefslogtreecommitdiff
path: root/lib/network/http_file.h
blob: 88bffc606f216e587295bac2a183dde48d3a2490 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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