Code cleanups around

This commit is contained in:
Alexey Milovidov 2020-01-18 23:19:10 +03:00
parent 216b39a30d
commit 457c50c7d7
2 changed files with 10 additions and 6 deletions

View File

@ -1,12 +1,13 @@
#include <re2/re2.h> #include <re2/re2.h>
#include <Common/RemoteHostFilter.h>
#include <Poco/URI.h> #include <Poco/URI.h>
#include <Formats/FormatFactory.h>
#include <Poco/Util/AbstractConfiguration.h> #include <Poco/Util/AbstractConfiguration.h>
#include <Formats/FormatFactory.h>
#include <Common/RemoteHostFilter.h>
#include <Common/StringUtils/StringUtils.h> #include <Common/StringUtils/StringUtils.h>
#include <Common/Exception.h> #include <Common/Exception.h>
#include <IO/WriteHelpers.h> #include <IO/WriteHelpers.h>
namespace DB namespace DB
{ {
namespace ErrorCodes namespace ErrorCodes

View File

@ -1,17 +1,19 @@
#pragma once #pragma once
#include <string>
#include <vector> #include <vector>
#include <unordered_set> #include <unordered_set>
#include <Poco/URI.h>
#include <Poco/Util/AbstractConfiguration.h>
namespace Poco { class URI; }
namespace Poco { namespace Util { class AbstractConfiguration; } }
namespace DB namespace DB
{ {
class RemoteHostFilter class RemoteHostFilter
{ {
/** /**
* This class checks if url is allowed. * This class checks if URL is allowed.
* If primary_hosts and regexp_hosts are empty all urls are allowed. * If primary_hosts and regexp_hosts are empty all urls are allowed.
*/ */
public: public:
@ -25,6 +27,7 @@ private:
std::unordered_set<std::string> primary_hosts; /// Allowed primary (<host>) URL from config.xml std::unordered_set<std::string> primary_hosts; /// Allowed primary (<host>) URL from config.xml
std::vector<std::string> regexp_hosts; /// Allowed regexp (<hots_regexp>) URL from config.xml std::vector<std::string> regexp_hosts; /// Allowed regexp (<hots_regexp>) URL from config.xml
bool checkForDirectEntry(const std::string & str) const; /// Checks if the primary_hosts and regexp_hosts contain str. If primary_hosts and regexp_hosts are empty return true. /// Checks if the primary_hosts and regexp_hosts contain str. If primary_hosts and regexp_hosts are empty return true.
bool checkForDirectEntry(const std::string & str) const;
}; };
} }