summaryrefslogtreecommitdiff
path: root/src/modules/httpd.h
blob: 3f8ee215cdff88a723923ad7bc8601220edfb6b1 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "base.h"

#ifndef __HTTPD_H__
#define __HTTPD_H__

#include <string>
#include <sstream>

class HTTPRequest : public classbase
{
 protected:

	std::string type;
	std::string document;
	std::string ipaddr;
	std::stringstream* headers;

 public:

	void* sock;

	HTTPRequest(const std::string &request_type, const std::string &uri, std::stringstream* hdr, void* opaque, const std::string &ip)
		: type(request_type), document(uri), ipaddr(ip), headers(hdr), sock(opaque)
	{
	}

	std::stringstream* GetHeaders()
	{
		return headers;
	}

	std::string& GetType()
	{
		return type;
	}

	std::string& GetURI()
	{
		return document;
	}

	std::string& GetIP()
	{
		return ipaddr;
	}
};

class HTTPDocument : public classbase
{
 protected:
	std::stringstream* document;
	int responsecode;

 public:
	HTTPDocument(std::stringstream* doc, int response) : document(doc), responsecode(response)
	{
	}

	std::stringstream* GetDocument()
	{
		return this->document;
	}

	std::stringstream* GetDocumentSize()
	{
		return this->document.size();
	}

	int GetResponseCode()
	{
		return this->responsecode;
	}
};

#endif

//httpr(request_type,uri,headers,this,this->GetIP());