ZenLib
Http_Handler.h
Go to the documentation of this file.
1 // ZenLib::Format::Http::Request - A HTTP request
2 // Copyright (C) 2008-2011 MediaArea.net SARL, Info@MediaArea.net
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would be
15 // appreciated but is not required.
16 // 2. Altered source versions must be plainly marked as such, and must not be
17 // misrepresented as being the original software.
18 // 3. This notice may not be removed or altered from any source distribution.
19 //
20 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 //
23 // A HTTP Request
24 //
25 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
26 
27 //---------------------------------------------------------------------------
28 #ifndef ZenLib_Format_Http_RequestH
29 #define ZenLib_Format_Http_RequestH
30 //---------------------------------------------------------------------------
31 
32 //---------------------------------------------------------------------------
34 #include <string>
35 #include <ctime>
36 #include <map>
37 #include <vector>
38 //---------------------------------------------------------------------------
39 
40 namespace ZenLib
41 {
42 
43 namespace Format
44 {
45 
46 namespace Http
47 {
48 
49 //***************************************************************************
50 /// @brief
51 //***************************************************************************
52 
53 class Handler
54 {
55 public:
56  //Constructor/Destructor
57  Handler();
58 
59  //In
60  std::string Path; //The path being requested by this request
61  std::map<std::string, std::string> Request_Headers; //All the incoming HTTP headers from the client web browser.
62  std::map<std::string, std::string> Request_Cookies; //The set of cookies that came from the client along with this request
63  std::map<std::string, std::string> Request_Queries; //All the key/value pairs in the query string of this request
64  std::string Foreign_IP; //The foreign ip address for this request
65  std::string Local_IP; //The foreign port number for this request
66  unsigned short Foreign_Port; //The IP of the local interface this request is coming in on
67  unsigned short Local_Port; //The local port number this request is coming in on
68  bool HeadersOnly; //The request requests only the header
69 
70  //Out
71  size_t Response_HTTP_Code; //HTTP code to be sent
72  std::map<std::string, std::string> Response_Headers; //Additional headers you wish to appear in the HTTP response to this request
73  Cookies Response_Cookies; //New cookies to pass back to the client along with the result of this request
74  std::string Response_Body; //To be displayed as the response to this request
75 };
76 
77 } //Namespace
78 
79 } //Namespace
80 
81 } //Namespace
82 
83 #endif
84 
85 
86 
87