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 #ifndef _SOCKETS_HttpdForm_H
00033 #define _SOCKETS_HttpdForm_H
00034
00035 #include "sockets-config.h"
00036 #include <string>
00037 #include <list>
00038
00039 #ifdef SOCKETS_NAMESPACE
00040 namespace SOCKETS_NAMESPACE {
00041 #endif
00042
00043
00044 class IFile;
00045
00048 class HttpdForm
00049 {
00055 struct CGI
00056 {
00057 CGI(const std::string& n,const std::string& v) : name(n),value(v) {}
00058 CGI(const std::string& n,const std::string& v,const std::string& p) : name(n),value(v),path(p) {}
00059 std::string name;
00060 std::string value;
00061 std::string path;
00062 };
00064 typedef std::list<CGI *> cgi_v;
00065
00066 public:
00072 HttpdForm(IFile *, const std::string& content_type, size_t content_length);
00079 HttpdForm(const std::string& query_string,size_t length);
00080 ~HttpdForm();
00081
00082 void EnableRaw(bool);
00083
00084 void strcpyval(std::string&,const char *);
00085
00086
00087 bool getfirst(std::string& n);
00088 bool getnext(std::string& n);
00089
00090
00091 bool getfirst(std::string& n,std::string& v);
00092 bool getnext(std::string& n,std::string& v);
00093
00094
00095 int getvalue(const std::string& ,std::string& );
00096 std::string getvalue(const std::string& );
00097 size_t getlength(const std::string& );
00098 cgi_v& getbase();
00099
00100 const std::string& GetBoundary();
00101
00102 private:
00103 HttpdForm(const HttpdForm& ) {}
00104 HttpdForm& operator=(const HttpdForm& ) { return *this; }
00105 cgi_v m_cgi;
00106 cgi_v::iterator m_current;
00107 std::string m_strBoundary;
00108 bool raw;
00109 };
00110
00111
00112 #ifdef SOCKETS_NAMESPACE
00113 }
00114 #endif
00115
00116 #endif // _SOCKETS_HttpdForm_H