8#ifndef BOTAN_UTILS_URLGET_H_
9#define BOTAN_UTILS_URLGET_H_
11#include <botan/exceptn.h>
12#include <botan/types.h>
33 Response() : m_status_code(0), m_status_message(
"Uninitialized") {}
37 const std::vector<uint8_t>&
body,
38 const std::map<std::string, std::string>&
headers) :
43 const std::vector<uint8_t>&
body()
const {
return m_body; }
45 const std::map<std::string, std::string>&
headers()
const {
return m_headers; }
56 unsigned int m_status_code;
57 std::string m_status_message;
58 std::vector<uint8_t> m_body;
59 std::map<std::string, std::string> m_headers;
64typedef std::function<std::string(std::string_view, std::string_view, std::string_view)>
http_exch_fn;
67 std::string_view verb,
69 std::string_view content_type,
70 const std::vector<uint8_t>& body,
71 size_t allowable_redirects);
75 std::string_view content_type,
76 const std::vector<uint8_t>& body,
77 size_t allowable_redirects,
78 std::chrono::milliseconds timeout = std::chrono::milliseconds(3000));
81 size_t allowable_redirects = 1,
82 std::chrono::milliseconds timeout = std::chrono::milliseconds(3000));
85 std::string_view content_type,
86 const std::vector<uint8_t>& body,
87 size_t allowable_redirects = 1,
88 std::chrono::milliseconds timeout = std::chrono::milliseconds(3000));
ErrorType error_type() const noexcept override
HTTP_Error(const std::string &msg)
const std::vector< uint8_t > & body() const
const std::map< std::string, std::string > & headers() const
Response(unsigned int status_code, std::string_view status_message, const std::vector< uint8_t > &body, const std::map< std::string, std::string > &headers)
unsigned int status_code() const
std::string status_message() const
void throw_unless_ok() const
int(* final)(unsigned char *, CTX *)
std::function< std::string(std::string_view, std::string_view, std::string_view)> http_exch_fn
Response POST_sync(std::string_view url, std::string_view content_type, const std::vector< uint8_t > &body, size_t allowable_redirects, std::chrono::milliseconds timeout)
Response http_sync(const http_exch_fn &http_transact, std::string_view verb, std::string_view url, std::string_view content_type, const std::vector< uint8_t > &body, size_t allowable_redirects)
std::string url_encode(std::string_view in)
Response GET_sync(std::string_view url, size_t allowable_redirects, std::chrono::milliseconds timeout)
std::ostream & operator<<(std::ostream &o, const Response &resp)