]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/httpd.h
So much stuff changed in this one, i forgot most of it.
[user/henk/code/inspircd.git] / src / modules / httpd.h
1 #include "base.h"
2
3 #ifndef __HTTPD_H__
4 #define __HTTPD_H__
5
6 #include <string>
7 #include <sstream>
8
9 class HTTPRequest : public classbase
10 {
11  protected:
12
13         std::string type;
14         std::string document;
15         std::string ipaddr;
16         std::stringstream* headers;
17
18  public:
19
20         void* sock;
21
22         HTTPRequest(const std::string &request_type, const std::string &uri, std::stringstream* hdr, void* opaque, const std::string &ip)
23                 : type(request_type), document(uri), ipaddr(ip), headers(hdr), sock(opaque)
24         {
25         }
26
27         std::stringstream* GetHeaders()
28         {
29                 return headers;
30         }
31
32         std::string& GetType()
33         {
34                 return type;
35         }
36
37         std::string& GetURI()
38         {
39                 return document;
40         }
41
42         std::string& GetIP()
43         {
44                 return ipaddr;
45         }
46 };
47
48 class HTTPDocument : public classbase
49 {
50  protected:
51         std::stringstream* document;
52         int responsecode;
53         std::string extraheaders;
54
55  public:
56
57         void* sock;
58
59         HTTPDocument(void* opaque, std::stringstream* doc, int response, const std::string &extra) : document(doc), responsecode(response), extraheaders(extra), sock(opaque)
60         {
61         }
62
63         std::stringstream* GetDocument()
64         {
65                 return this->document;
66         }
67
68         unsigned long GetDocumentSize()
69         {
70                 return this->document->str().length();
71         }
72
73         int GetResponseCode()
74         {
75                 return this->responsecode;
76         }
77
78         std::string& GetExtraHeaders()
79         {
80                 return this->extraheaders;
81         }
82 };
83
84 #endif
85
86 //httpr(request_type,uri,headers,this,this->GetIP());
87