Compare commits
	
		
			5 Commits
		
	
	
		
			v10.1.5
			...
			feature/cp
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 7ff12a36b9 | ||
|  | 945c692227 | ||
|  | c16b64bcb2 | ||
|  | 886b8f54bf | ||
|  | 02810f9adf | 
							
								
								
									
										13
									
								
								.github/workflows/unittest_linux.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								.github/workflows/unittest_linux.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,13 +0,0 @@ | ||||
| name: linux | ||||
| on: | ||||
|   push: | ||||
|     paths-ignore: | ||||
|     - 'docs/**' | ||||
|  | ||||
| jobs: | ||||
|   linux: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|     - uses: actions/checkout@v1 | ||||
|     - name: make test_make | ||||
|       run: make test_make | ||||
							
								
								
									
										15
									
								
								.github/workflows/unittest_mac_tsan_mbedtls.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								.github/workflows/unittest_mac_tsan_mbedtls.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,15 +0,0 @@ | ||||
| name: mac_tsan_mbedtls | ||||
| on: | ||||
|   push: | ||||
|     paths-ignore: | ||||
|     - 'docs/**' | ||||
|  | ||||
| jobs: | ||||
|   mac_tsan_mbedtls: | ||||
|     runs-on: macOS-latest | ||||
|     steps: | ||||
|     - uses: actions/checkout@v1 | ||||
|     - name: install mbedtls | ||||
|       run: brew install mbedtls | ||||
|     - name: make test | ||||
|       run: make test_tsan_mbedtls | ||||
							
								
								
									
										15
									
								
								.github/workflows/unittest_mac_tsan_openssl.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								.github/workflows/unittest_mac_tsan_openssl.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,15 +0,0 @@ | ||||
| name: mac_tsan_openssl | ||||
| on: | ||||
|   push: | ||||
|     paths-ignore: | ||||
|     - 'docs/**' | ||||
|  | ||||
| jobs: | ||||
|   mac_tsan_openssl: | ||||
|     runs-on: macOS-latest | ||||
|     steps: | ||||
|     - uses: actions/checkout@v1 | ||||
|     - name: install openssl | ||||
|       run: brew install openssl@1.1 | ||||
|     - name: make test | ||||
|       run: make test_tsan_openssl | ||||
| @@ -1,13 +0,0 @@ | ||||
| name: mac_tsan_sectransport | ||||
| on: | ||||
|   push: | ||||
|     paths-ignore: | ||||
|     - 'docs/**' | ||||
|  | ||||
| jobs: | ||||
|   mac_tsan_sectransport: | ||||
|     runs-on: macOS-latest | ||||
|     steps: | ||||
|     - uses: actions/checkout@v1 | ||||
|     - name: make test_tsan | ||||
|       run: make test_tsan | ||||
							
								
								
									
										38
									
								
								.github/workflows/unittest_uwp.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								.github/workflows/unittest_uwp.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,38 +0,0 @@ | ||||
| name: uwp | ||||
| on: | ||||
|   push: | ||||
|     paths-ignore: | ||||
|     - 'docs/**' | ||||
|  | ||||
| jobs: | ||||
|   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_openssl: | ||||
| #     runs-on: windows-latest | ||||
| #     steps: | ||||
| #     - uses: actions/checkout@v1 | ||||
| #     - uses: seanmiddleditch/gha-setup-vsdevenv@master | ||||
| #     - run: | | ||||
| #         vcpkg install zlib:x64-windows | ||||
| #         vcpkg install openssl:x64-windows | ||||
| #     - run: | | ||||
| #         mkdir build | ||||
| #         cd build | ||||
| #         cmake -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_CXX_COMPILER=cl.exe -DUSE_OPEN_SSL=1 -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. | ||||
| #     - run: cmake --build build | ||||
| #  | ||||
| #     # Running the unittest does not work, the binary cannot be found | ||||
| #     #- run: ../build/test/ixwebsocket_unittest.exe | ||||
| #     # working-directory: test | ||||
							
								
								
									
										17
									
								
								.github/workflows/unittest_windows.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								.github/workflows/unittest_windows.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,17 +0,0 @@ | ||||
| name: windows | ||||
| on: | ||||
|   push: | ||||
|     paths-ignore: | ||||
|     - 'docs/**' | ||||
|  | ||||
| jobs: | ||||
|   windows: | ||||
|     runs-on: windows-latest | ||||
|     steps: | ||||
|     - uses: actions/checkout@v1 | ||||
|     - uses: seanmiddleditch/gha-setup-vsdevenv@master | ||||
|     - run: | | ||||
|         mkdir build | ||||
|         cd build | ||||
|         cmake -DCMAKE_CXX_COMPILER=cl.exe -DUSE_WS=1 -DUSE_TEST=1 .. | ||||
|     - run: cmake --build build | ||||
| @@ -1 +1 @@ | ||||
| docker/Dockerfile.alpine | ||||
| docker/Dockerfile.centos7_httpd | ||||
							
								
								
									
										33
									
								
								docker/Dockerfile.centos7_httpd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								docker/Dockerfile.centos7_httpd
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| FROM centos:7 as build | ||||
|  | ||||
| RUN yum install -y gcc-c++ make zlib-devel redhat-rpm-config | ||||
|  | ||||
| RUN groupadd app && useradd -g app app | ||||
| RUN chown -R app:app /opt | ||||
| RUN chown -R app:app /usr/local | ||||
|  | ||||
| # There is a bug in CMake where we cannot build from the root top folder | ||||
| # So we build from /opt | ||||
| COPY --chown=app:app . /opt | ||||
| WORKDIR /opt | ||||
|  | ||||
| USER app | ||||
| RUN [ "make", "httpd_linux" ] | ||||
| RUN [ "rm", "-rf", "build" ] | ||||
|  | ||||
| FROM centos:8 as runtime | ||||
|  | ||||
| RUN groupadd app && useradd -g app app | ||||
| COPY --chown=app:app --from=build /usr/local/bin/ixhttpd /usr/local/bin/ixhttpd | ||||
| RUN chmod +x /usr/local/bin/ixhttpd | ||||
| RUN ldd /usr/local/bin/ixhttpd | ||||
|  | ||||
| # Copy source code for gcc | ||||
| COPY --chown=app:app --from=build /opt /opt | ||||
|  | ||||
| # Now run in usermode | ||||
| USER app | ||||
| WORKDIR /home/app | ||||
|  | ||||
| ENTRYPOINT ["ixhttpd"] | ||||
| EXPOSE 9999 | ||||
| @@ -6,7 +6,7 @@ | ||||
|  *  Buid with make httpd | ||||
|  */ | ||||
|  | ||||
| #include <ixwebsocket/IXHttpServer.h> | ||||
| #include "IXHttpServer.h" | ||||
| #include <sstream> | ||||
| #include <iostream> | ||||
|  | ||||
| @@ -14,9 +14,10 @@ int main(int argc, char** argv) | ||||
| { | ||||
|     if (argc != 3) | ||||
|     { | ||||
|         std::cerr << "Usage: httpd <port> <host>" << std::endl; | ||||
|         std::cerr << " ./a.out 9090 127.0.0.1" << std::endl; | ||||
|         std::cerr << " ./a.out 9090 0.0.0.0" << std::endl; | ||||
|         std::cerr << "Usage: " << argv[0] | ||||
|                   << " <port> <host>" << std::endl; | ||||
|         std::cerr << " " << argv[0] << " 9090 127.0.0.1" << std::endl; | ||||
|         std::cerr << " " << argv[0] << " 9090 0.0.0.0" << std::endl; | ||||
|         return 1; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -6,6 +6,7 @@ | ||||
|  | ||||
| #include "IXSelectInterruptFactory.h" | ||||
|  | ||||
| #include "IXUniquePtr.h" | ||||
| #if defined(__linux__) || defined(__APPLE__) | ||||
| #include "IXSelectInterruptPipe.h" | ||||
| #else | ||||
| @@ -17,9 +18,9 @@ namespace ix | ||||
|     SelectInterruptPtr createSelectInterrupt() | ||||
|     { | ||||
| #if defined(__linux__) || defined(__APPLE__) | ||||
|         return std::make_unique<SelectInterruptPipe>(); | ||||
|         return ix::make_unique<SelectInterruptPipe>(); | ||||
| #else | ||||
|         return std::make_unique<SelectInterrupt>(); | ||||
|         return ix::make_unique<SelectInterrupt>(); | ||||
| #endif | ||||
|     } | ||||
| } // namespace ix | ||||
|   | ||||
| @@ -10,6 +10,7 @@ | ||||
| #include "IXNetSystem.h" | ||||
| #include "IXSelectInterrupt.h" | ||||
| #include "IXSocket.h" | ||||
| #include "IXUniquePtr.h" | ||||
| #include <fcntl.h> | ||||
| #include <string.h> | ||||
| #include <sys/types.h> | ||||
| @@ -65,7 +66,7 @@ namespace ix | ||||
|  | ||||
|             int timeoutMs = 10; | ||||
|             bool readyToRead = false; | ||||
|             auto selectInterrupt = std::make_unique<SelectInterrupt>(); | ||||
|             auto selectInterrupt = ix::make_unique<SelectInterrupt>(); | ||||
|             PollResultType pollResult = Socket::poll(readyToRead, timeoutMs, fd, selectInterrupt); | ||||
|  | ||||
|             if (pollResult == PollResultType::Timeout) | ||||
|   | ||||
| @@ -5,6 +5,7 @@ | ||||
|  */ | ||||
|  | ||||
| #include "IXSocketFactory.h" | ||||
| #include "IXUniquePtr.h" | ||||
|  | ||||
| #ifdef IXWEBSOCKET_USE_TLS | ||||
|  | ||||
| @@ -35,17 +36,17 @@ namespace ix | ||||
|  | ||||
|         if (!tls) | ||||
|         { | ||||
|             socket = std::make_unique<Socket>(fd); | ||||
|             socket = ix::make_unique<Socket>(fd); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
| #ifdef IXWEBSOCKET_USE_TLS | ||||
| #if defined(IXWEBSOCKET_USE_MBED_TLS) | ||||
|             socket = std::make_unique<SocketMbedTLS>(tlsOptions, fd); | ||||
|             socket = ix::make_unique<SocketMbedTLS>(tlsOptions, fd); | ||||
| #elif defined(IXWEBSOCKET_USE_OPEN_SSL) | ||||
|             socket = std::make_unique<SocketOpenSSL>(tlsOptions, fd); | ||||
|             socket = ix::make_unique<SocketOpenSSL>(tlsOptions, fd); | ||||
| #elif defined(__APPLE__) | ||||
|             socket = std::make_unique<SocketAppleSSL>(tlsOptions, fd); | ||||
|             socket = ix::make_unique<SocketAppleSSL>(tlsOptions, fd); | ||||
| #endif | ||||
| #else | ||||
|             errorMsg = "TLS support is not enabled on this platform."; | ||||
|   | ||||
| @@ -12,6 +12,7 @@ | ||||
| #include "IXSocket.h" | ||||
| #include "IXSocketConnect.h" | ||||
| #include "IXSocketFactory.h" | ||||
| #include "IXUniquePtr.h" | ||||
| #include <assert.h> | ||||
| #include <sstream> | ||||
| #include <stdio.h> | ||||
| @@ -258,7 +259,7 @@ namespace ix | ||||
|             // Use poll to check whether a new connection is in progress | ||||
|             int timeoutMs = 10; | ||||
|             bool readyToRead = true; | ||||
|             auto selectInterrupt = std::make_unique<SelectInterrupt>(); | ||||
|             auto selectInterrupt = ix::make_unique<SelectInterrupt>(); | ||||
|             PollResultType pollResult = | ||||
|                 Socket::poll(readyToRead, timeoutMs, _serverFd, selectInterrupt); | ||||
|  | ||||
|   | ||||
							
								
								
									
										18
									
								
								ixwebsocket/IXUniquePtr.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								ixwebsocket/IXUniquePtr.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| /* | ||||
|  *  IXUniquePtr.h | ||||
|  *  Author: Benjamin Sergeant | ||||
|  *  Copyright (c) 2020 Machine Zone, Inc. All rights reserved. | ||||
|  */ | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include <memory> | ||||
|  | ||||
| namespace ix | ||||
| { | ||||
|     template<typename T, typename... Args> | ||||
|     std::unique_ptr<T> make_unique(Args&&... args) | ||||
|     { | ||||
|         return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										29
									
								
								makefile
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								makefile
									
									
									
									
									
								
							| @@ -170,7 +170,7 @@ autobahn_report: | ||||
| 	cp -rvf ~/sandbox/reports/clients/* ../bsergean.github.io/IXWebSocket/autobahn/ | ||||
|  | ||||
| httpd: | ||||
| 	clang++ --std=c++14 --stdlib=libc++ httpd.cpp \ | ||||
| 	clang++ --std=c++11 --stdlib=libc++ -Iixwebsocket httpd.cpp \ | ||||
| 		ixwebsocket/IXSelectInterruptFactory.cpp \ | ||||
| 		ixwebsocket/IXCancellationRequest.cpp \ | ||||
| 		ixwebsocket/IXSocketTLSOptions.cpp \ | ||||
| @@ -189,7 +189,32 @@ httpd: | ||||
| 		ixwebsocket/IXConnectionState.cpp \ | ||||
| 		ixwebsocket/IXUrlParser.cpp \ | ||||
| 		ixwebsocket/IXSelectInterrupt.cpp \ | ||||
| 		ixwebsocket/apple/IXSetThreadName_apple.cpp -lz | ||||
| 		ixwebsocket/apple/IXSetThreadName_apple.cpp \ | ||||
| 		-lz | ||||
|  | ||||
| httpd_linux: | ||||
| 	g++ --std=c++11 -o ixhttpd httpd.cpp -Iixwebsocket \ | ||||
| 		ixwebsocket/IXSelectInterruptFactory.cpp \ | ||||
| 		ixwebsocket/IXCancellationRequest.cpp \ | ||||
| 		ixwebsocket/IXSocketTLSOptions.cpp \ | ||||
| 		ixwebsocket/IXUserAgent.cpp \ | ||||
| 		ixwebsocket/IXDNSLookup.cpp \ | ||||
| 		ixwebsocket/IXBench.cpp \ | ||||
| 		ixwebsocket/IXWebSocketHttpHeaders.cpp \ | ||||
| 		ixwebsocket/IXSelectInterruptPipe.cpp \ | ||||
| 		ixwebsocket/IXHttp.cpp \ | ||||
| 		ixwebsocket/IXSocketConnect.cpp \ | ||||
| 		ixwebsocket/IXSocket.cpp \ | ||||
| 		ixwebsocket/IXSocketServer.cpp \ | ||||
| 		ixwebsocket/IXNetSystem.cpp \ | ||||
| 		ixwebsocket/IXHttpServer.cpp \ | ||||
| 		ixwebsocket/IXSocketFactory.cpp \ | ||||
| 		ixwebsocket/IXConnectionState.cpp \ | ||||
| 		ixwebsocket/IXUrlParser.cpp \ | ||||
| 		ixwebsocket/IXSelectInterrupt.cpp \ | ||||
| 		ixwebsocket/linux/IXSetThreadName_linux.cpp \ | ||||
| 		-lz -lpthread | ||||
| 	cp -f ixhttpd /usr/local/bin | ||||
|  | ||||
| # For the fork that is configured with appveyor | ||||
| rebase_upstream: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user