Client: cpp
lib/cpp/test and test/cpp built the SSL and non-blocking server tests against
OpenSSL and libevent without adding all of their include and library paths, so
they did not build when either is outside the default search path, as with
Homebrew. lib/cpp already adds them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Client: cpp
Boost.System is header-only since 1.69, and 1.89 stopped shipping the stub
library, so the C++ tests and the cross-test client and server failed to link
against current Boost. configure still links it where it exists, for Boost 1.56 to
1.68, and test/cpp now uses the same variable instead of -lboost_system.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Client: cpp,java,kotlin,nodejs,py,rb,rs
The SSL cross tests against a Python server have failed since the server side
validation callback became a real check on Python 3.12 and later.
TSSLServerSocket matches a client certificate against the address the
connection arrived from, and test/keys/client.crt carries no subjectAltName,
so every *-ip-ssl case with a Python server fails: py-py, py-cpp, py-rb,
py-rs, py-nodejs and py-kotlin.
test/keys/client_v3.crt exists for exactly this case. It carries 127.0.0.1,
::1, ::ffff:127.0.0.1 and localhost, which covers every peer address the
servers actually see.
Presenting it is not enough on its own. Every certificate under test/keys
carries the same distinguished name and none carries an authority key
identifier, so OpenSSL treats each one as self-signed and never chains it to
CA.pem. A certificate is accepted only when the verifying side holds that
exact certificate, and a store keeps only one certificate per distinguished
name, so client.crt and client_v3.crt cannot both be trusted at once and the
servers have to move over together with the clients.
test/py/TestServer.py and test/rb/integration/TestServer.rb therefore trust
client_v3.crt, and every client that presents a certificate to them sends it:
Python, Ruby, Rust and Node.js were already changed, C++ follows here, and Java
and Kotlin through .clientkeystore, regenerated from client_v3 with the
algorithms that were already in it. Go sends no client certificate at all and
is unaffected; the Ruby server accepts that because it verifies without
VERIFY_FAIL_IF_NO_PEER_CERT.
client.crt is left unchanged so the Python unit tests keep exercising the
rejection path, where it is CLIENT_CERT_NO_IP.
Verified by running test/py/TestServer.py against test/py/TestClient.py over
binary/buffered/--ssl in three configurations: client.crt against the old store
fails on the address check, client_v3.crt against the old store fails with
unknown ca, and client_v3.crt against the new store passes. The Ruby context
was exercised the same way against both certificates, and the regenerated
keystore was read back with keytool.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adjust what "make dist" ships in the release tarball.
Dropped (build output and generated code that a built tree leaves behind,
swept in via whole-directory EXTRA_DIST entries and pruned in dist-hook;
none of it is tracked, so a clean checkout never contained it):
- lib/haxe/test/{bin,gen-haxe}, lib/javame/gen-javame
- lib/netstd bin/obj/gen-netstd across the test and benchmark projects
- test/netstd/{Client,Server}/ThriftTest
- tutorial/netstd/Interfaces/{shared,tutorial} (tracked project
scaffolding is kept so the tutorial still builds from the tarball)
- test/cpp/gen-cpp* (nodist generated sources)
- build/__pycache__ and stray *.pyc
Also no longer shipped: the .github/ CI configuration and
doc/thrift-threat-model.md.
Added (tracked sources that were missing from EXTRA_DIST):
- lib/lua/test/{RecursionDepth.thrift,test_recursion_depth.lua}
- lib/netstd/Tests/codegen/run-NetStd-Codegen-Tests.ps1
- test/JsRecursionDepthTest.thrift
- lib/php/{phpstan.neon,phpstan-baseline.neon}
- SECURITY.md
Verified end-to-end with make dist in a clean container: 4317 -> 3480
tarball entries, and the only tracked files removed are .github/* and
doc/thrift-threat-model.md.
Client: netstd,haxe,javame,lua,php,cpp
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- It is only used in THeaderTransport.cpp so move it there without compicating it
- It throws a TTransportException so it should not be used in other code
- People that depends on this can use boost::numeric_cast or std::in_range instead
- The usage in the unit test was not needed since std::string::size() returns an unsigned long on 64 compilers
Adds `forward_setter` value to `moveable_types` option, generating perfect forwarding setters for complex types while preserving traditional setters for primitives. Also fixes missing `operator<` implementation that caused link errors when structs are used as map keys.
**Forward Setter Generation** (`compiler/cpp/src/thrift/generate/t_cpp_generator.cc`):
- Parse `moveable_types=forward_setter` option
- Complex types (strings, containers, structs) → template setters with `std::forward<T_>`
- Primitive types → traditional const-ref setters
- Template implementations in `.tcc` file (auto-included in header)
- Legacy `moveable_types` behavior unchanged
**Compiler Unit Tests** (`compiler/cpp/tests/cpp/`):
- New `test_forward_setter.thrift` fixture
- Dedicated `t_cpp_generator_forward_setter_tests.cc` (91 assertions, 9 test cases)
- Verify `.tcc` generation and template implementations
**Integration Tests** (`test/cpp/src/`):
- `ForwardSetterTest.cpp` - validates lvalue/rvalue/temporary/literal setters with move semantics
- `PrivateOptionalTest.cpp` - SFINAE + static_assert verify optional fields are private
- `EnumClassTest.cpp` - type_traits + static_assert verify true enum class semantics
**CMakeLists.txt** (`test/cpp/`):
- Separate gen-cpp-{forward,private,enumclass} directories
**Makefile.am** (`test/cpp/`):
- Library targets for each option variant
- Proper `BUILT_SOURCES` dependencies
- Include path ordering: option-specific directory before standard `gen-cpp`
```cpp
// Generated with --gen cpp:moveable_types=forward_setter
struct TestStruct {
int32_t primitive_field;
std::string complex_field;
void __set_primitive_field(const int32_t val); // Traditional
template <typename T_>
void __set_complex_field(T_&& val); // Perfect forwarding
};
// In .tcc file:
template <typename T_>
void TestStruct::__set_complex_field(T_&& val) {
this->complex_field = ::std::forward<T_>(val);
__isset.complex_field = true;
}
```
- [ ] Did you create an [Apache Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket? ([Request account here](https://selfserve.apache.org/jira-account.html), not required for trivial changes)
- [ ] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
- [x] Did you squash your changes to a single commit? (not required, but preferred)
- [x] Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: zsy056 <1074382+zsy056@users.noreply.github.com>
- Add pyproject.toml with setuptools build requirement for PEP 517 compliance
- Replace distutils imports with setuptools equivalents
- Use setuptools error names directly (CompileError, ExecError, PlatformError)
- Fix macOS header collision with ntohll/htonll macros in endian.h
- Add a matrix of MacOS versions (macos-15-intel, macos-14, macos-15,
macos-26)
- Add a matrix of non-EOL Python versions for testing
- Remove MSVC2015 from the test matrix (very old).
- Support MSVC2022, the latest in AppVeyor.
- Upgrade tornado, twisted, and zope.interface versions to the first
that support Python 3.12.
- Try to make the test_socket, RunClientServer, and TestServer tests less flaky.
This fixes the ModuleNotFoundError: No module named 'distutils' error
when building thrift with Python 3.12+.
- Remove usage of v0.16 thrift files for C++ since UUID support was added
- Need to install the locals for some of the unit tests
- Fix UUID support for THeaderProtocol
- Without this the protocol went into an infinite loop due to virtual function calls that recursed to itself
- Best case was a crash, worst case was process got stuck
- Fix UUID support for TProtocolTap
- Sorted the known failures
- Mark cpp and java ssl tests as known failures
Trivially change file mode from 755 to 644 for files in git that
shouldn't be marked as executable. These were probably marked as
executable due to some contributors developing on Windows using a
filesystem that doesn't support POSIX file modes, or aggressively marks
everything as executable.
* make use of C++11 override keyword
* added const specifier to TTransport::getOrigin()
* added more const correctness to the compiler
* make use of auto keyword
* replaced usage of NULL with nullptr
* make use of explicitly-defaulted function definition
* extended changelog
add multiplex client test support to csharp and java languages
fix a bug in the server-side header protocol factory
fix a bug in the cpp SSL server socket implementation
remove unnecessary sleep in cpp server testOneway
This closes#1414
The thrift build system currently assumes that the thrift compiler is
always available in $(top_builddir)/compiler/cpp/thrift. However, in a
cross-compilation context, this location contains the thrift compiler
built for the target... which obviously will not run on the build
machine.
In order to support such cross-compilation situation, we introduce the
THRIFT variable as a an argument for the configure script (using
AC_ARG_VAR). If not specified, it defaults to the existing value of
using compiler/cpp/thrift from the build directory, but it can be
overridden when calling ./configure.
Note that $(top_builddir) cannot be used within the configure script,
so we simply use `pwd`, which is the same as the top_builddir.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This closes#1336
This closes#1350