Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
d8597b054c | |||
b34d9f6a06 | |||
b21e2506bf | |||
303f99a432 | |||
a42ccea8dd | |||
beb26bc096 | |||
b45980f0f6 | |||
fbca513008 | |||
33ebd00932 | |||
fbe5e74109 | |||
a9f5d5353f | |||
22e0083832 | |||
5632360fbd |
17
.github/workflows/ccpp.yml
vendored
17
.github/workflows/ccpp.yml
vendored
@ -9,8 +9,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: make test
|
- name: make test_make
|
||||||
run: make test
|
run: make test_make
|
||||||
|
|
||||||
mac_tsan_sectransport:
|
mac_tsan_sectransport:
|
||||||
runs-on: macOS-latest
|
runs-on: macOS-latest
|
||||||
@ -37,7 +37,7 @@ jobs:
|
|||||||
- name: make test
|
- name: make test
|
||||||
run: make test_tsan_mbedtls
|
run: make test_tsan_mbedtls
|
||||||
|
|
||||||
windows_openssl:
|
windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
@ -52,6 +52,17 @@ jobs:
|
|||||||
#- run: ../build/test/ixwebsocket_unittest.exe
|
#- run: ../build/test/ixwebsocket_unittest.exe
|
||||||
# working-directory: test
|
# working-directory: test
|
||||||
|
|
||||||
|
uwp:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: seanmiddleditch/gha-setup-vsdevenv@master
|
||||||
|
- run: |
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DCMAKE_CXX_COMPILER=cl.exe -DUSE_TEST=1 ..
|
||||||
|
- run: cmake --build build
|
||||||
|
|
||||||
#
|
#
|
||||||
# Windows with OpenSSL is working but disabled as it takes 13 minutes (10 for openssl) to build with vcpkg
|
# Windows with OpenSSL is working but disabled as it takes 13 minutes (10 for openssl) to build with vcpkg
|
||||||
#
|
#
|
||||||
|
106
CMakeLists.txt
106
CMakeLists.txt
@ -114,18 +114,15 @@ endif()
|
|||||||
option(USE_TLS "Enable TLS support" FALSE)
|
option(USE_TLS "Enable TLS support" FALSE)
|
||||||
|
|
||||||
if (USE_TLS)
|
if (USE_TLS)
|
||||||
option(USE_MBED_TLS "Use Mbed TLS" OFF)
|
# default to securetranport on Apple if nothing is configured
|
||||||
option(USE_OPEN_SSL "Use OpenSSL" OFF)
|
if (APPLE)
|
||||||
option(USE_SECURE_TRANSPORT "Use Secure Transport" OFF)
|
if (NOT USE_MBED_TLS AND NOT USE_OPEN_SSL) # unless we want something else
|
||||||
|
set(USE_SECURE_TRANSPORT ON)
|
||||||
# default to OpenSSL on windows if nothing is configured
|
endif()
|
||||||
if (WIN32 AND NOT USE_MBED_TLS)
|
else() # default to OpenSSL on all other platforms
|
||||||
option(USE_OPEN_SSL "Use OpenSSL" ON)
|
if (NOT USE_MBED_TLS) # Unless mbedtls is requested
|
||||||
endif()
|
set(USE_OPEN_SSL ON)
|
||||||
|
endif()
|
||||||
# default to securetranport on windows if nothing is configured
|
|
||||||
if (APPLE AND NOT USE_OPEN_SSL AND NOT USE_MBED_TLS)
|
|
||||||
option(USE_SECURE_TRANSPORT "Use Secure Transport" ON)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (USE_MBED_TLS)
|
if (USE_MBED_TLS)
|
||||||
@ -134,10 +131,11 @@ if (USE_TLS)
|
|||||||
elseif (USE_SECURE_TRANSPORT)
|
elseif (USE_SECURE_TRANSPORT)
|
||||||
list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketAppleSSL.h)
|
list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketAppleSSL.h)
|
||||||
list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketAppleSSL.cpp)
|
list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketAppleSSL.cpp)
|
||||||
else()
|
elseif (USE_OPEN_SSL)
|
||||||
set(USE_OPEN_SSL ON)
|
|
||||||
list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketOpenSSL.h)
|
list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketOpenSSL.h)
|
||||||
list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketOpenSSL.cpp)
|
list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketOpenSSL.cpp)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "TLS Configuration error: unknown backend")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -154,11 +152,53 @@ if (USE_TLS)
|
|||||||
target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_OPEN_SSL)
|
target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_OPEN_SSL)
|
||||||
elseif (USE_SECURE_TRANSPORT)
|
elseif (USE_SECURE_TRANSPORT)
|
||||||
target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_SECURE_TRANSPORT)
|
target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_SECURE_TRANSPORT)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "TLS Configuration error: unknown backend")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE AND USE_TLS AND NOT USE_MBED_TLS AND NOT USE_OPEN_SSL)
|
if (USE_TLS)
|
||||||
target_link_libraries(ixwebsocket "-framework foundation" "-framework security")
|
if (USE_OPEN_SSL)
|
||||||
|
message(STATUS "TLS configured to use openssl")
|
||||||
|
|
||||||
|
# Help finding Homebrew's OpenSSL on macOS
|
||||||
|
if (APPLE)
|
||||||
|
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/local/opt/openssl/lib)
|
||||||
|
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /usr/local/opt/openssl/include)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# This OPENSSL_FOUND check is to help find a cmake manually configured OpenSSL
|
||||||
|
if (NOT OPENSSL_FOUND)
|
||||||
|
find_package(OpenSSL REQUIRED)
|
||||||
|
endif()
|
||||||
|
message(STATUS "OpenSSL: " ${OPENSSL_VERSION})
|
||||||
|
|
||||||
|
add_definitions(${OPENSSL_DEFINITIONS})
|
||||||
|
target_include_directories(ixwebsocket PUBLIC ${OPENSSL_INCLUDE_DIR})
|
||||||
|
target_link_libraries(ixwebsocket ${OPENSSL_LIBRARIES})
|
||||||
|
elseif (USE_MBED_TLS)
|
||||||
|
message(STATUS "TLS configured to use mbedtls")
|
||||||
|
|
||||||
|
find_package(MbedTLS REQUIRED)
|
||||||
|
target_include_directories(ixwebsocket PUBLIC ${MBEDTLS_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(ixwebsocket ${MBEDTLS_LIBRARIES})
|
||||||
|
elseif (USE_SECURE_TRANSPORT)
|
||||||
|
message(STATUS "TLS configured to use secure transport")
|
||||||
|
target_link_libraries(ixwebsocket "-framework foundation" "-framework security")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# This ZLIB_FOUND check is to help find a cmake manually configured zlib
|
||||||
|
if (NOT ZLIB_FOUND)
|
||||||
|
find_package(ZLIB)
|
||||||
|
endif()
|
||||||
|
if (ZLIB_FOUND)
|
||||||
|
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(ixwebsocket ${ZLIB_LIBRARIES})
|
||||||
|
else()
|
||||||
|
include_directories(third_party/zlib ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib)
|
||||||
|
add_subdirectory(third_party/zlib)
|
||||||
|
target_link_libraries(ixwebsocket zlibstatic)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
@ -175,40 +215,6 @@ if (UNIX)
|
|||||||
target_link_libraries(ixwebsocket ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(ixwebsocket ${CMAKE_THREAD_LIBS_INIT})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (USE_TLS AND USE_OPEN_SSL)
|
|
||||||
|
|
||||||
# Help finding Homebrew's OpenSSL on macOS
|
|
||||||
if (APPLE)
|
|
||||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/local/opt/openssl/lib)
|
|
||||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /usr/local/opt/openssl/include)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT OPENSSL_FOUND)
|
|
||||||
find_package(OpenSSL REQUIRED)
|
|
||||||
endif()
|
|
||||||
add_definitions(${OPENSSL_DEFINITIONS})
|
|
||||||
message(STATUS "OpenSSL: " ${OPENSSL_VERSION})
|
|
||||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
||||||
target_link_libraries(ixwebsocket ${OPENSSL_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (USE_TLS AND USE_MBED_TLS)
|
|
||||||
find_package(MbedTLS REQUIRED)
|
|
||||||
target_include_directories(ixwebsocket PUBLIC ${MBEDTLS_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(ixwebsocket ${MBEDTLS_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT ZLIB_FOUND)
|
|
||||||
find_package(ZLIB)
|
|
||||||
endif()
|
|
||||||
if (ZLIB_FOUND)
|
|
||||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(ixwebsocket ${ZLIB_LIBRARIES})
|
|
||||||
else()
|
|
||||||
include_directories(third_party/zlib ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib)
|
|
||||||
add_subdirectory(third_party/zlib)
|
|
||||||
target_link_libraries(ixwebsocket zlibstatic)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set( IXWEBSOCKET_INCLUDE_DIRS
|
set( IXWEBSOCKET_INCLUDE_DIRS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
@ -1,6 +1,22 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
All changes to this project will be documented in this file.
|
All changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [9.5.4] - 2020-05-01
|
||||||
|
|
||||||
|
(windows) fix build for universal windows platform
|
||||||
|
|
||||||
|
## [9.5.3] - 2020-04-29
|
||||||
|
|
||||||
|
(http client) better current request cancellation support when the HttpClient destructor is invoked (see #189)
|
||||||
|
|
||||||
|
## [9.5.2] - 2020-04-27
|
||||||
|
|
||||||
|
(cmake) fix cmake broken tls option parsing
|
||||||
|
|
||||||
|
## [9.5.1] - 2020-04-27
|
||||||
|
|
||||||
|
(http client) Set default values for most HttpRequestArgs struct members (fix #185)
|
||||||
|
|
||||||
## [9.5.0] - 2020-04-25
|
## [9.5.0] - 2020-04-25
|
||||||
|
|
||||||
(ssl) Default to OpenSSL on Windows, since it can load the system certificates by default
|
(ssl) Default to OpenSSL on Windows, since it can load the system certificates by default
|
||||||
|
@ -4,6 +4,19 @@
|
|||||||
* Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
|
* Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// On Windows Universal Platform (uwp), gai_strerror defaults behavior is to returns wchar_t
|
||||||
|
// which is different from all other platforms. We want the non unicode version.
|
||||||
|
// See https://github.com/microsoft/vcpkg/pull/11030
|
||||||
|
// We could do this in IXNetSystem.cpp but so far we are only using gai_strerror in here.
|
||||||
|
//
|
||||||
|
#ifdef _UNICODE
|
||||||
|
#undef _UNICODE
|
||||||
|
#endif
|
||||||
|
#ifdef UNICODE
|
||||||
|
#undef UNICODE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "IXDNSLookup.h"
|
#include "IXDNSLookup.h"
|
||||||
|
|
||||||
#include "IXNetSystem.h"
|
#include "IXNetSystem.h"
|
||||||
|
@ -78,12 +78,12 @@ namespace ix
|
|||||||
WebSocketHttpHeaders extraHeaders;
|
WebSocketHttpHeaders extraHeaders;
|
||||||
std::string body;
|
std::string body;
|
||||||
std::string multipartBoundary;
|
std::string multipartBoundary;
|
||||||
int connectTimeout;
|
int connectTimeout = 60;
|
||||||
int transferTimeout;
|
int transferTimeout = 1800;
|
||||||
bool followRedirects;
|
bool followRedirects = true;
|
||||||
int maxRedirects;
|
int maxRedirects = 5;
|
||||||
bool verbose;
|
bool verbose = false;
|
||||||
bool compress;
|
bool compress = true;
|
||||||
Logger logger;
|
Logger logger;
|
||||||
OnProgressCallback onProgressCallback;
|
OnProgressCallback onProgressCallback;
|
||||||
};
|
};
|
||||||
|
@ -220,11 +220,10 @@ namespace ix
|
|||||||
|
|
||||||
std::string req(ss.str());
|
std::string req(ss.str());
|
||||||
std::string errMsg;
|
std::string errMsg;
|
||||||
std::atomic<bool> requestInitCancellation(false);
|
|
||||||
|
|
||||||
// Make a cancellation object dealing with connection timeout
|
// Make a cancellation object dealing with connection timeout
|
||||||
auto isCancellationRequested =
|
auto isCancellationRequested =
|
||||||
makeCancellationRequestWithTimeout(args->connectTimeout, requestInitCancellation);
|
makeCancellationRequestWithTimeout(args->connectTimeout, _stop);
|
||||||
|
|
||||||
bool success = _socket->connect(host, port, errMsg, isCancellationRequested);
|
bool success = _socket->connect(host, port, errMsg, isCancellationRequested);
|
||||||
if (!success)
|
if (!success)
|
||||||
@ -243,7 +242,7 @@ namespace ix
|
|||||||
|
|
||||||
// Make a new cancellation object dealing with transfer timeout
|
// Make a new cancellation object dealing with transfer timeout
|
||||||
isCancellationRequested =
|
isCancellationRequested =
|
||||||
makeCancellationRequestWithTimeout(args->transferTimeout, requestInitCancellation);
|
makeCancellationRequestWithTimeout(args->transferTimeout, _stop);
|
||||||
|
|
||||||
if (args->verbose)
|
if (args->verbose)
|
||||||
{
|
{
|
||||||
|
@ -6,4 +6,4 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define IX_WEBSOCKET_VERSION "9.5.0"
|
#define IX_WEBSOCKET_VERSION "9.5.4"
|
||||||
|
6
makefile
6
makefile
@ -20,7 +20,7 @@ install: brew
|
|||||||
# Release, Debug, MinSizeRel, RelWithDebInfo are the build types
|
# Release, Debug, MinSizeRel, RelWithDebInfo are the build types
|
||||||
#
|
#
|
||||||
brew:
|
brew:
|
||||||
mkdir -p build && (cd build ; cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; make -j 4 install)
|
mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; ninja install)
|
||||||
|
|
||||||
# Docker default target. We've add problem with OpenSSL and TLS 1.3 (on the
|
# Docker default target. We've add problem with OpenSSL and TLS 1.3 (on the
|
||||||
# server side ?) and I can't work-around it easily, so we're using mbedtls on
|
# server side ?) and I can't work-around it easily, so we're using mbedtls on
|
||||||
@ -103,6 +103,10 @@ test_server:
|
|||||||
# env TEST=Websocket_chat make test
|
# env TEST=Websocket_chat make test
|
||||||
# env TEST=heartbeat make test
|
# env TEST=heartbeat make test
|
||||||
test:
|
test:
|
||||||
|
mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; ninja install)
|
||||||
|
(cd test ; python2.7 run.py -r)
|
||||||
|
|
||||||
|
test_make:
|
||||||
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; make -j 4)
|
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; make -j 4)
|
||||||
(cd test ; python2.7 run.py -r)
|
(cd test ; python2.7 run.py -r)
|
||||||
|
|
||||||
|
@ -4,6 +4,14 @@
|
|||||||
* Copyright (c) 2019 Machine Zone. All rights reserved.
|
* Copyright (c) 2019 Machine Zone. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Using inet_addr will trigger an error on uwp without this
|
||||||
|
// FIXME: use a different api
|
||||||
|
#ifdef _WIN32
|
||||||
|
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||||
|
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "IXGetFreePort.h"
|
#include "IXGetFreePort.h"
|
||||||
|
|
||||||
#include <ixwebsocket/IXNetSystem.h>
|
#include <ixwebsocket/IXNetSystem.h>
|
||||||
|
Reference in New Issue
Block a user