8 #ifndef BOTAN_UTILS_URLGET_H__
9 #define BOTAN_UTILS_URLGET_H__
11 #include <botan/types.h>
12 #include <botan/exceptn.h>
25 Response() : m_status_code(0), m_status_message(
"Uninitialized") {}
28 const std::vector<uint8_t>&
body,
29 const std::map<std::string, std::string>&
headers) :
30 m_status_code(status_code),
31 m_status_message(status_message),
37 const std::vector<uint8_t>&
body()
const {
return m_body; }
39 const std::map<std::string, std::string>&
headers()
const {
return m_headers; }
50 unsigned int m_status_code;
51 std::string m_status_message;
52 std::vector<uint8_t> m_body;
53 std::map<std::string, std::string> m_headers;
66 BOTAN_DLL std::ostream&
operator<<(std::ostream& o,
const Response& resp);
68 typedef std::function<std::string (const std::string&, const std::string&)>
http_exch_fn;
71 const std::string& verb,
72 const std::string& url,
73 const std::string& content_type,
74 const std::vector<uint8_t>& body,
75 size_t allowable_redirects);
78 const std::string& url,
79 const std::string& content_type,
80 const std::vector<uint8_t>& body,
81 size_t allowable_redirects);
84 size_t allowable_redirects = 1);
87 const std::string& content_type,
88 const std::vector<uint8_t>& body,
89 size_t allowable_redirects = 1);
91 BOTAN_DLL std::string
url_encode(
const std::string& url);
Response http_sync(http_exch_fn http_transact, const std::string &verb, const std::string &url, const std::string &content_type, const std::vector< uint8_t > &body, size_t allowable_redirects)
HTTP_Error(const std::string &msg)
const std::vector< uint8_t > & body() const
const std::map< std::string, std::string > & headers() const
unsigned int status_code() const
std::string url_encode(const std::string &in)
std::function< std::string(const std::string &, const std::string &)> http_exch_fn
Response(unsigned int status_code, const std::string &status_message, const std::vector< uint8_t > &body, const std::map< std::string, std::string > &headers)
std::string status_message() const
Response POST_sync(const std::string &url, const std::string &content_type, const std::vector< uint8_t > &body, size_t allowable_redirects)
std::ostream & operator<<(std::ostream &o, const Response &resp)
Response GET_sync(const std::string &url, size_t allowable_redirects)