Merge branch 'master' into semantic

This commit is contained in:
Mike
2021-01-28 16:29:34 -07:00
committed by GitHub
5 changed files with 99 additions and 7 deletions

73
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,73 @@
#*********************************************************************
# Copyright (c) Intel Corporation 2020
# SPDX-License-Identifier: Apache-2.0
#*********************************************************************/
name: Build RPC (Native)
on:
pull_request:
branches: [ master ]
env:
BUILD_TYPE: Release
jobs:
build-windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Create Build Dir
run: mkdir build
- name: Clone
run: git clone --branch 2020.11-1 https://github.com/microsoft/vcpkg.git
- name: Build VCPKG
run: cd vcpkg && bootstrap-vcpkg.bat
shell: cmd
- name: dir
run: ls
- name: dir
run: cd vcpkg && ls
- name: Install C++ REST SDK
run: ${{ runner.workspace }}\rpc\vcpkg\vcpkg.exe install cpprestsdk[websockets]:x64-windows-static
shell: cmd
- name: dir
run: ls && cd vcpkg && ls
shell: bash
- name: Prepare for build
run: cd build && cmake .. -DCMAKE_PREFIX_PATH=D:/a/rpc/rpc/vcpkg/installed/x64-windows-static -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=D:/a/rpc/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build RPC
run: cd build && cmake --build . --config Debug
build-linux:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
run: sudo apt install git cmake build-essential curl zip unzip tar pkg-config
- name: Create Build Dir
run: mkdir build
- name: Clone
run: git clone --branch 2020.11-1 https://github.com/microsoft/vcpkg.git
- name: Build VCPKG
run: cd vcpkg && ./bootstrap-vcpkg.sh
shell: bash
- name: dir
run: ls
- name: dir
run: cd vcpkg && ls
- name: Install C++ REST SDK
run: ${{ runner.workspace }}/rpc/vcpkg/vcpkg install cpprestsdk[websockets]
shell: bash
- name: dir
run: ls && cd vcpkg && ls
shell: bash
- name: Prepare for build
run: cd build && cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build RPC
run: cd build && cmake --build . --config Debug

View File

@@ -127,3 +127,8 @@ bool args_get_verbose(int argc, char* argv[])
{
return get_arg_exists(argc, argv, "--verbose", "-v");
}
bool args_get_nocertcheck(int argc, char* argv[])
{
return get_arg_exists(argc, argv, "--nocertcheck", "-n");
}

1
args.h
View File

@@ -16,5 +16,6 @@ bool args_get_cmd(int argc, char* argv[], std::string& cmd);
bool args_get_dns(int argc, char* argv[], std::string& dns);
bool args_get_info(int argc, char* argv[], std::string& info);
bool args_get_verbose(int argc, char* argv[]);
bool args_get_nocertcheck(int argc, char* argv[]);
#endif

View File

@@ -60,6 +60,7 @@ int main(int argc, char* argv[])
std::string arg_dns;
std::string arg_info;
bool arg_verbose = false;
bool arg_nocertcheck = false;
if (argc == 1)
{
@@ -116,6 +117,13 @@ int main(int argc, char* argv[])
arg_verbose = true;
}
// no websocket server certificate verification
if (args_get_nocertcheck(argc, argv))
{
arg_nocertcheck = true;
}
// Print version info
usage_show_version();
@@ -160,11 +168,15 @@ int main(int argc, char* argv[])
{
client_config.set_proxy(web::web_proxy(utility::conversions::to_string_t(arg_proxy)));
}
#ifdef DEBUG
// skip certificate verification if debug build
std::cout << "Skipping certificate verification." << std::endl;
client_config.set_validate_certificates(false);
#endif
// websocket server certificate verification
if (arg_nocertcheck)
{
// skip websocket server certificate verification
std::cout << "Skipping certificate verification." << std::endl;
client_config.set_validate_certificates(false);
}
web::websockets::client::websocket_callback_client client(client_config);
std::condition_variable cv;
std::mutex mx;

View File

@@ -25,6 +25,7 @@ void usage_show_help()
std::cout << "Optional:" << std::endl;
std::cout << " -p, --proxy <addr> proxy address and port" << std::endl;
std::cout << " -d, --dns <dns> dns suffix override" << std::endl;
std::cout << " -n, --nocertcheck skip websocket server certificate verification" << std::endl;
std::cout << " -v, --verbose verbose output" << std::endl;
std::cout << std::endl;
std::cout << "Informational:" << std::endl;