[NOT FOR MERGE] Add trivial program to debug certs issues

This commit is contained in:
Yves
2025-03-26 10:55:32 +01:00
parent 788dc4ea50
commit b787df497e
4 changed files with 122 additions and 0 deletions

22
test-ssl/CMakeLists.txt Normal file
View File

@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.5...3.31.5)
find_package(OpenSSL REQUIRED)
project("Test ssl")
set(CMAKE_CXX_STANDARD 11)
add_definitions(-DNO_DUCKDB_RE2 -DCMAKE_BUILD_TYPE=Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
include_directories(
${PROJECT_SOURCE_DIR}/../third_party/httplib
${PROJECT_SOURCE_DIR}/../duckdb/src/include)
add_executable("test_ssl" "test_ssl.cc")
target_link_libraries("test_ssl" OpenSSL::SSL OpenSSL::Crypto)
install(TARGETS "test_ssl")
# cmake -S . -G Ninja -B build && cmake --build build

16
test-ssl/test_ssl.cc Normal file
View File

@@ -0,0 +1,16 @@
#define CPPHTTPLIB_OPENSSL_SUPPORT
#include "httplib.hpp"
using namespace duckdb_httplib_openssl;
int main() {
Client client("https://ui.duckdb.org");
auto res = client.Get("/");
if (res) {
std::cout << "Status: " << res->status << std::endl;
std::cout << "Body: " << res->body.substr(0, 42) << "... (" << res->body.size() << ")" << std::endl;
} else {
std::cout << "Error: " << res.error() << std::endl;
}
return 0;
}