mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-18 11:09:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
219d13b718 | ||
|
|
df20c27696 | ||
|
|
a5a62768c0 | ||
|
|
4001637beb | ||
|
|
47044c05a8 | ||
|
|
a449d82723 | ||
|
|
fee8e97b4e | ||
|
|
72d9ed4056 | ||
|
|
1be1b3a86d | ||
|
|
9452c0a4b6 | ||
|
|
307b729549 | ||
|
|
696239d6e1 | ||
|
|
6929d90353 | ||
|
|
348d032029 | ||
|
|
d1d3fcdfd5 | ||
|
|
abf3a67dd0 |
No files matched your search
+4
-15
@@ -100,6 +100,7 @@ if (BUILD_SHARED_LIBS AND WIN32 AND HTTPLIB_COMPILE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Threads needed for <thread> on some systems, and for <pthread.h> on Linux
|
# Threads needed for <thread> on some systems, and for <pthread.h> on Linux
|
||||||
|
set(THREADS_PREFER_PTHREAD_FLAG true)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
# Since Cmake v3.11, Crypto & SSL became optional when not specified as COMPONENTS.
|
# Since Cmake v3.11, Crypto & SSL became optional when not specified as COMPONENTS.
|
||||||
if(HTTPLIB_REQUIRE_OPENSSL)
|
if(HTTPLIB_REQUIRE_OPENSSL)
|
||||||
@@ -160,7 +161,7 @@ if(HTTPLIB_COMPILE)
|
|||||||
ERROR_VARIABLE _httplib_split_error
|
ERROR_VARIABLE _httplib_split_error
|
||||||
)
|
)
|
||||||
if(_httplib_split_error)
|
if(_httplib_split_error)
|
||||||
message(FATAL_ERROR "Failed when trying to split Cpp-httplib with the Python script.\n${_httplib_split_error}")
|
message(FATAL_ERROR "Failed when trying to split cpp-httplib with the Python script.\n${_httplib_split_error}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# split.py puts output in "out"
|
# split.py puts output in "out"
|
||||||
@@ -187,19 +188,9 @@ endif()
|
|||||||
# Only useful if building in-tree, versus using it from an installation.
|
# Only useful if building in-tree, versus using it from an installation.
|
||||||
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
|
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
|
||||||
|
|
||||||
# Might be missing some, but this list is somewhat comprehensive
|
# Require C++11
|
||||||
target_compile_features(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
|
target_compile_features(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
|
||||||
cxx_std_11
|
cxx_std_11
|
||||||
cxx_nullptr
|
|
||||||
cxx_lambdas
|
|
||||||
cxx_override
|
|
||||||
cxx_defaulted_functions
|
|
||||||
cxx_attribute_deprecated
|
|
||||||
cxx_auto_type
|
|
||||||
cxx_decltype
|
|
||||||
cxx_deleted_functions
|
|
||||||
cxx_range_for
|
|
||||||
cxx_sizeof_member
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
|
target_include_directories(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
|
||||||
@@ -274,11 +265,9 @@ endif()
|
|||||||
# and linkage information (doesn't find deps though).
|
# and linkage information (doesn't find deps though).
|
||||||
install(TARGETS ${PROJECT_NAME}
|
install(TARGETS ${PROJECT_NAME}
|
||||||
EXPORT httplibTargets
|
EXPORT httplibTargets
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
install(FILES "${_httplib_build_includedir}/httplib.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
install(FILES "${_httplib_build_includedir}/httplib.h" TYPE INCLUDE)
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ SSL Support
|
|||||||
|
|
||||||
SSL support is available with `CPPHTTPLIB_OPENSSL_SUPPORT`. `libssl` and `libcrypto` should be linked.
|
SSL support is available with `CPPHTTPLIB_OPENSSL_SUPPORT`. `libssl` and `libcrypto` should be linked.
|
||||||
|
|
||||||
NOTE: cpp-httplib currently supports only version 1.1.1.
|
NOTE: cpp-httplib currently supports only version 1.1.1 and 3.0.
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#ifndef CPPHTTPLIB_HTTPLIB_H
|
#ifndef CPPHTTPLIB_HTTPLIB_H
|
||||||
#define CPPHTTPLIB_HTTPLIB_H
|
#define CPPHTTPLIB_HTTPLIB_H
|
||||||
|
|
||||||
#define CPPHTTPLIB_VERSION "0.10.6"
|
#define CPPHTTPLIB_VERSION "0.10.7"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configuration
|
* Configuration
|
||||||
@@ -74,6 +74,10 @@
|
|||||||
#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH ((std::numeric_limits<size_t>::max)())
|
#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH ((std::numeric_limits<size_t>::max)())
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH
|
||||||
|
#define CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH 8192
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CPPHTTPLIB_TCP_NODELAY
|
#ifndef CPPHTTPLIB_TCP_NODELAY
|
||||||
#define CPPHTTPLIB_TCP_NODELAY false
|
#define CPPHTTPLIB_TCP_NODELAY false
|
||||||
#endif
|
#endif
|
||||||
@@ -144,8 +148,6 @@ using ssize_t = int;
|
|||||||
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
|
||||||
#include <wincrypt.h>
|
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
#ifndef WSA_FLAG_NO_HANDLE_INHERIT
|
#ifndef WSA_FLAG_NO_HANDLE_INHERIT
|
||||||
@@ -154,8 +156,6 @@ using ssize_t = int;
|
|||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma comment(lib, "ws2_32.lib")
|
#pragma comment(lib, "ws2_32.lib")
|
||||||
#pragma comment(lib, "crypt32.lib")
|
|
||||||
#pragma comment(lib, "cryptui.lib")
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef strcasecmp
|
#ifndef strcasecmp
|
||||||
@@ -170,7 +170,6 @@ using socket_t = SOCKET;
|
|||||||
#else // not _WIN32
|
#else // not _WIN32
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <cstring>
|
|
||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@@ -194,6 +193,7 @@ using socket_t = int;
|
|||||||
#endif
|
#endif
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
@@ -220,14 +220,21 @@ using socket_t = int;
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <wincrypt.h>
|
||||||
|
|
||||||
// these are defined in wincrypt.h and it breaks compilation if BoringSSL is
|
// these are defined in wincrypt.h and it breaks compilation if BoringSSL is
|
||||||
// used
|
// used
|
||||||
#ifdef _WIN32
|
|
||||||
#undef X509_NAME
|
#undef X509_NAME
|
||||||
#undef X509_CERT_PAIR
|
#undef X509_CERT_PAIR
|
||||||
#undef X509_EXTENSIONS
|
#undef X509_EXTENSIONS
|
||||||
#undef PKCS7_SIGNER_INFO
|
#undef PKCS7_SIGNER_INFO
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma comment(lib, "crypt32.lib")
|
||||||
|
#pragma comment(lib, "cryptui.lib")
|
||||||
#endif
|
#endif
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
@@ -2701,9 +2708,9 @@ inline socket_t create_client_socket(
|
|||||||
[&](socket_t sock2, struct addrinfo &ai) -> bool {
|
[&](socket_t sock2, struct addrinfo &ai) -> bool {
|
||||||
if (!intf.empty()) {
|
if (!intf.empty()) {
|
||||||
#ifdef USE_IF2IP
|
#ifdef USE_IF2IP
|
||||||
auto ip = if2ip(address_family, intf);
|
auto ip_from_if = if2ip(address_family, intf);
|
||||||
if (ip.empty()) { ip = intf; }
|
if (ip_from_if.empty()) { ip_from_if = intf; }
|
||||||
if (!bind_ip_address(sock2, ip.c_str())) {
|
if (!bind_ip_address(sock2, ip_from_if.c_str())) {
|
||||||
error = Error::BindIPAddress;
|
error = Error::BindIPAddress;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -4404,6 +4411,8 @@ inline void hosted_at(const char *hostname, std::vector<std::string> &addrs) {
|
|||||||
addrs.push_back(ip);
|
addrs.push_back(ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
freeaddrinfo(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string append_query_params(const char *path, const Params ¶ms) {
|
inline std::string append_query_params(const char *path, const Params ¶ms) {
|
||||||
@@ -4684,7 +4693,7 @@ inline ssize_t SocketStream::read(char *ptr, size_t size) {
|
|||||||
inline ssize_t SocketStream::write(const char *ptr, size_t size) {
|
inline ssize_t SocketStream::write(const char *ptr, size_t size) {
|
||||||
if (!is_writable()) { return -1; }
|
if (!is_writable()) { return -1; }
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(_WIN64)
|
||||||
size =
|
size =
|
||||||
(std::min)(size, static_cast<size_t>((std::numeric_limits<int>::max)()));
|
(std::min)(size, static_cast<size_t>((std::numeric_limits<int>::max)()));
|
||||||
#endif
|
#endif
|
||||||
@@ -5186,7 +5195,7 @@ inline bool Server::read_content(Stream &strm, Request &req, Response &res) {
|
|||||||
})) {
|
})) {
|
||||||
const auto &content_type = req.get_header_value("Content-Type");
|
const auto &content_type = req.get_header_value("Content-Type");
|
||||||
if (!content_type.find("application/x-www-form-urlencoded")) {
|
if (!content_type.find("application/x-www-form-urlencoded")) {
|
||||||
if (req.body.size() > CPPHTTPLIB_REQUEST_URI_MAX_LENGTH) {
|
if (req.body.size() > CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH) {
|
||||||
res.status = 413; // NOTE: should be 414?
|
res.status = 413; // NOTE: should be 414?
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -6313,8 +6322,8 @@ inline std::unique_ptr<Response> ClientImpl::send_with_content_provider(
|
|||||||
auto last = offset + data_len == content_length;
|
auto last = offset + data_len == content_length;
|
||||||
|
|
||||||
auto ret = compressor.compress(
|
auto ret = compressor.compress(
|
||||||
data, data_len, last, [&](const char *data, size_t data_len) {
|
data, data_len, last, [&](const char *compressed_data, size_t compressed_data_len) {
|
||||||
req.body.append(data, data_len);
|
req.body.append(compressed_data, compressed_data_len);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -7219,62 +7228,63 @@ inline bool SSLSocketStream::is_writable() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline ssize_t SSLSocketStream::read(char *ptr, size_t size) {
|
inline ssize_t SSLSocketStream::read(char *ptr, size_t size) {
|
||||||
|
size_t readbytes = 0;
|
||||||
if (SSL_pending(ssl_) > 0) {
|
if (SSL_pending(ssl_) > 0) {
|
||||||
return SSL_read(ssl_, ptr, static_cast<int>(size));
|
auto ret = SSL_read_ex(ssl_, ptr, size, &readbytes);
|
||||||
} else if (is_readable()) {
|
if (ret == 1) { return static_cast<ssize_t>(readbytes); }
|
||||||
auto ret = SSL_read(ssl_, ptr, static_cast<int>(size));
|
if (SSL_get_error(ssl_, ret) == SSL_ERROR_ZERO_RETURN) { return 0; }
|
||||||
if (ret < 0) {
|
return -1;
|
||||||
|
}
|
||||||
|
if (!is_readable()) { return -1; }
|
||||||
|
|
||||||
|
auto ret = SSL_read_ex(ssl_, ptr, size, &readbytes);
|
||||||
|
if (ret == 1) { return static_cast<ssize_t>(readbytes); }
|
||||||
auto err = SSL_get_error(ssl_, ret);
|
auto err = SSL_get_error(ssl_, ret);
|
||||||
int n = 1000;
|
int n = 1000;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
while (--n >= 0 && (err == SSL_ERROR_WANT_READ ||
|
while (--n >= 0 &&
|
||||||
(err == SSL_ERROR_SYSCALL &&
|
(err == SSL_ERROR_WANT_READ ||
|
||||||
WSAGetLastError() == WSAETIMEDOUT))) {
|
(err == SSL_ERROR_SYSCALL && WSAGetLastError() == WSAETIMEDOUT))) {
|
||||||
#else
|
#else
|
||||||
while (--n >= 0 && err == SSL_ERROR_WANT_READ) {
|
while (--n >= 0 && err == SSL_ERROR_WANT_READ) {
|
||||||
#endif
|
#endif
|
||||||
if (SSL_pending(ssl_) > 0) {
|
if (SSL_pending(ssl_) > 0) {
|
||||||
return SSL_read(ssl_, ptr, static_cast<int>(size));
|
ret = SSL_read_ex(ssl_, ptr, size, &readbytes);
|
||||||
} else if (is_readable()) {
|
if (ret == 1) { return static_cast<ssize_t>(readbytes); }
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
if (SSL_get_error(ssl_, ret) == SSL_ERROR_ZERO_RETURN) { return 0; }
|
||||||
ret = SSL_read(ssl_, ptr, static_cast<int>(size));
|
|
||||||
if (ret >= 0) { return ret; }
|
|
||||||
err = SSL_get_error(ssl_, ret);
|
|
||||||
} else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (!is_readable()) { return -1; }
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
ret = SSL_read_ex(ssl_, ptr, size, &readbytes);
|
||||||
|
if (ret == 1) { return static_cast<ssize_t>(readbytes); }
|
||||||
|
err = SSL_get_error(ssl_, ret);
|
||||||
}
|
}
|
||||||
}
|
if (err == SSL_ERROR_ZERO_RETURN) { return 0; }
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ssize_t SSLSocketStream::write(const char *ptr, size_t size) {
|
inline ssize_t SSLSocketStream::write(const char *ptr, size_t size) {
|
||||||
if (is_writable()) {
|
if (!is_writable()) { return -1; }
|
||||||
auto ret = SSL_write(ssl_, ptr, static_cast<int>(size));
|
size_t written = 0;
|
||||||
if (ret < 0) {
|
auto ret = SSL_write_ex(ssl_, ptr, size, &written);
|
||||||
|
if (ret == 1) { return static_cast<ssize_t>(written); }
|
||||||
auto err = SSL_get_error(ssl_, ret);
|
auto err = SSL_get_error(ssl_, ret);
|
||||||
int n = 1000;
|
int n = 1000;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
while (--n >= 0 && (err == SSL_ERROR_WANT_WRITE ||
|
while (--n >= 0 &&
|
||||||
(err == SSL_ERROR_SYSCALL &&
|
(err == SSL_ERROR_WANT_WRITE ||
|
||||||
WSAGetLastError() == WSAETIMEDOUT))) {
|
(err == SSL_ERROR_SYSCALL && WSAGetLastError() == WSAETIMEDOUT))) {
|
||||||
#else
|
#else
|
||||||
while (--n >= 0 && err == SSL_ERROR_WANT_WRITE) {
|
while (--n >= 0 && err == SSL_ERROR_WANT_WRITE) {
|
||||||
#endif
|
#endif
|
||||||
if (is_writable()) {
|
if (!is_writable()) { return -1; }
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
ret = SSL_write(ssl_, ptr, static_cast<int>(size));
|
ret = SSL_write_ex(ssl_, ptr, size, &written);
|
||||||
if (ret >= 0) { return ret; }
|
if (ret == 1) { return static_cast<ssize_t>(written); }
|
||||||
err = SSL_get_error(ssl_, ret);
|
err = SSL_get_error(ssl_, ret);
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
if (err == SSL_ERROR_ZERO_RETURN) { return 0; }
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7370,11 +7380,11 @@ inline SSL_CTX *SSLServer::ssl_context() const { return ctx_; }
|
|||||||
inline bool SSLServer::process_and_close_socket(socket_t sock) {
|
inline bool SSLServer::process_and_close_socket(socket_t sock) {
|
||||||
auto ssl = detail::ssl_new(
|
auto ssl = detail::ssl_new(
|
||||||
sock, ctx_, ctx_mutex_,
|
sock, ctx_, ctx_mutex_,
|
||||||
[&](SSL *ssl) {
|
[&](SSL *ssl2) {
|
||||||
return detail::ssl_connect_or_accept_nonblocking(
|
return detail::ssl_connect_or_accept_nonblocking(
|
||||||
sock, ssl, SSL_accept, read_timeout_sec_, read_timeout_usec_);
|
sock, ssl2, SSL_accept, read_timeout_sec_, read_timeout_usec_);
|
||||||
},
|
},
|
||||||
[](SSL * /*ssl*/) { return true; });
|
[](SSL * /*ssl2*/) { return true; });
|
||||||
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (ssl) {
|
if (ssl) {
|
||||||
@@ -7568,31 +7578,31 @@ inline bool SSLClient::load_certs() {
|
|||||||
inline bool SSLClient::initialize_ssl(Socket &socket, Error &error) {
|
inline bool SSLClient::initialize_ssl(Socket &socket, Error &error) {
|
||||||
auto ssl = detail::ssl_new(
|
auto ssl = detail::ssl_new(
|
||||||
socket.sock, ctx_, ctx_mutex_,
|
socket.sock, ctx_, ctx_mutex_,
|
||||||
[&](SSL *ssl) {
|
[&](SSL *ssl2) {
|
||||||
if (server_certificate_verification_) {
|
if (server_certificate_verification_) {
|
||||||
if (!load_certs()) {
|
if (!load_certs()) {
|
||||||
error = Error::SSLLoadingCerts;
|
error = Error::SSLLoadingCerts;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SSL_set_verify(ssl, SSL_VERIFY_NONE, nullptr);
|
SSL_set_verify(ssl2, SSL_VERIFY_NONE, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!detail::ssl_connect_or_accept_nonblocking(
|
if (!detail::ssl_connect_or_accept_nonblocking(
|
||||||
socket.sock, ssl, SSL_connect, connection_timeout_sec_,
|
socket.sock, ssl2, SSL_connect, connection_timeout_sec_,
|
||||||
connection_timeout_usec_)) {
|
connection_timeout_usec_)) {
|
||||||
error = Error::SSLConnection;
|
error = Error::SSLConnection;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server_certificate_verification_) {
|
if (server_certificate_verification_) {
|
||||||
verify_result_ = SSL_get_verify_result(ssl);
|
verify_result_ = SSL_get_verify_result(ssl2);
|
||||||
|
|
||||||
if (verify_result_ != X509_V_OK) {
|
if (verify_result_ != X509_V_OK) {
|
||||||
error = Error::SSLServerVerification;
|
error = Error::SSLServerVerification;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto server_cert = SSL_get_peer_certificate(ssl);
|
auto server_cert = SSL_get_peer_certificate(ssl2);
|
||||||
|
|
||||||
if (server_cert == nullptr) {
|
if (server_cert == nullptr) {
|
||||||
error = Error::SSLServerVerification;
|
error = Error::SSLServerVerification;
|
||||||
@@ -7609,8 +7619,8 @@ inline bool SSLClient::initialize_ssl(Socket &socket, Error &error) {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
[&](SSL *ssl) {
|
[&](SSL *ssl2) {
|
||||||
SSL_set_tlsext_host_name(ssl, host_.c_str());
|
SSL_set_tlsext_host_name(ssl2, host_.c_str());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+8
-10
@@ -19,22 +19,18 @@ project(
|
|||||||
# Check just in case downstream decides to edit the source
|
# Check just in case downstream decides to edit the source
|
||||||
# and add a project version
|
# and add a project version
|
||||||
version = meson.project_version()
|
version = meson.project_version()
|
||||||
python3 = find_program('python3')
|
|
||||||
if version == 'undefined'
|
if version == 'undefined'
|
||||||
# Meson doesn't have regular expressions, but since it is implemented
|
cxx = meson.get_compiler('cpp')
|
||||||
# in python we can be sure we can use it to parse the file manually
|
version = cxx.get_define('CPPHTTPLIB_VERSION',
|
||||||
version = run_command(
|
prefix: '#include <httplib.h>',
|
||||||
python3, '-c', 'import re; raw_version = re.search("User\-Agent.*cpp\-httplib/([0-9]+\.?)+", open("httplib.h").read()).group(0); print(re.search("([0-9]+\\.?)+", raw_version).group(0))',
|
include_directories: include_directories('.')).strip('"')
|
||||||
check: true
|
assert(version != '', 'failed to get version from httplib.h')
|
||||||
).stdout().strip()
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
message('cpp-httplib version ' + version)
|
|
||||||
|
|
||||||
deps = [dependency('threads')]
|
deps = [dependency('threads')]
|
||||||
args = []
|
args = []
|
||||||
|
|
||||||
openssl_dep = dependency('openssl', version: ['>=1.1.1', '<1.1.2'], required: get_option('cpp-httplib_openssl'))
|
openssl_dep = dependency('openssl', version: '>=1.1.1', required: get_option('cpp-httplib_openssl'))
|
||||||
if openssl_dep.found()
|
if openssl_dep.found()
|
||||||
deps += openssl_dep
|
deps += openssl_dep
|
||||||
args += '-DCPPHTTPLIB_OPENSSL_SUPPORT'
|
args += '-DCPPHTTPLIB_OPENSSL_SUPPORT'
|
||||||
@@ -65,6 +61,8 @@ endif
|
|||||||
cpp_httplib_dep = dependency('', required: false)
|
cpp_httplib_dep = dependency('', required: false)
|
||||||
|
|
||||||
if get_option('cpp-httplib_compile')
|
if get_option('cpp-httplib_compile')
|
||||||
|
python3 = find_program('python3')
|
||||||
|
|
||||||
httplib_ch = custom_target(
|
httplib_ch = custom_target(
|
||||||
'split',
|
'split',
|
||||||
input: 'httplib.h',
|
input: 'httplib.h',
|
||||||
|
|||||||
+1
-1
@@ -5,5 +5,5 @@
|
|||||||
option('cpp-httplib_openssl', type: 'feature', value: 'auto', description: 'Enable OpenSSL support')
|
option('cpp-httplib_openssl', type: 'feature', value: 'auto', description: 'Enable OpenSSL support')
|
||||||
option('cpp-httplib_zlib', type: 'feature', value: 'auto', description: 'Enable zlib support')
|
option('cpp-httplib_zlib', type: 'feature', value: 'auto', description: 'Enable zlib support')
|
||||||
option('cpp-httplib_brotli', type: 'feature', value: 'auto', description: 'Enable Brotli support')
|
option('cpp-httplib_brotli', type: 'feature', value: 'auto', description: 'Enable Brotli support')
|
||||||
option('cpp-httplib_compile', type: 'boolean', value: false, description: 'Split the header into a compilable header & source file')
|
option('cpp-httplib_compile', type: 'boolean', value: false, description: 'Split the header into a compilable header & source file (requires python3)')
|
||||||
option('cpp-httplib_test', type: 'boolean', value: false, description: 'Build tests')
|
option('cpp-httplib_test', type: 'boolean', value: false, description: 'Build tests')
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
CXX = clang++
|
CXX = clang++
|
||||||
CXXFLAGS = -g -std=c++11 -I. -Wall -Wextra -Wtype-limits -Wconversion # -fno-exceptions -DCPPHTTPLIB_NO_EXCEPTIONS -fsanitize=address
|
CXXFLAGS = -g -std=c++11 -I. -Wall -Wextra -Wtype-limits -Wconversion -Wshadow # -fno-exceptions -DCPPHTTPLIB_NO_EXCEPTIONS -fsanitize=address
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
#PREFIX = $(shell brew --prefix)
|
#PREFIX = $(shell brew --prefix)
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
POST /fform%u008ano栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽栽Line truncated
|
||||||
|
Don | ||||||