* SocketStream need to check connectivity for writability.
When the stream is used for SSE server which works via chunked content
provider it's not possible to check connectivity over writability
because it's wrapped by DataSink. It could make the server stalled, when
the provider wants to only keep connection without send data and certain
amount of clients consumes entire threadpool.
* add unittest for SocketStream::is_writable()
SocketStream::is_writable() should return false if peer is disconnected.
* revise broken unittest ServerTest.ClientStop
DataSink could be unwritable if it's backed by connection based. Because
it could be disconnected by client right after enter centent provider.
Co-authored-by: Changbin Park <changbin.park@ahnlab.com>
Release 0.11 broke backwards compatibility, meaning that different
cpp-httplib versions are compatible with each other only if the major
and minor version numbers are the same.
This patch reflects this in the build systems.
See #1209 for some more context.
* httplib.h
add multipart formdata for PUT in addition to POST as some REST
APIs use that.
Factor the boundary checking code into a helper and use it from
both Post() and Put().
* test/test.cc
add test cases for the above.
* Add support UNIX domain socket
* `set_address_family(AF_UNIX)` is required
* add unittest for UNIX domain socket
* add support UNIX domain socket with abstract address
Abstract address of AF_UNIX begins with null(0x00) which can't be
delivered via .c_str() method.
* add unittest for UNIX domain socket with abstract address
Co-authored-by: Changbin Park <changbin.park@ahnlab.com>
* Add get_socket_fd method to Client and ClientImpl, add according unit test
* Change name get_socket_fd to get_socket
* Change name get_socket to socket
Co-authored-by: ata.yardimci <ata.yardimci@erstream.com>
* ssize_t redefinition on Windows - int/int64 vs long/long long
* Define ssize_t as __int64 for _WIN64, not long long
Co-authored-by: iamttaM <9880090+oculusbytes@users.noreply.github.com>
* resolve problem: http server can't send file large than 2GB.
add unit test for http server send large file.
add /bigobj compile option to msvc x64.
* disable unit test "ServerLargeContentTest" due to out-of-memory on GitHub Actions.
- Enable THREADS_PREFER_PTHREAD_FLAG to use -pthread where supported
- Remove low-level compile features (closes#1272)
- Remove unneeded DESTINATION options where possible
Thanks to abf3a67dd070e138c0f1a20b913abf003193cb79 the use of python3
isn't required anymore to configure the build, so I moved the
find_program('python3') inside the "if compile" block.
This makes it possible to configure cpp-httplib on systems where python
isn't available with tools like muon: https://sr.ht/~lattis/muon/
* Add large data transfer test
* Replace `SSL_read` and `SSL_write` with `ex` functions
* Reflect review comment
* Fix return value of `SSLSocketStream::read/write`
* Fix return value in the case of `SSL_ERROR_ZERO_RETURN`
* Disable `LargeDataTransfer` test due to OoM in CI
Meson only runs required targets. The key_encrypted_pem and
cert_encrypted_pem targets added in 020b0db090dc8e197cbedbdc4db7e3120eda5333
and 8191fd8e6c5a27e034a34084afe61f17a9420cfa weren't added to the list
of targets required by the test target, so the generation of the
encrypted certs was skipped, resulting in the failure of
BindServerTest.BindAndListenSeparatelySSLEncryptedKey.
* meson: fix regression that broke extracting version
In commit 33f67386fec8040a36a26b2038b39dd8dcf2814d the code that
heuristically parsed the version broke due to the version being moved
around into a more easily accessible define.
While we are at it, pass the exact path of httplib.h to un-break usage
as a meson subproject. This was broken in commit
8ecdb1197967dea050fd38a8e9b5020e02320b31 which checked the return code
of trying to get the version; it was always broken, but formerly failed
in silence and resulted in no version number.
* meson: use the compiler builtins to extract the version from the header
As a convenient string define, it is now possible to ask the
preprocessor what the version of cpp-httplib is. This can be used from
meson too, in order to avoid encoding C++ file structure into python
regexes.