ulxr_http_client.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                     ulxr_http_client.h  -  a simple http client
00003                              -------------------
00004     begin                : Sam Apr 20 2002
00005     copyright            : (C) 2002-2007 by Ewald Arnold
00006     email                : ulxmlrpcpp@ewald-arnold.de
00007 
00008     $Id: ulxr_http_client.h 940 2006-12-30 18:22:05Z ewald-arnold $
00009 
00010  ***************************************************************************/
00011 
00012 /**************************************************************************
00013  *
00014  * This program is free software; you can redistribute it and/or modify
00015  * it under the terms of the GNU Lesser General Public License as
00016  * published by the Free Software Foundation; either version 2 of the License,
00017  * or (at your option) any later version.
00018  *
00019  * This program is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  * GNU General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public License
00025  * along with this program; if not, write to the Free Software
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00027  *
00028  ***************************************************************************/
00029 
00030 #ifndef ULXR_HTTP_CLIENT_H
00031 #define ULXR_HTTP_CLIENT_H
00032 
00033 #ifndef ULXR_OMIT_TCP_STUFF
00034 
00035 #include <ulxmlrpcpp/ulxmlrpcpp.h>  // always first header
00036 
00037 
00038 namespace ulxr {
00039 
00040 
00041 class HttpProtocol;
00042 
00043 
00048 class ULXR_API_DECL0 BodyProcessor
00049 {
00050  public:
00051 
00056    virtual void process(const char *buffer, unsigned len);
00057 
00061    virtual ~BodyProcessor();
00062 };
00063 
00064 
00069 class ULXR_API_DECL0 HttpClient
00070 {
00071  public:
00072 
00076    HttpClient(HttpProtocol* prot);
00077 
00080    virtual ~HttpClient()
00081      {}
00082 
00088    void msgPUT(const Cpp8BitString &msg,
00089                const CppString &type,
00090                const CppString &resource);
00091 
00097    void filePUT(const CppString &filename,
00098                 const CppString &type,
00099                 const CppString &resource);
00100 
00105    Cpp8BitString msgGET(const CppString &resource);
00106 
00111    void fileGET(const CppString &filename, const CppString &resource);
00112 
00120    Cpp8BitString msgPOST(const Cpp8BitString &msg,
00121                          const CppString &type,
00122                          const CppString &resource);
00123 
00127    void doDELETE(const CppString &resource);
00128 
00135    virtual void setMessageAuthentication(const CppString &user, const CppString &pass);
00136 
00137  protected:
00138 
00141    void sendAuthentication();
00142 
00146    int getHttpStatus() const;
00147 
00151    CppString getHttpPhrase() const;
00152 
00158    CppString getHttpVersion() const;
00159 
00163    virtual void interpreteHttpHeader();
00164 
00168    void receiveResponse(BodyProcessor &proc);
00169 
00170  private:
00171 
00172    unsigned        head_status;
00173    CppString       head_phrase;
00174    CppString       head_version;
00175    CppString       http_user;
00176    CppString       http_pass;
00177 
00178    HttpProtocol   *protocol;
00179 };
00180 
00181 
00182 }  // namespace ulxr
00183 
00184 
00185 #endif // ULXR_OMIT_TCP_STUFF
00186 
00187 #endif // ULXR_HTTP_CLIENT_H
00188 

Generated on Sun Aug 19 20:08:57 2007 for ulxmlrpcpp by  doxygen 1.5.1