Fixes #129: linking issues related to case_insensitive_equal and make_error_code

This commit is contained in:
eidheim 2017-06-10 15:03:27 +02:00
commit 83691c6e9a
3 changed files with 9 additions and 7 deletions

View file

@ -14,7 +14,7 @@
namespace SimpleWeb {
using error_code = std::error_code;
using errc = std::errc;
error_code (&make_error_code)(errc) = std::make_error_code;
namespace make_error_code = std;
}
#else
#include <boost/asio.hpp>
@ -24,14 +24,14 @@ namespace SimpleWeb {
namespace asio = boost::asio;
using error_code = boost::system::error_code;
namespace errc = boost::system::errc;
error_code (&make_error_code)(boost::system::errc::errc_t) = boost::system::errc::make_error_code;
namespace make_error_code = boost::system::errc;
}
#endif
# ifndef CASE_INSENSITIVE_EQUAL_AND_HASH
# define CASE_INSENSITIVE_EQUAL_AND_HASH
namespace SimpleWeb {
bool case_insensitive_equal(const std::string &str1, const std::string &str2) {
inline bool case_insensitive_equal(const std::string &str1, const std::string &str2) {
return str1.size() == str2.size() &&
std::equal(str1.begin(), str1.end(), str2.begin(), [](char a, char b) {
return tolower(a) == tolower(b);
@ -339,7 +339,7 @@ namespace SimpleWeb {
}
catch(const std::exception &e) {
if(on_error)
on_error(request, make_error_code(errc::protocol_error));
on_error(request, make_error_code::make_error_code(errc::protocol_error));
return;
}
if(content_length>num_additional_bytes) {
@ -473,7 +473,7 @@ namespace SimpleWeb {
}
catch(const std::exception &e) {
if(on_error)
on_error(request, make_error_code(errc::operation_canceled));
on_error(request, make_error_code::make_error_code(errc::operation_canceled));
return;
}
}