00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _WXCURLHTTP_H__INCLUDED_
00012 #define _WXCURLHTTP_H__INCLUDED_
00013
00014 #include <wx/curl/base.h>
00015
00016
00017
00019
00020 extern "C"
00021 {
00022 }
00023
00024
00025
00027
00029 class WXDLLIMPEXP_CURL wxCurlHTTP : public wxCurlBase
00030 {
00031 public:
00032 wxCurlHTTP(const wxString& szURL = wxEmptyString,
00033 const wxString& szUserName = wxEmptyString,
00034 const wxString& szPassword = wxEmptyString,
00035 wxEvtHandler* pEvtHandler = NULL, int id = wxID_ANY,
00036 long flags = wxCURL_DEFAULT_FLAGS);
00037 virtual ~wxCurlHTTP();
00038
00039
00040 bool AddForm(const bool& bClear, const wxString& szName,
00041 struct curl_forms* pForms, CURLFORMcode* outErr=NULL);
00042 bool AddBufferToForm(const bool& bClear, const wxString& szName,
00043 char* buffer, size_t len, CURLFORMcode* outErr=NULL);
00044
00045
00046
00047
00048 void UseCookies(const bool& bUseCookies);
00049 bool UseCookies() const;
00050
00051
00052 void SetCookieFile(const wxString& szFilePath);
00053 wxString GetCookieFile() const;
00054
00055
00056
00057
00058 bool Options(const wxString& szRemoteFile = wxEmptyString);
00059
00060
00061 bool Head(const wxString& szRemoteFile = wxEmptyString);
00062
00063
00064 bool Post(const char* buffer, size_t size, const wxString& szRemoteFile = wxEmptyString);
00065 bool Post(wxInputStream& buffer, const wxString& szRemoteFile = wxEmptyString);
00066
00067
00068 bool Post(const wxString& szRemoteFile = wxEmptyString);
00069
00070
00071 bool Trace(const wxString& szRemoteFile = wxEmptyString);
00072
00073
00074 bool Get(const wxString& szFilePath, const wxString& szRemoteFile = wxEmptyString);
00075 size_t Get(char*& buffer, const wxString& szRemoteFile = wxEmptyString);
00076 bool Get(wxOutputStream& buffer, const wxString& szRemoteFile = wxEmptyString);
00077
00078
00079 bool Put(const wxString& szFilePath, const wxString& szRemoteFile = wxEmptyString);
00080 bool Put(const char* buffer, size_t size, const wxString& szRemoteFile = wxEmptyString);
00081 bool Put(wxInputStream& buffer, const wxString& szRemoteFile = wxEmptyString);
00082
00083
00084 bool Delete(const wxString& szRemoteLoc = wxEmptyString);
00085
00086 protected:
00087
00088 virtual void ResetPostData();
00089 virtual void SetCurlHandleToDefaults(const wxString& relativeURL);
00090
00091 bool IsResponseOk() const;
00092
00093
00094 struct curl_httppost* m_pPostHead;
00095 struct curl_httppost* m_pPostTail;
00096
00097 bool m_bUseCookies;
00098
00099 wxCharBuffer m_szCookieFile;
00100
00101 const char* m_pszPostFieldsData;
00102 size_t m_iPostDataSize;
00103 };
00104
00105 #endif // _WXCURLHTTP_H__INCLUDED_