HttpRequest Class Reference#include <HttpRequest.h>
Inheritance diagram for HttpRequest:
![]()
Collaboration diagram for HttpRequest:
![]()
Detailed DescriptionDefinition at line 47 of file HttpRequest.h. Constructor & Destructor Documentation
Definition at line 54 of file HttpRequest.cpp. 00054 : HttpTransaction() 00055 , m_server_port(0) 00056 , m_is_ssl(false) 00057 , m_body_file(NULL) 00058 , m_form(NULL) 00059 { 00060 }
Definition at line 64 of file HttpRequest.cpp. 00064 : HttpTransaction(src) 00065 , m_method(src.m_method) 00066 , m_protocol(src.m_protocol) 00067 , m_req_uri(src.m_req_uri) 00068 , m_remote_addr(src.m_remote_addr) 00069 , m_remote_host(src.m_remote_host) 00070 , m_server_name(src.m_server_name) 00071 , m_server_port(src.m_server_port) 00072 , m_is_ssl(src.m_is_ssl) 00073 , m_attribute(src.m_attribute) 00074 , m_null(src.m_null) 00075 , m_body_file(src.m_body_file) 00076 , m_form(src.m_form) 00077 , m_cookies(src.m_cookies) 00078 , m_cookie(src.m_cookie) 00079 { 00080 }
Member Function Documentation
Definition at line 90 of file HttpRequest.cpp. References m_attribute, m_body_file, m_cookie, m_cookies, m_form, m_is_ssl, m_method, m_null, m_protocol, m_remote_addr, m_remote_host, m_req_uri, m_server_name, and m_server_port. 00091 { 00092 m_method = src.m_method; 00093 m_protocol = src.m_protocol; 00094 m_req_uri = src.m_req_uri; 00095 m_remote_addr = src.m_remote_addr; 00096 m_remote_host = src.m_remote_host; 00097 m_server_name = src.m_server_name; 00098 m_server_port = src.m_server_port; 00099 m_is_ssl = src.m_is_ssl; 00100 m_attribute = src.m_attribute; 00101 m_null = src.m_null; 00102 m_body_file = src.m_body_file; 00103 m_form = src.m_form; 00104 m_cookies = src.m_cookies; 00105 m_cookie = src.m_cookie; 00106 00107 HttpTransaction::operator=(src); 00108 00109 return *this; 00110 }
Get, Post.
Definition at line 114 of file HttpRequest.cpp. References m_method. Referenced by HttpBaseSocket::OnFirst(), and Ajp13Socket::ReceiveForwardRequest(). 00115 { 00116 m_method = value; 00117 }
Definition at line 120 of file HttpRequest.cpp. References m_method. 00121 { 00122 return m_method; 00123 }
HTTP/1.x.
Definition at line 128 of file HttpRequest.cpp. References m_protocol. Referenced by HttpBaseSocket::OnFirst(), and Ajp13Socket::ReceiveForwardRequest(). 00129 { 00130 m_protocol = value; 00131 }
Definition at line 134 of file HttpRequest.cpp. References m_protocol. Referenced by HttpBaseSocket::Execute(). 00135 { 00136 return m_protocol; 00137 }
Definition at line 142 of file HttpRequest.cpp. References m_req_uri, and Utility::rfc1738_decode(). Referenced by HttpBaseSocket::OnFirst(), and Ajp13Socket::ReceiveForwardRequest(). 00143 { 00144 m_req_uri = Utility::rfc1738_decode(value); 00145 }
Definition at line 148 of file HttpRequest.cpp. References m_req_uri. 00149 { 00150 return m_req_uri; 00151 }
Definition at line 156 of file HttpRequest.cpp. References m_remote_addr. Referenced by HttpBaseSocket::OnFirst(), and Ajp13Socket::ReceiveForwardRequest(). 00157 { 00158 m_remote_addr = value; 00159 }
Definition at line 162 of file HttpRequest.cpp. References m_remote_addr. 00163 { 00164 return m_remote_addr; 00165 }
Definition at line 170 of file HttpRequest.cpp. References m_remote_host. Referenced by HttpBaseSocket::OnFirst(), and Ajp13Socket::ReceiveForwardRequest(). 00171 { 00172 m_remote_host = value; 00173 }
Definition at line 176 of file HttpRequest.cpp. References m_remote_host. 00177 { 00178 return m_remote_host; 00179 }
Definition at line 184 of file HttpRequest.cpp. References m_server_name. Referenced by HttpBaseSocket::OnFirst(), and Ajp13Socket::ReceiveForwardRequest(). 00185 { 00186 m_server_name = value; 00187 }
Definition at line 190 of file HttpRequest.cpp. References m_server_name. 00191 { 00192 return m_server_name; 00193 }
Definition at line 198 of file HttpRequest.cpp. References m_server_port. Referenced by HttpBaseSocket::OnFirst(), and Ajp13Socket::ReceiveForwardRequest(). 00199 { 00200 m_server_port = value; 00201 }
Definition at line 204 of file HttpRequest.cpp. References m_server_port. 00205 { 00206 return m_server_port; 00207 }
Definition at line 212 of file HttpRequest.cpp. References m_is_ssl. Referenced by Ajp13Socket::ReceiveForwardRequest(). 00213 { 00214 m_is_ssl = value; 00215 }
Definition at line 218 of file HttpRequest.cpp. References m_is_ssl. 00219 { 00220 return m_is_ssl; 00221 }
Set / Read attribute value.
Definition at line 226 of file HttpRequest.cpp. References m_attribute. Referenced by HttpBaseSocket::OnFirst(), and Ajp13Socket::ReceiveForwardRequest(). 00227 { 00228 m_attribute[key] = value; 00229 }
Definition at line 232 of file HttpRequest.cpp. References Utility::l2string(), and m_attribute. 00233 { 00234 m_attribute[key] = Utility::l2string(value); 00235 }
Definition at line 238 of file HttpRequest.cpp. References m_attribute, and m_null. 00239 { 00240 Utility::ncmap<std::string>::const_iterator it; 00241 if ( (it = m_attribute.find(key)) != m_attribute.end()) 00242 return it -> second; 00243 return m_null; 00244 }
Definition at line 248 of file HttpRequest.cpp. References m_attribute. 00249 { 00250 return m_attribute; 00251 }
Cookies.
Definition at line 255 of file HttpRequest.cpp. References HttpdCookies::add(), DEB, Parse::getword(), m_cookie, and m_cookies. Referenced by HttpBaseSocket::OnHeader(), and Ajp13Socket::ReceiveForwardRequest(). 00256 { 00257 m_cookies.add( str ); 00258 Parse pa(str, ";"); 00259 std::string lstr = pa.getword(); 00260 while (!lstr.empty()) 00261 { 00262 Parse pa2(lstr, "="); 00263 std::string name = pa2.getword(); 00264 m_cookie[name] = lstr; 00265 DEB(fprintf(stderr, " *** AddCookie '%s' = '%s'\n", name.c_str(), lstr.c_str());) 00266 lstr = pa.getword(); 00267 } 00268 }
Open file for body data.
Definition at line 272 of file HttpRequest.cpp. References DEB, and m_body_file. Referenced by HttpBaseSocket::OnHeaderComplete(), and Ajp13Socket::ReceiveForwardRequest(). 00273 { 00274 if (!m_body_file.get()) 00275 m_body_file = std::auto_ptr<IFile>(new MemFile); 00276 DEB( else 00277 fprintf(stderr, "Body data file already opened\n");) 00278 }
Write body data.
Definition at line 282 of file HttpRequest.cpp. References DEB, and m_body_file. Referenced by HttpBaseSocket::OnData(), and Ajp13Socket::ReceiveBody(). 00283 { 00284 if (m_body_file.get()) 00285 m_body_file -> fwrite(buf, 1, sz); 00286 DEB( else 00287 fprintf(stderr, "Write: Body data file not open\n");) 00288 }
No more writing.
Definition at line 292 of file HttpRequest.cpp. References DEB, and m_body_file. Referenced by HttpBaseSocket::OnData(), and Ajp13Socket::ReceiveBody(). 00293 { 00294 if (m_body_file.get()) 00295 m_body_file -> fclose(); 00296 DEB( else 00297 fprintf(stderr, "CloseBody: File not open\n");) 00298 }
Definition at line 302 of file HttpRequest.cpp. References HttpTransaction::ContentLength(), HttpTransaction::ContentType(), m_attribute, m_body_file, and m_form. Referenced by HttpBaseSocket::Execute(), and Ajp13Socket::Execute(). 00303 { 00304 Utility::ncmap<std::string>::const_iterator it; 00305 if ( (it = m_attribute.find("query_string")) != m_attribute.end()) 00306 { 00307 std::string qs = it -> second; 00308 m_form = std::auto_ptr<HttpdForm>(new HttpdForm( qs, qs.size() )); 00309 } 00310 else 00311 if (m_body_file.get()) 00312 { 00313 m_form = std::auto_ptr<HttpdForm>(new HttpdForm( m_body_file.get(), ContentType(), ContentLength() )); 00314 } 00315 else 00316 { 00317 // dummy 00318 m_form = std::auto_ptr<HttpdForm>(new HttpdForm( "", 0 )); 00319 } 00320 }
Definition at line 333 of file HttpRequest.cpp. References m_cookies. 00334 { 00335 return m_cookies; 00336 }
Reimplemented from HttpTransaction. Definition at line 340 of file HttpRequest.cpp. References m_attribute, m_body_file, m_cookie, m_cookies, m_form, m_is_ssl, m_method, m_protocol, m_remote_addr, m_remote_host, m_req_uri, m_server_name, m_server_port, HttpdCookies::Reset(), and HttpTransaction::Reset(). Referenced by HttpBaseSocket::Execute(). 00341 { 00342 HttpTransaction::Reset(); 00343 m_method = ""; 00344 m_protocol = ""; 00345 m_req_uri = ""; 00346 m_remote_addr = ""; 00347 m_remote_host = ""; 00348 m_server_name = ""; 00349 m_server_port = 0; 00350 m_is_ssl = false; 00351 while (!m_attribute.empty()) 00352 { 00353 m_attribute.erase(m_attribute.begin()); 00354 } 00355 m_body_file = std::auto_ptr<IFile>(NULL); 00356 m_form = std::auto_ptr<HttpdForm>(NULL); 00357 m_cookies.Reset(); 00358 while (!m_cookie.empty()) 00359 { 00360 m_cookie.erase(m_cookie.begin()); 00361 } 00362 }
Member Data Documentation
Definition at line 112 of file HttpRequest.h. Referenced by HttpMethod(), operator=(), Reset(), and SetHttpMethod().
Definition at line 113 of file HttpRequest.h. Referenced by HttpVersion(), operator=(), Reset(), and SetHttpVersion().
Definition at line 114 of file HttpRequest.h. Referenced by operator=(), Reset(), SetUri(), and Uri().
Definition at line 115 of file HttpRequest.h. Referenced by operator=(), RemoteAddr(), Reset(), and SetRemoteAddr().
Definition at line 116 of file HttpRequest.h. Referenced by operator=(), RemoteHost(), Reset(), and SetRemoteHost().
Definition at line 117 of file HttpRequest.h. Referenced by operator=(), Reset(), ServerName(), and SetServerName().
Definition at line 118 of file HttpRequest.h. Referenced by operator=(), Reset(), ServerPort(), and SetServerPort().
Definition at line 119 of file HttpRequest.h. Referenced by IsSsl(), operator=(), Reset(), and SetIsSsl().
Definition at line 120 of file HttpRequest.h. Referenced by Attribute(), Attributes(), operator=(), ParseBody(), Reset(), and SetAttribute().
Reimplemented from HttpTransaction. Definition at line 121 of file HttpRequest.h. Referenced by Attribute(), and operator=().
Definition at line 122 of file HttpRequest.h. Referenced by CloseBody(), InitBody(), operator=(), ParseBody(), Reset(), and Write().
Definition at line 123 of file HttpRequest.h. Referenced by Form(), operator=(), ParseBody(), and Reset().
Definition at line 124 of file HttpRequest.h. Referenced by AddCookie(), Cookies(), operator=(), and Reset().
The documentation for this class was generated from the following files: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1.4.4