00001 #ifndef __PARSEDHTTPREQUEST_GM_H__
00002 #define __PARSEDHTTPREQUEST_GM_H__
00003
00004 #include "string"
00005 #include "map"
00006 #include "stdlib.h"
00007
00008
00009 class ParsedHttpRequest
00010 {
00011 protected:
00012 std::string _Raw_Text;
00013 std::string _RequestType;
00014 std::string _RequestText;
00015 std::string _Requestoptions;
00016 std::string _BodyText;
00017
00018
00019 std::map<std::string,std::string> _parameters;
00020 std::map<std::string,std::string> _header_Lines;
00021
00022 std::string deCanonicalize(std::string &inval);
00023 size_t PullCR(std::string &src, std::string &dst);
00024
00025 public:
00026 void clear(void);
00027 const std::string GetRequestOptionString() { return _Requestoptions; };
00028 const std::string * GetOption(const std::string & query);
00029 bool GetOption(const std::string & query, std::string & out_value);
00030 bool ParseThis(char * request);
00031 std::string & GetRequestURL(void);
00032 const std::string & GetRawRequest(void) const { return _Raw_Text; };
00033 const std::string & GetRequestType(void) const { return _RequestType; };
00034 bool ProcessOptionString(std::string str);
00035 bool ProcessParamSet(std::string &str);
00036
00037
00038 void SetBodyText(const std::string & text)
00039 {
00040 _BodyText = text;
00041 }
00042
00043 const std::string & getBodyText() { return _BodyText; };
00044
00045 int getContentLength()
00046 {
00047 int answer = 0;
00048 std::map<std::string,std::string>::iterator ii = _header_Lines.find("Content-Length");
00049 if(ii != _header_Lines.end())
00050 answer = atol(ii->second.c_str());
00051
00052 return answer;
00053 };
00054 };
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 #endif //__PARSEDHTTPREQUEST_GM_H__
00144