Skip to content

Commit fc76418

Browse files
authored
Merge pull request #1 from amini-allight/develop
Compatibility fixes for Boost 1.87
2 parents 1b11fd3 + a11fa6f commit fc76418

File tree

123 files changed

+3549
-1504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+3549
-1504
lines changed

.travis.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
language: cpp
2+
dist: bionic
23
compiler:
34
- gcc
4-
before_install:
5-
#- sudo apt-get install libboost-chrono1.48-dev libboost-regex1.48-dev libboost-system1.48-dev libboost-thread1.48-dev libboost-test1.48-dev libboost-random1.48-dev -y
6-
- sudo add-apt-repository -y ppa:boost-latest/ppa && sudo apt-get update -q && sudo apt-get install -y libboost-chrono1.55-dev libboost-random1.55-dev libboost-regex1.55-dev libboost-system1.55-dev libboost-thread1.55-dev libboost-test1.55-dev
5+
addons:
6+
apt:
7+
packages:
8+
- libboost-random-dev
9+
- libboost-system-dev
10+
- libboost-test-dev
11+
- libboost-thread-dev
12+
- zlib1g-dev
13+
- cmake
714
env:
815
global:
916
- BOOST_INCLUDES=/usr/include
1017
- BOOST_LIBS=/usr/lib/x86_64-linux-gnu
11-
script: scons -j 2 && scons test
18+
script: cmake -DBUILD_EXAMPLES=1 -DBUILD_TESTS=1 . && make -j 2 && make test
1219
branches:
13-
only:
14-
- master
15-
- develop
20+
except:
21+
- 0.2.x
22+
- experimental
23+
- legacy
24+
1625
notifications:
1726
recipients:
1827
- travis@zaphoyd.com

CMakeLists.txt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ endif ()
2424
############ Project name and version
2525
set (WEBSOCKETPP_MAJOR_VERSION 0)
2626
set (WEBSOCKETPP_MINOR_VERSION 8)
27-
set (WEBSOCKETPP_PATCH_VERSION 2)
27+
set (WEBSOCKETPP_PATCH_VERSION 3)
2828
set (WEBSOCKETPP_VERSION ${WEBSOCKETPP_MAJOR_VERSION}.${WEBSOCKETPP_MINOR_VERSION}.${WEBSOCKETPP_PATCH_VERSION})
2929

3030
if(POLICY CMP0048)
@@ -39,11 +39,13 @@ endif()
3939

4040
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
4141

42+
include(GNUInstallDirs)
43+
4244
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
4345
if (WIN32 AND NOT CYGWIN)
4446
set (DEF_INSTALL_CMAKE_DIR cmake)
4547
else ()
46-
set (DEF_INSTALL_CMAKE_DIR lib/cmake/websocketpp)
48+
set (DEF_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/websocketpp)
4749
endif ()
4850
set (INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
4951

@@ -75,6 +77,7 @@ include (CMakeHelpers)
7577
option (ENABLE_CPP11 "Build websocketpp with CPP11 features enabled." TRUE)
7678
option (BUILD_EXAMPLES "Build websocketpp examples." FALSE)
7779
option (BUILD_TESTS "Build websocketpp tests." FALSE)
80+
option (USE_ASIO_STANDALONE "Build websocketpp examples and tests using the standalone ASIO library." FALSE)
7881

7982
if (BUILD_TESTS OR BUILD_EXAMPLES)
8083

@@ -123,11 +126,15 @@ if (BUILD_TESTS OR BUILD_EXAMPLES)
123126

124127
# g++
125128
if (CMAKE_COMPILER_IS_GNUCXX)
126-
if (NOT APPLE)
129+
if (NOT APPLE AND NOT HAIKU)
127130
set (WEBSOCKETPP_PLATFORM_LIBS pthread rt)
131+
else()
132+
if (HAIKU)
133+
set (WEBSOCKETPP_PLATFORM_LIBS pthread network)
128134
else()
129135
set (WEBSOCKETPP_PLATFORM_LIBS pthread)
130136
endif()
137+
endif()
131138
set (WEBSOCKETPP_PLATFORM_TLS_LIBS ssl crypto)
132139
set (WEBSOCKETPP_BOOST_LIBS system thread)
133140
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
@@ -145,14 +152,16 @@ if (BUILD_TESTS OR BUILD_EXAMPLES)
145152

146153
# clang
147154
if (CMAKE_COMPILER_IS_CLANGXX)
148-
if (NOT APPLE)
149-
set (WEBSOCKETPP_PLATFORM_LIBS pthread rt)
150-
else()
155+
if (APPLE)
151156
set (WEBSOCKETPP_PLATFORM_LIBS pthread)
157+
elseif (HAIKU)
158+
set (WEBSOCKETPP_PLATFORM_LIBS pthread network)
159+
else()
160+
set (WEBSOCKETPP_PLATFORM_LIBS pthread rt)
152161
endif()
153162
set (WEBSOCKETPP_PLATFORM_TLS_LIBS ssl crypto)
154163
set (WEBSOCKETPP_BOOST_LIBS system thread)
155-
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++0x -stdlib=libc++") # todo: is libc++ really needed here?
164+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
156165
if (NOT APPLE)
157166
add_definitions (-DNDEBUG -Wall -Wno-padded) # todo: should we use CMAKE_C_FLAGS for these?
158167
endif ()
@@ -215,7 +224,7 @@ if (BUILD_TESTS OR BUILD_EXAMPLES)
215224
set (Boost_USE_MULTITHREADED TRUE)
216225
set (Boost_ADDITIONAL_VERSIONS "1.39.0" "1.40.0" "1.41.0" "1.42.0" "1.43.0" "1.44.0" "1.46.1") # todo: someone who knows better spesify these!
217226

218-
find_package (Boost 1.39.0 COMPONENTS "${WEBSOCKETPP_BOOST_LIBS}")
227+
find_package (Boost 1.39.0 COMPONENTS ${WEBSOCKETPP_BOOST_LIBS})
219228

220229
if (Boost_FOUND)
221230
# Boost is a project wide global dependency.
@@ -246,6 +255,10 @@ endif()
246255

247256
############ Add projects
248257

258+
if (USE_ASIO_STANDALONE)
259+
add_definitions("-DASIO_STANDALONE -DASIO_HAS_BOOST_DATE_TIME")
260+
endif ()
261+
249262
# Add main library
250263
add_subdirectory (websocketpp)
251264

COPYING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Main Library:
22

3+
BSD 3-Clause License
4+
35
Copyright (c) 2014, Peter Thorson. All rights reserved.
46

57
Redistribution and use in source and binary forms, with or without
@@ -64,6 +66,8 @@ use as a header only library. This conversion was done by Peter Thorson
6466
(webmaster@zaphoyd.com) in 2013. All modifications to the code are redistributed
6567
under the same license as the original, which is listed below.
6668

69+
New BSD License / 3-Clause BSD License
70+
6771
Copyright (c) 2011, Micael Hildenborg
6872
All rights reserved.
6973

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = WebSocket++
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 0.8.2
41+
PROJECT_NUMBER = 0.8.3-dev
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

SConstruct

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
import os, sys, commands
1+
import os, sys, SCons.Errors
2+
from subprocess import check_output
3+
24
env = Environment(ENV = os.environ)
35

46
# figure out a better way to configure this
5-
if os.environ.has_key('CXX'):
7+
if 'CXX' in os.environ:
68
env['CXX'] = os.environ['CXX']
79

8-
if os.environ.has_key('DEBUG'):
10+
if 'DEBUG' in os.environ:
911
env['DEBUG'] = os.environ['DEBUG']
1012

11-
if os.environ.has_key('CXXFLAGS'):
13+
if 'CXXFLAGS' in os.environ:
1214
#env['CXXFLAGS'] = os.environ['CXXFLAGS']
1315
env.Append(CXXFLAGS = os.environ['CXXFLAGS'])
1416

15-
if os.environ.has_key('LINKFLAGS'):
17+
if 'LINKFLAGS' in os.environ:
1618
#env['LDFLAGS'] = os.environ['LDFLAGS']
1719
env.Append(LINKFLAGS = os.environ['LINKFLAGS'])
1820

@@ -22,24 +24,24 @@ if os.environ.has_key('LINKFLAGS'):
2224
## or set BOOST_INCLUDES and BOOST_LIBS if Boost comes with your OS distro e.g. and
2325
## needs BOOST_INCLUDES=/usr/include/boost and BOOST_LIBS=/usr/lib like Ubuntu.
2426
##
25-
if os.environ.has_key('BOOSTROOT'):
27+
if 'BOOSTROOT' in os.environ:
2628
os.environ['BOOST_ROOT'] = os.environ['BOOSTROOT']
2729

28-
if os.environ.has_key('BOOST_ROOT'):
30+
if 'BOOST_ROOT' in os.environ:
2931
env['BOOST_INCLUDES'] = os.environ['BOOST_ROOT']
3032
env['BOOST_LIBS'] = os.path.join(os.environ['BOOST_ROOT'], 'stage', 'lib')
31-
elif os.environ.has_key('BOOST_INCLUDES') and os.environ.has_key('BOOST_LIBS'):
33+
elif 'BOOST_INCLUDES' in os.environ and 'BOOST_LIBS' in os.environ:
3234
env['BOOST_INCLUDES'] = os.environ['BOOST_INCLUDES']
3335
env['BOOST_LIBS'] = os.environ['BOOST_LIBS']
3436
else:
35-
raise SCons.Errors.UserError, "Neither BOOST_ROOT, nor BOOST_INCLUDES + BOOST_LIBS was set!"
37+
raise SCons.Errors.UserError("Neither BOOST_ROOT, nor BOOST_INCLUDES + BOOST_LIBS were set!")
3638

3739
## Custom OpenSSL
38-
if os.environ.has_key('OPENSSL_PATH'):
40+
if 'OPENSSL_PATH' in os.environ:
3941
env.Append(CPPPATH = os.path.join(os.environ['OPENSSL_PATH'], 'include'))
4042
env.Append(LIBPATH = os.environ['OPENSSL_PATH'])
4143

42-
if os.environ.has_key('WSPP_ENABLE_CPP11'):
44+
if 'WSPP_ENABLE_CPP11' in os.environ:
4345
env['WSPP_ENABLE_CPP11'] = True
4446
else:
4547
env['WSPP_ENABLE_CPP11'] = False
@@ -76,17 +78,17 @@ if env['PLATFORM'].startswith('win'):
7678
env['CCFLAGS'] = '%s /EHsc /GR /GS- /MD /nologo %s %s' % (warn_flags, arch_flags, opt_flags)
7779
env['LINKFLAGS'] = '/INCREMENTAL:NO /MANIFEST /NOLOGO /OPT:REF /OPT:ICF /MACHINE:X86'
7880
elif env['PLATFORM'] == 'posix':
79-
if env.has_key('DEBUG'):
81+
if 'DEBUG' in env:
8082
env.Append(CCFLAGS = ['-g', '-O0'])
8183
else:
8284
env.Append(CPPDEFINES = ['NDEBUG'])
8385
env.Append(CCFLAGS = ['-O1', '-fomit-frame-pointer'])
8486
env.Append(CCFLAGS = ['-Wall'])
8587
#env['LINKFLAGS'] = ''
8688
elif env['PLATFORM'] == 'darwin':
87-
if not os.environ.has_key('CXX'):
89+
if not 'CXX' in os.environ:
8890
env['CXX'] = "clang++"
89-
if env.has_key('DEBUG'):
91+
if 'DEBUG' in env:
9092
env.Append(CCFLAGS = ['-g', '-O0'])
9193
else:
9294
env.Append(CPPDEFINES = ['NDEBUG'])
@@ -157,29 +159,29 @@ env_cpp11 = env.Clone ()
157159

158160
if env_cpp11['CXX'].startswith('g++'):
159161
# TODO: check g++ version
160-
GCC_VERSION = commands.getoutput(env_cpp11['CXX'] + ' -dumpversion')
162+
GCC_VERSION = check_output([env_cpp11['CXX'], '-dumpversion']).decode("utf-8")
161163

162164
if GCC_VERSION > "4.4.0":
163-
print "C++11 build environment partially enabled"
165+
print("C++11 build environment partially enabled")
164166
env_cpp11.Append(WSPP_CPP11_ENABLED = "true",CXXFLAGS = ['-std=c++0x'],TOOLSET = ['g++'],CPPDEFINES = ['_WEBSOCKETPP_CPP11_STL_'])
165167
else:
166-
print "C++11 build environment is not supported on this version of G++"
168+
print("C++11 build environment is not supported on this version of G++")
167169
elif env_cpp11['CXX'].startswith('clang++'):
168-
print "C++11 build environment enabled"
169-
env.Append(CXXFLANGS = ['-stdlib=libc++'],LINKFLAGS=['-stdlib=libc++'])
170+
print("C++11 build environment enabled")
171+
env.Append(CXXFLAGS = ['-stdlib=libc++'],LINKFLAGS=['-stdlib=libc++'])
170172
env_cpp11.Append(WSPP_CPP11_ENABLED = "true",CXXFLAGS = ['-std=c++0x','-stdlib=libc++'],LINKFLAGS = ['-stdlib=libc++'],TOOLSET = ['clang++'],CPPDEFINES = ['_WEBSOCKETPP_CPP11_STL_'])
171173

172174
# look for optional second boostroot compiled with clang's libc++ STL library
173175
# this prevents warnings/errors when linking code built with two different
174176
# incompatible STL libraries.
175-
if os.environ.has_key('BOOST_ROOT_CPP11'):
177+
if 'BOOST_ROOT_CPP11' in os.environ:
176178
env_cpp11['BOOST_INCLUDES'] = os.environ['BOOST_ROOT_CPP11']
177179
env_cpp11['BOOST_LIBS'] = os.path.join(os.environ['BOOST_ROOT_CPP11'], 'stage', 'lib')
178-
elif os.environ.has_key('BOOST_INCLUDES_CPP11') and os.environ.has_key('BOOST_LIBS_CPP11'):
180+
elif 'BOOST_INCLUDES_CPP11' in os.environ and 'BOOST_LIBS_CPP11' in os.environ:
179181
env_cpp11['BOOST_INCLUDES'] = os.environ['BOOST_INCLUDES_CPP11']
180182
env_cpp11['BOOST_LIBS'] = os.environ['BOOST_LIBS_CPP11']
181183
else:
182-
print "C++11 build environment disabled"
184+
print("C++11 build environment disabled")
183185

184186
# if the build system is known to allow the isystem modifier for library include
185187
# values then use it for the boost libraries. Otherwise just add them to the
@@ -271,8 +273,8 @@ subprotocol_server = SConscript('#/examples/subprotocol_server/SConscript',varia
271273
# telemetry_server
272274
telemetry_server = SConscript('#/examples/telemetry_server/SConscript',variant_dir = builddir + 'telemetry_server',duplicate = 0)
273275

274-
# external_io_service
275-
external_io_service = SConscript('#/examples/external_io_service/SConscript',variant_dir = builddir + 'external_io_service',duplicate = 0)
276+
# external_io_context
277+
external_io_context = SConscript('#/examples/external_io_context/SConscript',variant_dir = builddir + 'external_io_context',duplicate = 0)
276278

277279
if not env['PLATFORM'].startswith('win'):
278280
# iostream_server

changelog.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,83 @@
11
HEAD
2+
- MINOR BREAKING BUNDLED LIBRARY CHANGE: The bundled mini-HTTP library has
3+
been refactored to eliminate its use of exceptions. This does not affect any
4+
of the core library APIs. If any users are calling into the underlying HTTP
5+
libraries directly (classes in the namespace `websocketpp::http::*`) they
6+
should review any error handling they do.
7+
- MINOR BREAKING BUNDLED LIBRARY CHANGE: The `websocketpp::utility::to_lower`
8+
function, from the bundled utility library, has been removed. This vestigial
9+
code was not used by the library at all and throwing warnings in MSVC.
10+
Thank you fedor-strelkov and maksis for reporting and remediation ideas. #956
11+
- Feature: WebSocket++ can now be compiled without exceptions by defining
12+
`_WEBSOCKETPP_NO_EXCEPTIONS` in the C++ preprocessor. All internal use of
13+
exceptions have been removed. External interfaces that throw exceptions are
14+
still avaliable and supported (except in exception free mode) but now have
15+
overloads that allow `error_code` based error handling.
16+
- Compatibility: Overhauled the URI authority parsing logic to be more
17+
compliant with RFC3986. WebSocket++ is now able to detect invalid registry
18+
hosts, invalid IPv4 and IPv6 literal addresses. Dozens of additional
19+
uri tests added (thank you to the uriparser project for inspiration & test
20+
cases). URI methods that produce URI strings will now produce RFC3986
21+
compliant URIs when IPv6 literals are involved. Thank you Jeff Davie,
22+
thorsten-klein, mstaz, and barsnick for reporting, example patches, and
23+
testing. #601 #879
24+
- Improvement: The error handling system for the server role's async start
25+
accept loop and connection generation has been significantly improved.
26+
`endpoint::get_connection` now takes an output parameter ec that gives
27+
a detailed error code if connection creation fails. `endpoint::start_accept`
28+
now accepts a handler function as a parameter instead of an error code.
29+
This handler function allows the client program to be alerted when the
30+
async accept loop stops (for any reason, including explicit cancellation)
31+
at any time. Previously, it was only possible to tell if the initial loop
32+
start had failed, making it difficult to tell when/if the async accept loop
33+
needed to be restarted. The loop handler returns two error codes, a higher
34+
level library code and a second more specific transport level code. The
35+
old `endpoint::get_connection` and `endpoint::start_accept` functions
36+
remain for backwards compatibility but are deprecated. Thank you Oleh
37+
Derevenko for reporting. #896
38+
- Improvement: Cancel ping timer before calling blocking pong handler.
39+
This should reduce any unnecessary expiration logic done to a timer
40+
that is going to be cancelled regardless. Thank you Oleh Derevenko
41+
for reporting. #901
42+
- Improvement: Cancel ping timer on connection close. Once the close handeshake
43+
begins, pong responses can no longer be delivered and any outstanding pings
44+
can be assumed to have been preempted by the close. fixes #664
45+
- Performance: Refactor to_hex utility method to reduce unecessary copying,
46+
std::string construction, and duplicated code. Add tests. Thank you Dmitry
47+
Matrokhin for reporting and the patch. #914
48+
- Performance: Move based overload for connection::set_body for C++11 and
49+
later compilers. Thank you Matus Kysel for the patch & tests. #792
50+
- Reliability: Add a few defensive assertions to guard against corrupted
51+
HTTP message reads. Thank you Oleh Derevenko for reporting. #899
52+
- Compatibility: Remove use of simple template ids in constructors. This was
53+
required to compile in C++20 mode and higher. Thank you yushb0602 for
54+
reporting and jcelerier for a patch.
55+
- Fix Regression: Correct a regression introduced in 0.8.0 that broke
56+
functionality for setting accepted socket options like TCP_NODELAY.
57+
#530 #812
58+
- Bug: Fix null pointer deference in proxy error handling code. Thank you
59+
abitmore for reporting and stkaufer for a patch. #820 #825
60+
- Documentation: Added language to explicitly clarify that the library
61+
license is in fact the 3-Clause BSD license. #906
62+
- Travis/CI: Updated Travis config to use newer version of ubuntu, and use
63+
CMake based build & tests.
64+
- SCons: Fix typo in SConstruct that prevented clang from getting the right
65+
value for CXXFLAGS. Thank you robinlinden for reporting and a patch. #878
66+
- SCons: Improve compatibility with Python 3. Thank you Jochen Jägers and
67+
Gianfranco Costamagna for reporting and the patches. #885 #857 #1024
68+
- SCons: Correct copy/paste error in `scratch_client` SConstruct file.
69+
Thank you kautsig for reporting and the patch. #893
70+
- CMake: Fix typo in CMakeLists.txt that caused CXX_FLAGS to be improperly
71+
quoted. Removed unnecessary hardcoded dependency on libc++ for clang.
72+
Thank you kraj and leochan2009 for reporting and a patch. #614 #859
73+
- CMake: Fix issue in CMakeLists.txt that caused boost dependencies to be
74+
seen as a single library rather than multiple. Thank you Gianfranco
75+
Costamagna for reporting and a patch. #855
76+
- CMake: Adjust CMake config to use GNUInstallDirs to choose install
77+
directories rather than hard coding. Thank you Khem Raj for reporting and
78+
a patch. #854
79+
- CMake: Improve support for building tests & examples on the Haiku platform
80+
Thank you Schrijvers Luc for reporting and the patch. #849
281

382
0.8.2 - 2020-04-19
483
- Examples: Update print_client_tls example to remove use of deprecated

0 commit comments

Comments
 (0)