Implement NetworkManager
For now there are two methods: - `NETWORK:IsUrlAllowed()`: Check whether access to a certain URL is allowed. - `NETWORK:HttpRequest()`: Perform an HTTP request. By default access to the network is disabled for all target hosts. It can be enabled by setting `HttpEnable=1` in the preferences. Individual hosts have to be added to `HttpAllowHosts` as a comma separated list to allow access. See included docs for more details on usage.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* IXStrCaseCompareTest.cpp
|
||||
* Author: Benjamin Sergeant
|
||||
* Copyright (c) 2020 Machine Zone. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "IXTest.h"
|
||||
#include "catch.hpp"
|
||||
#include <iostream>
|
||||
#include <ixwebsocket/IXUrlParser.h>
|
||||
#include <string.h>
|
||||
|
||||
using namespace ix;
|
||||
|
||||
namespace ix
|
||||
{
|
||||
TEST_CASE("str_case_compare", "[str_case_compare]")
|
||||
{
|
||||
SECTION("1")
|
||||
{
|
||||
using HttpHeaders = std::map<std::string, std::string, CaseInsensitiveLess>;
|
||||
|
||||
HttpHeaders httpHeaders;
|
||||
|
||||
httpHeaders["foo"] = "foo";
|
||||
|
||||
REQUIRE(httpHeaders["foo"] == "foo");
|
||||
REQUIRE(httpHeaders["missing"] == "");
|
||||
|
||||
// Comparison should be case insensitive
|
||||
REQUIRE(httpHeaders["Foo"] == "foo");
|
||||
REQUIRE(httpHeaders["Foo"] != "bar");
|
||||
}
|
||||
|
||||
SECTION("2")
|
||||
{
|
||||
using HttpHeaders = std::map<std::string, std::string, CaseInsensitiveLess>;
|
||||
|
||||
HttpHeaders headers;
|
||||
|
||||
headers["Upgrade"] = "webSocket";
|
||||
|
||||
REQUIRE(!CaseInsensitiveLess::cmp(headers["upGRADE"], "webSocket"));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ix
|
||||
Reference in New Issue
Block a user