25 #ifndef _MUSICBRAINZ4_HTTP_FETCH_ 26 #define _MUSICBRAINZ4_HTTP_FETCH_ 33 class CHTTPFetchPrivate;
38 CExceptionBase(
const std::string& ErrorMessage,
const std::string& Exception)
39 : m_ErrorMessage(ErrorMessage),
40 m_Exception(Exception)
42 m_FullMessage=m_Exception +
": " + m_ErrorMessage;
47 virtual const char*
what()
const throw()
49 return m_FullMessage.c_str();
53 std::string m_ErrorMessage;
54 std::string m_Exception;
55 std::string m_FullMessage;
156 CHTTPFetch(
const std::string& UserAgent,
const std::string& Host,
int Port=80);
167 void SetUserName(
const std::string& UserName);
177 void SetPassword(
const std::string& Password);
187 void SetProxyHost(
const std::string& ProxyHost);
197 void SetProxyPort(
int ProxyPort);
207 void SetProxyUserName(
const std::string& ProxyUserName);
217 void SetProxyPassword(
const std::string& ProxyPassword);
237 int Fetch(
const std::string& URL,
const std::string& Request=
"GET");
247 std::vector<unsigned char> Data()
const;
277 std::string ErrorMessage()
const;
280 CHTTPFetchPrivate *
const m_d;
282 static int httpAuth(
void *userdata,
const char *realm,
int attempts,
char *username,
char *password);
283 static int proxyAuth(
void *userdata,
const char *realm,
int attempts,
char *username,
char *password);
284 static int httpResponseReader(
void *userdata,
const char *buf,
size_t len);
Exception thrown when a connection to the web service times out.
Definition: HTTPFetch.h:75
CTimeoutError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:78
virtual const char * what() const
Definition: HTTPFetch.h:47
CResourceNotFoundError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:130
CFetchError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:104
Exception thrown when the requested resource is not found.
Definition: HTTPFetch.h:127
Object for make HTTP requests.
Definition: HTTPFetch.h:142
CAuthenticationError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:91
CExceptionBase(const std::string &ErrorMessage, const std::string &Exception)
Definition: HTTPFetch.h:38
Exception thrown when an error occurs fetching data.
Definition: HTTPFetch.h:101
Exception thrown when an authentication error occurs.
Definition: HTTPFetch.h:88
Definition: HTTPFetch.h:35
virtual ~CExceptionBase()
Definition: HTTPFetch.h:45
CConnectionError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:65
Exception thrown when an invalid request is made.
Definition: HTTPFetch.h:114
Exception thrown when an error occurs connecting to web service.
Definition: HTTPFetch.h:62
CRequestError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:117