1
0
Fork 0

Minor cleanup of routing code in HttpServer.

This commit is contained in:
Max Neunhoeffer 2015-04-29 21:02:34 -07:00
parent 686f67024e
commit 16f2352a45
2 changed files with 6 additions and 19 deletions

View File

@ -243,12 +243,11 @@ HttpHandler* HttpHandlerFactory::createHandler (HttpRequest* request) {
return new MaintenanceHandler(request);
}
map<string, create_fptr> const& ii = _constructors;
unordered_map<string, create_fptr> const& ii = _constructors;
string path = request->requestPath();
map<string, create_fptr>::const_iterator i = ii.find(path);
auto i = ii.find(path);
void* data = nullptr;
// no direct match, check prefix matches
if (i == ii.end()) {
LOG_TRACE("no direct handler found, trying prefixes");
@ -335,8 +334,8 @@ HttpHandler* HttpHandlerFactory::createHandler (HttpRequest* request) {
// look up data
map<string, void*> const& jj = _datas;
map<string, void*>::const_iterator j = jj.find(path);
unordered_map<string, void*> const& jj = _datas;
auto j = jj.find(path);
if (j != jj.end()) {
data = j->second;

View File

@ -249,29 +249,17 @@ namespace triagens {
void* _setContextData;
////////////////////////////////////////////////////////////////////////////////
/// @brief authentication lock for cache
////////////////////////////////////////////////////////////////////////////////
basics::ReadWriteLock _authLock;
////////////////////////////////////////////////////////////////////////////////
/// @brief authentication cache
////////////////////////////////////////////////////////////////////////////////
std::map<std::string, std::string> _authCache;
////////////////////////////////////////////////////////////////////////////////
/// @brief list of constructors
////////////////////////////////////////////////////////////////////////////////
std::map<std::string, create_fptr> _constructors;
std::unordered_map<std::string, create_fptr> _constructors;
////////////////////////////////////////////////////////////////////////////////
/// @brief list of data pointers for constructors
////////////////////////////////////////////////////////////////////////////////
std::map<std::string, void*> _datas;
std::unordered_map<std::string, void*> _datas;
////////////////////////////////////////////////////////////////////////////////
/// @brief list of prefix handlers