26#ifndef _MUSICBRAINZ5_HTTP_FETCH_
27#define _MUSICBRAINZ5_HTTP_FETCH_
34 class CHTTPFetchPrivate;
39 CExceptionBase(
const std::string& ErrorMessage,
const std::string& Exception)
40 : m_ErrorMessage(ErrorMessage),
41 m_Exception(Exception)
43 m_FullMessage=m_Exception +
": " + m_ErrorMessage;
48 virtual const char*
what()
const throw()
50 return m_FullMessage.c_str();
54 std::string m_ErrorMessage;
55 std::string m_Exception;
56 std::string m_FullMessage;
157 CHTTPFetch(
const std::string& UserAgent,
const std::string& Host,
int Port=80);
238 int Fetch(
const std::string& URL,
const std::string& Request=
"GET");
248 std::vector<unsigned char>
Data()
const;
281 CHTTPFetchPrivate *
const m_d;
283 static int httpAuth(
void *userdata,
const char *realm,
int attempts,
char *username,
char *password);
284 static int proxyAuth(
void *userdata,
const char *realm,
int attempts,
char *username,
char *password);
285 static int httpResponseReader(
void *userdata,
const char *buf,
size_t len);
Exception thrown when an authentication error occurs.
Definition: HTTPFetch.h:90
CAuthenticationError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:92
Exception thrown when an error occurs connecting to web service.
Definition: HTTPFetch.h:64
CConnectionError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:66
Definition: HTTPFetch.h:37
CExceptionBase(const std::string &ErrorMessage, const std::string &Exception)
Definition: HTTPFetch.h:39
virtual ~CExceptionBase()
Definition: HTTPFetch.h:46
virtual const char * what() const
Definition: HTTPFetch.h:48
Exception thrown when an error occurs fetching data.
Definition: HTTPFetch.h:103
CFetchError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:105
Object for make HTTP requests.
Definition: HTTPFetch.h:144
std::vector< unsigned char > Data() const
Get the data receieved.
int Fetch(const std::string &URL, const std::string &Request="GET")
Make a request to the server.
CHTTPFetch(const std::string &UserAgent, const std::string &Host, int Port=80)
Constructor.
void SetProxyPort(int ProxyPort)
Set the proxy port to use.
void SetProxyHost(const std::string &ProxyHost)
Set the proxy server to use.
std::string ErrorMessage() const
Return the error message from the request.
void SetProxyPassword(const std::string &ProxyPassword)
Set the proxy password to use.
void SetUserName(const std::string &UserName)
Set the user name to use.
int Result() const
libneon result code from the request
int Status() const
Status.
void SetPassword(const std::string &Password)
Set the password to use.
void SetProxyUserName(const std::string &ProxyUserName)
Set the proxy user name to use.
Exception thrown when an invalid request is made.
Definition: HTTPFetch.h:116
CRequestError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:118
Exception thrown when the requested resource is not found.
Definition: HTTPFetch.h:129
CResourceNotFoundError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:131
Exception thrown when a connection to the web service times out.
Definition: HTTPFetch.h:77
CTimeoutError(const std::string &ErrorMessage)
Definition: HTTPFetch.h:79