upload
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include "Export.h"
|
||||
|
||||
class UNSWSC_DLL_EXPORT CORSConfig
|
||||
{
|
||||
private:
|
||||
int max_age;
|
||||
bool allow_cookie;
|
||||
std::set<std::string> validate_urls;
|
||||
std::set<std::string> validate_hosts;
|
||||
std::set<std::string> validate_headers;
|
||||
std::set<std::string> validate_methods;
|
||||
|
||||
public:
|
||||
CORSConfig();
|
||||
|
||||
public:
|
||||
int GetMaxAge() const;
|
||||
bool AllowCookie() const;
|
||||
std::string GetValidateMethods() const;
|
||||
bool UrlValidate(const std::string& url) const;
|
||||
bool HostValidate(const std::string& host) const;
|
||||
bool IsMethodAllowed(const std::string method) const;
|
||||
std::string GetValidateHeaders(const std::set<std::string>& headers = {}) const;
|
||||
|
||||
public:
|
||||
void SetMaxAge(int max_age);
|
||||
void SetAllowCookie(bool allow);
|
||||
|
||||
void ClearValidateUrls();
|
||||
void ClearValidateHosts();
|
||||
void ClearValidateMethods();
|
||||
void ClearValidateHeaders();
|
||||
|
||||
void AddValidateUrl(const std::string& url);
|
||||
void AddValidateHost(const std::string& host);
|
||||
void AddValidateMethod(const std::string& method);
|
||||
void AddValidateHeader(const std::string& header);
|
||||
|
||||
void AddValidateUrls(const std::set<std::string>& urls);
|
||||
void AddValidateHosts(const std::set<std::string>& hosts);
|
||||
void AddValidateMethods(const std::set<std::string>& methods);
|
||||
void AddValidateHeaders(const std::set<std::string>& headers);
|
||||
};
|
||||
|
||||
extern UNSWSC_DLL_EXPORT CORSConfig GlobalCORSConfig;
|
||||
Reference in New Issue
Block a user