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_HttpResponse_H
00034 #define _SOCKETS_HttpResponse_H
00035
00036 #include "HttpTransaction.h"
00037 #include <list>
00038
00039 #ifdef SOCKETS_NAMESPACE
00040 namespace SOCKETS_NAMESPACE {
00041 #endif
00042
00043
00044 class IFile;
00045
00046 class HttpResponse : public HttpTransaction
00047 {
00048 public:
00049 HttpResponse(const std::string& version = "HTTP/1.0");
00050 HttpResponse(const HttpResponse& src);
00051 ~HttpResponse();
00052
00053 HttpResponse& operator=(const HttpResponse& src);
00054
00056 void SetHttpVersion(const std::string& value);
00057 const std::string& HttpVersion() const;
00058
00059 void SetHttpStatusCode(int value);
00060 int HttpStatusCode() const;
00061
00062 void SetHttpStatusMsg(const std::string& value);
00063 const std::string& HttpStatusMsg() const;
00064
00065 void SetCookie(const std::string& value);
00066 const std::string Cookie(const std::string& name) const;
00067 std::list<std::string> CookieNames() const;
00068
00069 void Write( const std::string& str );
00070 void Write( const char *buf, size_t sz );
00071 void Writef( const char *format, ... );
00072
00073 const IFile& GetFile() const;
00074 IFile& GetFile();
00075
00077 void SetFile( const std::string& path );
00079 void SetFile( IFile *f );
00080
00081 void Reset();
00082
00083 private:
00084 std::string m_http_version;
00085 int m_http_status_code;
00086 std::string m_http_status_msg;
00087 Utility::ncmap<std::string> m_cookie;
00088 mutable std::auto_ptr<IFile> m_file;
00089
00090 };
00091
00092
00093 #ifdef SOCKETS_NAMESPACE
00094 }
00095 #endif
00096
00097 #endif // _SOCKETS_HttpResponse_H
00098