00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef _SOCKETS_HttpRequest_H
00034 #define _SOCKETS_HttpRequest_H
00035
00036 #include "HttpTransaction.h"
00037 #include "HttpdCookies.h"
00038 #include "IFile.h"
00039
00040 #ifdef SOCKETS_NAMESPACE
00041 namespace SOCKETS_NAMESPACE {
00042 #endif
00043
00044
00045 class HttpdForm;
00046 class IFile;
00047
00048 class HttpRequest : public HttpTransaction
00049 {
00050 public:
00051 HttpRequest();
00053 #ifndef _WIN32
00054 HttpRequest(FILE *);
00055 #endif
00056 HttpRequest(const HttpRequest& src);
00057 ~HttpRequest();
00058
00059 HttpRequest& operator=(const HttpRequest& src);
00060
00062 void SetHttpMethod(const std::string& value);
00063 const std::string& HttpMethod() const;
00064
00066 void SetHttpVersion(const std::string& value);
00067 const std::string& HttpVersion() const;
00068
00069 void SetUri(const std::string& value);
00070 const std::string& Uri() const;
00071
00072 void SetRemoteAddr(const std::string& value);
00073 const std::string& RemoteAddr() const;
00074
00075 void SetRemoteHost(const std::string& value);
00076 const std::string& RemoteHost() const;
00077
00078 void SetServerName(const std::string& value);
00079 const std::string& ServerName() const;
00080
00081 void SetServerPort(int value);
00082 int ServerPort() const;
00083
00084 void SetIsSsl(bool value);
00085 bool IsSsl() const;
00086
00088 void SetAttribute(const std::string& key, const std::string& value);
00089 void SetAttribute(const std::string& key, long value);
00090 const std::string& Attribute(const std::string& key) const;
00091
00092 const Utility::ncmap<std::string>& Attributes() const;
00093
00095 void AddCookie(const std::string& );
00096 const Utility::ncmap<std::string>& CookieMap() const { return m_cookie; }
00097
00099 void InitBody( size_t sz );
00100
00102 void Write( const char *buf, size_t sz );
00103
00105 void CloseBody();
00106
00107 void ParseBody();
00108
00109 const HttpdForm& Form() const;
00110 const HttpdCookies& Cookies() const;
00111
00112 const IFile *BodyFile() const { return m_body_file.get(); }
00113
00114 void Reset();
00115
00116 private:
00117 std::string m_method;
00118 std::string m_protocol;
00119 std::string m_req_uri;
00120 std::string m_remote_addr;
00121 std::string m_remote_host;
00122 std::string m_server_name;
00123 int m_server_port;
00124 bool m_is_ssl;
00125 Utility::ncmap<std::string> m_attribute;
00126 std::string m_null;
00127 mutable std::auto_ptr<IFile> m_body_file;
00128 mutable std::auto_ptr<HttpdForm> m_form;
00129 HttpdCookies m_cookies;
00130 Utility::ncmap<std::string> m_cookie;
00131
00132 };
00133
00134
00135 #ifdef SOCKETS_NAMESPACE
00136 }
00137 #endif
00138
00139 #endif // _SOCKETS_HttpRequest_H
00140