HTTPRequest.h

00001 // $Id: HTTPRequest.h 21 2010-09-05 04:18:17Z cschwarz1 $
00002 
00003 #ifndef BASE_HTTP_HTTPREQUEST_H
00004 #define BASE_HTTP_HTTPREQUEST_H
00005 
00006 #include <map>
00007 #include <vector>
00008 #include "HTTPPart.h"
00009 
00010 namespace base_http {
00012 
00016     class PPBASE_HTTP_EXPORT HTTPRequest: public HTTPPart {
00017     public:
00019         HTTPRequest();
00020 
00022         ~HTTPRequest();
00023 
00025 
00029         void add(HTTPPart *part, bool own = false);
00030 
00032 
00038         int authenticate(const char *realm, const char *password, const char *lastnonce);
00039 
00041 
00046         bool getBasicAuthorization(base::String &username, base::String &password);
00047 
00049 
00052         const char *getBoundary() const;
00053 
00055 
00060         bool getDigestAuthorization(base::String &username, base::String &response);
00061 
00063 
00066         int getMajorVersion() const;
00067 
00069 
00072         int getMinorVersion() const;
00073 
00075 
00078         const char *getMethod() const;
00079 
00081 
00085         HTTPPart *getPart(const base::String &id) const;
00086 
00088 
00091         std::vector<HTTPPart*> getParts() const;
00092 
00094 
00097         const char *getURI() const;
00098 
00100 
00103         const char *getProtocol() const;
00104 
00106 
00110         void insert(HTTPPart *part, bool own = false);
00111 
00113 
00119         bool parseAuthorizationHeader(const base::String &header, base::String &method, std::map<base::String, base::String> &args);
00120 
00122 
00125         void setBoundary(const char *boundary);
00126 
00128 
00131         void setMethod(const char *method);
00132 
00134 
00137         void setProtocol(const char *protocol);
00138 
00140 
00143         void setURI(const char *uri);
00144 
00146 
00149         size_t size() const;
00150 
00151     private:
00152         base::String           _boundary;  
00153         base::String           _method;    
00154         std::vector<HTTPPart*> _parts;     
00155         std::vector<bool>      _parts_own; 
00156         base::String           _protocol;  
00157         base::String           _uri;       
00158     };
00159 }
00160 
00161 #endif