Skip to content

Commit eba9808

Browse files
authored
Fix yhirose#1628 (OpenSSL 1.1.1 End of Life on September 11, 2023) (yhirose#1745)
1 parent 374d058 commit eba9808

File tree

6 files changed

+7
-11
lines changed

6 files changed

+7
-11
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ option(HTTPLIB_NO_EXCEPTIONS "Disable the use of C++ exceptions" OFF)
8181

8282
# Change as needed to set an OpenSSL minimum version.
8383
# This is used in the installed Cmake config file.
84-
set(_HTTPLIB_OPENSSL_MIN_VER "1.1.1")
84+
set(_HTTPLIB_OPENSSL_MIN_VER "3.0.0")
8585

8686
# Allow for a build to require OpenSSL to pass, instead of just being optional
8787
option(HTTPLIB_REQUIRE_OPENSSL "Requires OpenSSL to be found & linked, or fails build." OFF)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ SSL Support
5353
5454
SSL support is available with `CPPHTTPLIB_OPENSSL_SUPPORT`. `libssl` and `libcrypto` should be linked.
5555
56-
NOTE: cpp-httplib currently supports only version 1.1.1 and 3.0.
56+
NOTE: cpp-httplib currently supports only version 3.0 or later. Please see [this page](https://www.openssl.org/policies/releasestrat.html) to get more information.
5757
5858
NOTE for macOS: cpp-httplib now can use system certs with `CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN`. `CoreFoundation` and `Security` should be linked with `-framework`.
5959

example/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ CXXFLAGS = -O2 -std=c++11 -I.. -Wall -Wextra -pthread
44
PREFIX = /usr/local
55
#PREFIX = $(shell brew --prefix)
66

7-
OPENSSL_DIR = $(PREFIX)/opt/[email protected]
8-
#OPENSSL_DIR = $(PREFIX)/opt/openssl@3
7+
OPENSSL_DIR = $(PREFIX)/opt/openssl@3
98
OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib -lssl -lcrypto
109

1110
ifneq ($(OS), Windows_NT)

httplib.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,8 @@ using socket_t = int;
264264
#include <iostream>
265265
#include <sstream>
266266

267-
#if OPENSSL_VERSION_NUMBER < 0x1010100fL
268-
#error Sorry, OpenSSL versions prior to 1.1.1 are not supported
269-
#elif OPENSSL_VERSION_NUMBER < 0x30000000L
270-
#define SSL_get1_peer_certificate SSL_get_peer_certificate
267+
#if OPENSSL_VERSION_NUMBER < 0x30000000L
268+
#error Sorry, OpenSSL versions prior to 3.0.0 are not supported
271269
#endif
272270

273271
#endif

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ endif
3030
deps = [dependency('threads')]
3131
args = []
3232

33-
openssl_dep = dependency('openssl', version: '>=1.1.1', required: get_option('cpp-httplib_openssl'))
33+
openssl_dep = dependency('openssl', version: '>=3.0.0', required: get_option('cpp-httplib_openssl'))
3434
if openssl_dep.found()
3535
deps += openssl_dep
3636
args += '-DCPPHTTPLIB_OPENSSL_SUPPORT'

test/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ CXXFLAGS = -g -std=c++11 -I. -Wall -Wextra -Wtype-limits -Wconversion -Wshadow #
44
PREFIX = /usr/local
55
#PREFIX = $(shell brew --prefix)
66

7-
OPENSSL_DIR = $(PREFIX)/opt/[email protected]
8-
#OPENSSL_DIR = $(PREFIX)/opt/openssl@3
7+
OPENSSL_DIR = $(PREFIX)/opt/openssl@3
98
OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib -lssl -lcrypto
109

1110
ifneq ($(OS), Windows_NT)

0 commit comments

Comments
 (0)