00001 /* libzzinet 00002 * 00003 * This program is distributed under the GNU General Public License, version 2. 00004 * A copy of this license is included with this source. 00005 * 00006 * Copyright 2000-2006, Toni Thomsson <toni@tonjac.org> 00007 */ 00008 00009 #ifdef _WIN32 00010 #pragma warning(disable: 4786) 00011 #endif 00012 00013 #ifndef zz_cgi_h 00014 #define zz_cgi_h 00015 00016 #include <zz_string.h> 00017 #include <map> 00018 #include <zz_mime_body.h> 00019 #include <zz_export.h> 00020 #include <zz_parameter_map.h> 00021 00023 typedef map<CzzString, CzzString > CzzCGIParameterMap; 00024 00033 class ZZ_API CzzCGI : public CzzParameterMap 00034 { 00035 public: 00036 00040 CzzCGI( void ); 00041 00042 virtual ~CzzCGI(); 00043 00049 CzzString operator[]( const CzzString& var ); 00050 00056 CzzString getFile( const CzzString& name ); 00057 00063 static CzzString encode( CzzString& parameters ); 00064 00070 static CzzString decode( CzzString& parameters ); 00071 00073 CzzCGIParameterMap& getParameterMap( void ); 00074 00075 00077 int getLength( void ); 00078 00080 char* request( void ); 00081 00082 protected: 00083 00084 void parseCmd( const char* vars ); 00085 void parseHeaders( char* hdrs ); 00086 00087 CzzString m_Type; 00088 CzzString m_Method; 00089 char* m_Request; 00090 long m_Length; 00091 CzzCGIParameterMap m_ParameterMap; 00092 CzzMIMEBody* m_MIME; 00093 00094 private: 00095 00096 static CzzString encodeChar( CzzString& parameters, char sign ); 00097 static CzzString decodeChar( CzzString& parameters, char sign ); 00098 00099 void split( CzzString s ); 00100 char hex2Ascii( const CzzString& s ); 00101 void decodeHex( CzzString& s ); 00102 void decodeSpace( CzzString& s ); 00103 void parseVars( const CzzString& s ); 00104 }; 00105 00106 #endif // zz_cgi_h 00107
1.4.6-NO