Skip to content
Snippets Groups Projects
Commit f13f77ea authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

contrib: bump restbed for win32

Bumps Corvusoft/restbed and removes any unnecessary patches that
may either have been merged upstream or become useless somehow.

Change-Id: Iac2e4c1bc2655a83f60f85c1895d6ae837f9f6cb
Gitlab: #465
parent be9ef3ce
No related branches found
No related tags found
No related merge requests found
...@@ -256,10 +256,11 @@ mkdir build ...@@ -256,10 +256,11 @@ mkdir build
cd build cd build
setlocal setlocal
set PATH=C:\\Program Files\\CMake\\bin\\;%PATH% set PATH=C:\\Program Files\\CMake\\bin\\;%PATH%
set CMAKE_FLAGS=-DBUILD_SSL=ON -DBUILD_TESTS=OFF
if "%3"=="x86" ( if "%3"=="x86" (
cmake -DBUILD_SSL=ON -G "Visual Studio 15 2017 Win32" .. cmake %CMAKE_FLAGS% -G "Visual Studio 15 2017 Win32" ..
) else if "%3"=="x64" ( ) else if "%3"=="x64" (
cmake -DBUILD_SSL=ON -G "Visual Studio 15 2017 Win64" .. cmake %CMAKE_FLAGS% -G "Visual Studio 15 2017 Win64" ..
) )
cmake --build . --target ALL_BUILD --config Release cmake --build . --target ALL_BUILD --config Release
cd ..\.. cd ..\..
\ No newline at end of file
--- a/source/corvusoft/restbed/detail/socket_impl.cpp
+++ b/source/corvusoft/restbed/detail/socket_impl.cpp
@@ -418,20 +418,40 @@ namespace restbed
m_timer->async_wait( bind( &SocketImpl::connection_timeout_handler, this, shared_from_this( ), _1 ) );
size_t size = 0;
+ auto finished = std::make_shared<bool>(false);
+ auto sharedError = std::make_shared<error_code>();
+ auto sharedSize = std::make_shared<size_t>(0);
#ifdef BUILD_SSL
if ( m_socket not_eq nullptr )
{
#endif
size = asio::read( *m_socket, *data, asio::transfer_at_least( length ), error );
+ asio::async_read(*m_socket, *data, asio::transfer_at_least(length),
+ [this, finished, sharedSize, sharedError](const error_code & error, size_t size) {
+ *sharedError = error;
+ *sharedSize = size;
+ *finished = true;
+ });
#ifdef BUILD_SSL
}
else
{
size = asio::read( *m_ssl_socket, *data, asio::transfer_at_least( length ), error );
+ asio::async_read(*m_ssl_socket, *data, asio::transfer_at_least(length),
+ [this, finished, sharedSize, sharedError](const error_code & error, size_t size) {
+ *sharedError = error;
+ *sharedSize = size;
+ *finished = true;
+ });
}
#endif
+ auto& io_service = m_socket->get_io_service();
+ while (!*finished)
+ io_service.run_one();
+ error = *sharedError;
+ size = *sharedSize;
m_timer->cancel( );
if ( error )
@@ -549,21 +569,40 @@ namespace restbed
m_timer->async_wait( bind( &SocketImpl::connection_timeout_handler, this, shared_from_this( ), _1 ) );
size_t length = 0;
-
+ auto finished = std::make_shared<bool>(false);
+ auto sharedError = std::make_shared<error_code>();
+ auto sharedLength = std::make_shared<size_t>(0);
#ifdef BUILD_SSL
if ( m_socket not_eq nullptr )
{
#endif
length = asio::read_until( *m_socket, *data, delimiter, error );
+ asio::async_read_until(*m_socket, *data, delimiter,
+ [this, finished, sharedLength, sharedError](const error_code & error, size_t length) {
+ *sharedError = error;
+ *sharedLength = length;
+ *finished = true;
+ });
#ifdef BUILD_SSL
}
else
{
length = asio::read_until( *m_ssl_socket, *data, delimiter, error );
+ asio::async_read_until(*m_ssl_socket, *data, delimiter,
+ [this, finished, sharedLength, sharedError](const error_code & error, size_t length) {
+ *sharedError = error;
+ *sharedLength = length;
+ *finished = true;
+ });
}
#endif
+ auto& io_service = m_socket->get_io_service();
+ while (!*finished)
+ io_service.run_one();
+ error = *sharedError;
+ length = *sharedLength;
m_timer->cancel( );
if ( error )
--
2.10.2.windows.1
--- a/cmake/configuration.cmake
+++ b/cmake/configuration.cmake
@@ -37,13 +37,7 @@ elseif( ${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC )
if ( ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 19.00.23026.0 )
message( WARNING "\nMSVC compiler version < 19.00.23026.0" )
endif ( )
- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT /std:c++latest /D_WIN32_WINNT=0x0601 /W4 /wd4068 /wd4702 /wd4996" )
-
- foreach ( flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO )
- if ( ${flag_var} MATCHES "/MD" )
- string( REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}" )
- endif ( ${flag_var} MATCHES "/MD" )
- endforeach ( )
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MD /std:c++latest /D_WIN32_WINNT=0x0601 /W4 /wd4068 /wd4702 /wd4996" )
else ( )
message( FATAL_ERROR "Compiler not supported.")
endif ( )
--
2.10.2.windows.1
set BUILD=%SRC%..\build set BUILD=%SRC%..\build
mkdir %BUILD%
set RESTBED_VERSION=df867a858dddc4cf6ca8642da02720bd65ba239a set RESTBED_VERSION=bf61912c80572475b83a2fcf0da519f492a4d99e
set RESTBED_URL=https://github.com/Corvusoft/restbed/archive/%RESTBED_VERSION%.tar.gz set RESTBED_URL=https://github.com/Corvusoft/restbed/archive/%RESTBED_VERSION%.tar.gz
mkdir %BUILD%
if %USE_CACHE%==1 ( if %USE_CACHE%==1 (
copy %CACHE_DIR%\%RESTBED_VERSION%.tar.gz %cd% copy %CACHE_DIR%\%RESTBED_VERSION%.tar.gz %cd%
) else ( ) else (
...@@ -18,11 +17,13 @@ del %RESTBED_VERSION%.tar && del %RESTBED_VERSION%.tar.gz && del %BUILD%\pax_glo ...@@ -18,11 +17,13 @@ del %RESTBED_VERSION%.tar && del %RESTBED_VERSION%.tar.gz && del %BUILD%\pax_glo
rename %BUILD%\restbed-%RESTBED_VERSION% restbed rename %BUILD%\restbed-%RESTBED_VERSION% restbed
cd %BUILD%\restbed cd %BUILD%\restbed
%APPLY_CMD% %SRC%\restbed\async_read_until-uwp.patch
%APPLY_CMD% %SRC%\restbed\cmake-uwp.patch %APPLY_CMD% %SRC%\restbed\win32_cmake-find-openssl-shared.patch
cd .. cd ..
:: submodules
rmdir /s /q %BUILD%\restbed\dependency rmdir /s /q %BUILD%\restbed\dependency
mkdir %BUILD%\restbed\dependency mkdir %BUILD%\restbed\dependency
cd %BUILD%\restbed\dependency cd %BUILD%\restbed\dependency
...@@ -86,21 +87,4 @@ if "%1"=="uwp" ( ...@@ -86,21 +87,4 @@ if "%1"=="uwp" (
%APPLY_CMD% %SRC%\restbed\openssl-uwp.patch %APPLY_CMD% %SRC%\restbed\openssl-uwp.patch
) )
cd ..
rem ------------ kashmir ------------
set KASHMIR_VERSION=2f3913f49c4ac7f9bff9224db5178f6f8f0ff3ee
set KASHMIR_URL=https://github.com/corvusoft/kashmir-dependency/archive/%KASHMIR_VERSION%.tar.gz
if %USE_CACHE%==1 (
copy %CACHE_DIR%\%KASHMIR_VERSION%.tar.gz %cd%
) else (
%WGET_CMD% %KASHMIR_URL%
)
7z -y x %KASHMIR_VERSION%.tar.gz && 7z -y x %KASHMIR_VERSION%.tar
del %KASHMIR_VERSION%.tar && del %KASHMIR_VERSION%.tar.gz && del pax_global_header
rename kashmir-dependency-%KASHMIR_VERSION% kashmir
cd %SRC% cd %SRC%
\ No newline at end of file
--- a/cmake/Findopenssl.cmake
+++ b/cmake/Findopenssl.cmake
@@ -1,8 +1,8 @@
find_library( ssl_LIBRARY_STATIC libssl.a ssleay32.lib HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
find_library( crypto_LIBRARY_STATIC libcrypto.a libeay32.lib HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
-find_library( ssl_LIBRARY_SHARED libssl.so libssl.dylib ssleay32.dll HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
-find_library( crypto_LIBRARY_SHARED libcrypto.so libcrypto.dylib libeay32.dll HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
+find_library( ssl_LIBRARY_SHARED libssl.so libssl.dylib ssleay32 HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
+find_library( crypto_LIBRARY_SHARED libcrypto.so libcrypto.dylib libeay32 HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
find_path( ssl_INCLUDE openssl/ssl.h HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/inc32" "${PROJECT_SOURCE_DIR}/dependency/openssl/include" "/usr/local/opt/openssl/include" "/usr/include" "/usr/local/include" "/opt/local/include" )
--
2.19.0.windows.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment