aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/http_util
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-11 15:28:38 -0500
committerJack Lloyd <[email protected]>2016-12-18 16:48:24 -0500
commitf3cb3edb512bdcab498d825886c3366c341b3f78 (patch)
tree645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/utils/http_util
parentc1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff)
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them.
Diffstat (limited to 'src/lib/utils/http_util')
-rw-r--r--src/lib/utils/http_util/http_util.cpp14
-rw-r--r--src/lib/utils/http_util/http_util.h12
2 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/utils/http_util/http_util.cpp b/src/lib/utils/http_util/http_util.cpp
index c699b786f..f714c1bca 100644
--- a/src/lib/utils/http_util/http_util.cpp
+++ b/src/lib/utils/http_util/http_util.cpp
@@ -146,7 +146,7 @@ std::string url_encode(const std::string& in)
else if(c == '-' || c == '_' || c == '.' || c == '~')
out << c;
else
- out << '%' << hex_encode(reinterpret_cast<byte*>(&c), 1);
+ out << '%' << hex_encode(reinterpret_cast<uint8_t*>(&c), 1);
}
return out.str();
@@ -166,7 +166,7 @@ Response http_sync(http_exch_fn http_transact,
const std::string& verb,
const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects)
{
if(url.empty())
@@ -251,8 +251,8 @@ Response http_sync(http_exch_fn http_transact,
return GET_sync(headers["Location"], allowable_redirects - 1);
}
- std::vector<byte> resp_body;
- std::vector<byte> buf(4096);
+ std::vector<uint8_t> resp_body;
+ std::vector<uint8_t> buf(4096);
while(io.good())
{
io.read(reinterpret_cast<char*>(buf.data()), buf.size());
@@ -274,7 +274,7 @@ Response http_sync(http_exch_fn http_transact,
Response http_sync(const std::string& verb,
const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects)
{
return http_sync(
@@ -288,12 +288,12 @@ Response http_sync(const std::string& verb,
Response GET_sync(const std::string& url, size_t allowable_redirects)
{
- return http_sync("GET", url, "", std::vector<byte>(), allowable_redirects);
+ return http_sync("GET", url, "", std::vector<uint8_t>(), allowable_redirects);
}
Response POST_sync(const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects)
{
return http_sync("POST", url, content_type, body, allowable_redirects);
diff --git a/src/lib/utils/http_util/http_util.h b/src/lib/utils/http_util/http_util.h
index 1b4da3d2c..c1cef4542 100644
--- a/src/lib/utils/http_util/http_util.h
+++ b/src/lib/utils/http_util/http_util.h
@@ -25,7 +25,7 @@ struct Response
Response() : m_status_code(0), m_status_message("Uninitialized") {}
Response(unsigned int status_code, const std::string& status_message,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
const std::map<std::string, std::string>& headers) :
m_status_code(status_code),
m_status_message(status_message),
@@ -34,7 +34,7 @@ struct Response
unsigned int status_code() const { return m_status_code; }
- const std::vector<byte>& body() const { return m_body; }
+ const std::vector<uint8_t>& body() const { return m_body; }
const std::map<std::string, std::string>& headers() const { return m_headers; }
@@ -49,7 +49,7 @@ struct Response
private:
unsigned int m_status_code;
std::string m_status_message;
- std::vector<byte> m_body;
+ std::vector<uint8_t> m_body;
std::map<std::string, std::string> m_headers;
};
@@ -71,13 +71,13 @@ BOTAN_DLL Response http_sync(http_exch_fn fn,
const std::string& verb,
const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects);
BOTAN_DLL Response http_sync(const std::string& verb,
const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects);
BOTAN_DLL Response GET_sync(const std::string& url,
@@ -85,7 +85,7 @@ BOTAN_DLL Response GET_sync(const std::string& url,
BOTAN_DLL Response POST_sync(const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects = 1);
BOTAN_DLL std::string url_encode(const std::string& url);