Skip to content

Cannot seem to get even one backend to be tried no matter what I do #43

@nilFinx

Description

@nilFinx

Disclaimer, I am using Haiku. I repeat, Haiku. Not any Linux distro, but Haiku, a POSIX compliant OS that has some BSD compatibility headers and stuff.

The output:

Starting both http and https test
trying all clients available
whoops no available clients 
something is seriously wrong if you don't see 'test...'
nil     No applicable HTTPS implementation found
trying all clients available
whoops no available clients 
something is seriously wrong if you don't see 'test...'
nil     No applicable HTTPS implementation found

CMake build log:

-- The CXX compiler identification is GNU 13.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LuaJIT: /system/develop/lib/libluajit-5.1.so
-- Found CURL: /packages/curl-8.14.1-1/.self/develop/lib/libcurl.so (found version "8.14.1")
-- Found OpenSSL: /packages/openssl3-3.5.4-1/.self/develop/lib/libcrypto.so (found version "3.5.4")
-- Configuring done (0.5s)
-- Generating done (0.2s)
-- Build files have been written to: /boot/home/lua-https/build
[  7%] Building CXX object src/CMakeFiles/https-common.dir/common/HTTPS.cpp.o
[ 15%] Building CXX object src/CMakeFiles/https-common.dir/common/HTTPRequest.cpp.o
[ 23%] Building CXX object src/CMakeFiles/https-common.dir/common/HTTPSClient.cpp.o
[ 30%] Building CXX object src/CMakeFiles/https-common.dir/common/PlaintextConnection.cpp.o
[ 38%] Linking CXX static library libhttps-common.a
[ 38%] Built target https-common
[ 46%] Building CXX object src/CMakeFiles/https-openssl.dir/generic/OpenSSLConnection.cpp.o
[ 53%] Linking CXX static library libhttps-openssl.a
[ 53%] Built target https-openssl
[ 61%] Building CXX object src/CMakeFiles/https-curl.dir/generic/CurlClient.cpp.o
[ 69%] Linking CXX static library libhttps-curl.a
[ 69%] Built target https-curl
[ 76%] Building CXX object src/CMakeFiles/https-unix-libraryloader.dir/generic/UnixLibraryLoader.cpp.o
[ 84%] Linking CXX static library libhttps-unix-libraryloader.a
[ 84%] Built target https-unix-libraryloader
[ 92%] Building CXX object src/CMakeFiles/https.dir/lua/main.cpp.o
[100%] Linking CXX shared module https.so
[100%] Built target https
Install the project...
-- Install configuration: "Release"
-- Installing: /boot/home/lua-https/install/./https.so

ldd results:

install/https.so:     file format elf64-x86-64
install/https.so
  NEEDED               libstdc++.so.6
  NEEDED               libgcc_s.so.1
  NEEDED               libroot.so
  required from libgcc_s.so.1:
  required from libstdc++.so.6:

I created a build script to make testing easier with all the extra CMake flags:

#!/bin/sh
rm -rf build

cmake \
	-Bbuild -S. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/install \
	-DCMAKE_SYSTEM_NAME=Linux \
	-DLUAJIT_DIR=/system/develop/headers/luajit-2.1/ \
	-DLUAJIT_LIBRARY=/system/develop/lib/libluajit-5.1.so \
	-DHTTPS_BACKEND_CURL=ON \
	-DHTTPS_BACKEND_OPENSSL=ON \
	-DUSE_CURL_BACKEND=ON \
	-DUSE_OPENSSL_BACKEND=ON \

cmake --build build --target install

cd install
echo Starting both http and https test
luajit -e "print(require 'https'.request 'http://myip.wtf/text')"
luajit -e "print(require 'https'.request 'https://myip.wtf/text')"
cd ..

objdump -x install/https.so | grep \\.so # this is ldd on Linux

I also modified request:

HTTPSClient::Reply request(const HTTPSClient::Request &req)
{

	printf("trying all clients available\n");

	for (size_t i = 0; clients[i]; ++i)
	{
		HTTPSClient &client = *clients[i];
		printf("test... ");

		if (client.valid())
			return client.request(req);
	}

	printf("whoops no available clients \n");
	printf("something is seriously wrong if you don't see 'test...'\n");

	throw std::runtime_error("No applicable HTTPS implementation found");
}

Removing -DCMAKE_SYSTEM_NAME=Linux had no changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions