Merge pull request #243 from Sil3ntStorm/patch1

Allow use of OpenSSL 1.1.1, fix compile errors
This commit is contained in:
yhirose 2019-10-20 10:12:14 -04:00 committed by GitHub
commit 7a3abd2768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1697,7 +1697,7 @@ inline std::string decode_url(const std::string &s) {
int val = 0; int val = 0;
if (from_hex_to_i(s, i + 1, 2, val)) { if (from_hex_to_i(s, i + 1, 2, val)) {
// 2 digits hex codes // 2 digits hex codes
result += val; result += static_cast<char>(val);
i += 2; // '00' i += 2; // '00'
} else { } else {
result += s[i]; result += s[i];
@ -1848,7 +1848,7 @@ inline std::string to_lower(const char *beg, const char *end) {
std::string out; std::string out;
auto it = beg; auto it = beg;
while (it != end) { while (it != end) {
out += ::tolower(*it); out += static_cast<char>(::tolower(*it));
it++; it++;
} }
return out; return out;
@ -3386,11 +3386,19 @@ private:
class SSLInit { class SSLInit {
public: public:
SSLInit() { SSLInit() {
#if OPENSSL_VERSION_NUMBER >= 0x1010001fL
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
#else
SSL_load_error_strings(); SSL_load_error_strings();
SSL_library_init(); SSL_library_init();
#endif
} }
~SSLInit() { ERR_free_strings(); } ~SSLInit() {
#if OPENSSL_VERSION_NUMBER < 0x1010001fL
ERR_free_strings();
#endif
}
private: private:
#if OPENSSL_VERSION_NUMBER < 0x10100000L #if OPENSSL_VERSION_NUMBER < 0x10100000L