When the `SSLClient` is used to connect to a plain-HTTP server (which
can happen in clients due to some end-user misconfiguration) it can
return a failure from the `send()` call without setting the `Error`
reference to the corresponding error code. This can cause problems to
callers, that may expect that, when the check like this is passed on
the response:
```c++
if (res.error() == Error::Success)
```
then they can access the response contents with `res.value()`. When
`SSLClient`'s connection fails - the contents `unique_ptr` is not set
and an attemt to access it causes UB.
This change fixes the `SSLClient::create_and_connect_socket` method
making sure that, the `Error` value is set correctly when the
`is_valid()` check fails.
* Fix use of dangling references
When the resolve thread is detached, local variables were still used, which could lead to a program crash.
* Add test to verify dangling ref fix
* Add missing brace initialization
* Assert that the remaining fields are really zeroed
* Fix use of chrono literals
* Initialize start time for server
By initializing start_time_ for server, I hope to measure the time taken to process a request at the end maybe in the set_logger callback and print it.
I only see current usage in client with server retaining the inital min value
* Add test to verify start time is initialized
* Address review comments
* run clang format
* osx: fix inconsistent use of the macro `TARGET_OS_OSX`
Fixed the build error on iOS:
```
httplib.h:3583:3: error: unknown type name 'CFStringRef'
870 | CFStringRef hostname_ref = CFStringCreateWithCString(
```
Note, `TARGET_OS_OSX` is defined but is 0 when `TARGET_OS_IOS` is 1,
and vise versa. Hence, `TARGET_OS_MAC` should have been used, that is
set to 1 for the both targets.
* improve: non-blocking getaddrinfo() for all mac target variants
`TARGET_OS_MAC` should have been used, that is set to 1 for all other
targets: OSX, IPHONE (IOS, TV, WATCH, VISION, BRIDGE), SIMULATOR,
DRIVERKIT.
This is a follow-up to commit 4ff7a1c858,
which introduced new simplified build options and deprecated the old
ones. I forgot to also change the various get_option() calls,
effectively rendering the new option names useless, as they would not
get honoured.
On 32-bit Windows, meson setup fails with an unclear error:
meson.build:25:16: ERROR: Could not get define 'CPPHTTPLIB_VERSION'
The actual problem is that httplib.h #errors out.
Have the Meson logic explicitly check for a 32-bit host and warn or error,
matching the check in httplib.h. Phrase the Windows error in a way that
triggers WrapDB CI's unsupported architecture check.
The "cpp-httplib_" prefix of build options is now dropped, as Meson
build options are already namespaced for each project. The old names
remain as deprecated aliases for the new ones.
This new option automatically enables the new non-blocking name
resolution when the appropriate libraries are found, automatically
adding them to the list of required dependencies. It will gracefully
fall back to the old behaviour when no library is found.
This complements commit ea850cbfa7.
* Add proxy test on CI
* Add Brotli and Zstd dev packages to proxy test workflow
* Fix Docker Compose command for GitHub Actions compatibility
* Add proxy readiness check and netcat dependency
* Use netcat-openbsd instead of virtual netcat package
* Add proxy startup delay and debug logging