-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added host specific TLS contexts that are cached, so we not longer share a single global context. Fixed the vast majority of *real* issues reported by badssl.com. Removed old manual ECDH negotation key generation for server contexts and replaced with an openSSL option to auto handle this process. Added i-case string hash and equality functors based on boost for i-case string key hashmaps. Fixes #127 Fixes #113
- Loading branch information
1 parent
a8ebfe7
commit 6cffd96
Showing
14 changed files
with
190 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright © 2017 Jesse Nicholson | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include <cctype> | ||
#include <algorithm> | ||
#include <locale> | ||
#include <boost/algorithm/string.hpp> | ||
#include <boost/functional/hash.hpp> | ||
|
||
namespace te | ||
{ | ||
namespace httpengine | ||
{ | ||
namespace util | ||
{ | ||
namespace hash | ||
{ | ||
struct ICaseStringHash | ||
{ | ||
size_t operator()(const std::string& str) const | ||
{ | ||
std::size_t seed = 0; | ||
std::locale locale; | ||
|
||
for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) | ||
{ | ||
boost::hash_combine(seed, std::toupper(*it, locale)); | ||
} | ||
|
||
return seed; | ||
} | ||
}; | ||
|
||
struct ICaseStringEquality | ||
{ | ||
bool operator()(const std::string& str1, const std::string& str2) const | ||
{ | ||
auto oneSize = str1.size(); | ||
auto twoSize = str2.size(); | ||
|
||
if (oneSize != twoSize) | ||
{ | ||
return false; | ||
} | ||
|
||
std::locale locale; | ||
|
||
if (std::toupper(str1[0], locale) != std::toupper(str2[0], locale)) | ||
{ | ||
return false; | ||
} | ||
|
||
return boost::algorithm::iequals(str1, str2, locale); | ||
} | ||
}; | ||
} | ||
} | ||
} | ||
} |