189 Commits
Author SHA1 Message Date
Sylwester LachiewiczandClaude Opus 5.5 186e1c9a74 THRIFT-6378: Pass the OpenSSL and libevent paths to the C++ library tests
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>
2026-10-19 09:06:50 +02:00
Sylwester LachiewiczandClaude Opus 5.5 19bb4835a6 THRIFT-6379: Link libboost_system only when Boost ships it
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>
2026-10-14 01:49:26 +02:00
Jens GeyerandClaude Opus 5 715f46c2ed Use the client certificate with subjectAltNames in the SSL cross-test clients
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>
2026-09-09 02:05:53 +02:00
Dmytro ShteflyukandOpenAI Codex b3fa3eef57 Enable C++ TLS cross-tests
Client: cpp

Co-Authored-By: OpenAI Codex (GPT-5.4) <codex@openai.com>
2026-07-12 09:18:33 -04:00
Jens GeyerandClaude Opus 4.8 6d2ec95f45 Tune make dist: drop generated/build artifacts, add missing sources
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>
2026-07-05 22:04:17 +02:00
Shaoyu ZhangandCopilot ab9b2a96b9 Preserve private_optional field order
Client: cpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Scope reorder diagnostics to C++ tests

Client: cpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-27 23:03:41 +02:00
Carel Combrink 8970c235f1 Remove another boost header from the public API
- 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
2026-05-01 09:11:25 -04:00
Copilotandzsy056 13cdb44418 Add test coverage for private_optional + template_streamop combined; fix generator bugs (#14)
* Add test coverage for private_optional + template_streamop combined, fix generator bugs


Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: zsy056 <1074382+zsy056@users.noreply.github.com>
2026-03-25 22:13:26 +01:00
copilot-swe-agent[bot] c3cdacf1be cpp: add template_streamop generation with runtime/compiler test coverage
Add template_streamop support in the C++ generator so generated operator<< and printTo can target generic stream-like output types.
Keep default behavior unchanged when the option is not set (std::ostream signatures remain).
Add compiler/runtime coverage for template generation, friend declaration correctness, enums, and collection printing.

default:
```cpp
std::ostream& operator<<(std::ostream& out, const SimpleStruct& obj);

class SimpleStruct {
public:
  void printTo(std::ostream& out) const;
};
```

with `template_streamop`:
```cpp
template <typename OStream_>
OStream_& operator<<(OStream_& out, const SimpleStruct& obj);

class SimpleStruct {
public:
  template <typename OStream_>
  void printTo(OStream_& out) const;
};
```
2026-02-20 00:15:44 +01:00
Copilotandzsy056 1e09a046e0 Add moveable_types=forward_setter option for perfect forwarding setters
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>
2026-02-08 22:09:37 +01:00
Gregg Donovan 62ec929629 Fix Python 3.12 build issues in thrift Python (#3276)
- 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+.
2026-01-29 13:51:37 -08:00
Federico Giovanardi 3b21bc9fb4 Support socket activation by fd passing
Client: cpp
Patch: Federico Giovanardi

This closes #3211
2025-10-24 00:55:30 +02:00
Carel Combrink fbe685aae1 Add cpp cross tests to the build workflow
- 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
2025-08-28 00:36:39 +02:00
Carel Combrink aee3f637be THRIFT-5817: [C++] Avoid copy of TUuid
Client: cpp
Patch: Carel Combrink

This closes #3038
2025-03-05 22:12:50 +01:00
CJCombrink 4b90909ddd THRIFT-5773 Strong UUID wrapper for C++
Client: cpp/CMakeLists.txt
Patch: Carel Combrink

This closes #2958
2024-06-17 22:26:56 +02:00
CJCombrink 4a280d56cc THRIFT-5766 Replace std::endl with "\n"
Patch: Carel Combrink

This closes #2943
2024-04-15 22:37:44 +02:00
CJCombrink 1d886ca4af THRIFT-5772: UUID support for c++ #2952
Client: cpp
Patch: CJCombrink

This closes #2952
2024-04-07 22:41:58 +02:00
Thomas 63f04583e3 Manually remove $(BUILT_SOURCES) since no-dist-built-sources doesnt work 2024-04-02 14:09:27 +02:00
Jens Geyer f066d84ffb Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
Christopher Tubbs 4646a3557b Remove execute bit from plain text files in git (#2611)
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.
2022-05-24 05:19:41 -04:00
Mario Emmenlauer bdb54bc1c9 Use modern OpenSSL cmake syntax (if available), and larger cmake cleanup 2021-09-02 08:54:42 +02:00
Mario Emmenlauer 7553fc5d52 CMake: Pass linker dependencies transitively to downstream projects 2021-02-12 11:10:15 +01:00
penenin 1ab096c80a THRIFT-5185: Support for using WebSockets as a server transport
Client: cpp
2020-05-18 20:27:31 +01:00
Zezeng Wang 371d92f159 THRIFT-5179: Fix generated code for struct's named "a" or "b"
Client: cpp
2020-04-28 07:23:15 +01:00
Mario Emmenlauer 2d2df9e892 Allow wrapping TTransportFactory into a TZlibTransportFactory
Client: cpp
2020-04-24 17:02:18 +01:00
Mario Emmenlauer 802793638b THRIFT-4282: Disabled StressTestNonBlocking on Windows 2020-04-24 07:51:37 +01:00
zeshuai007 57c2507208 THRIFT-5168 Useless generated code when .thrift file only has service type
Client: cpp
Patch: zeshuai007 <51382517@qq.com>

This closes #2095
2020-04-21 23:29:14 +02:00
Kevin Wojniak a392566e9b THRIFT-4896 - prevent cpp and c_glib include directories from leaking into other targets (#1821)
- enable the automake `nostdinc` option
- fix up include paths
2019-07-01 14:07:45 -04:00
James E. King III 4c57be0b60 THRIFT-4384: fix concurrent sync in cpp async client code 2019-02-02 22:10:41 -05:00
James E. King III 3ec4031a4c THRIFT-4405: fix cygwin on appveyor 2019-02-01 11:13:49 -05:00
James E. King III 53bd0e6295 THRIFT-4745: fixes compiler warnings 2019-02-01 11:13:49 -05:00
James E. King III f95620d2b1 THRIFT-4405: sanity tests relating to sequence numbers
- prove all servers return the sequence ID given
- prove that sequences that wrap around the int32_t space are handled ok
2019-02-01 11:13:49 -05:00
Sebastian Zenker 042580f534 THRIFT-4762: Applied some C++11 refactorings to the runtime library and compiler (#1719)
* 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
2019-01-29 09:48:12 -05:00
James E. King III b96c43892a THRIFT-4717: fix up make clean with autoconf 2019-01-25 23:33:54 -05:00
cyy bfdbd0344b use chrono 2019-01-22 10:36:18 +08:00
cyy ca8af9b48f THRIFT-4730: remove pthread code and refactor, ending up with just ThreadFactory 2019-01-11 09:13:12 -05:00
James E. King III c9ac8d2953 THRIFT-4720: documenting breaking changes, minor cleanup 2019-01-09 17:05:34 -05:00
cyy 316723add4 remove stdcxx namespace and use std directly 2019-01-07 08:11:37 -05:00
James E. King III 9b75e4fe74 THRIFT-4680: fix up std::min, std::max, and numeric limits min/max on Windows; remove NOMINMAX from cmake build 2018-12-18 10:17:57 -05:00
James E. King III b2b767e1a4 THRIFT-4620: add crosstest support for zlib (buffered) to cpp, enable cpp,go,py,py3 tests 2018-09-16 06:51:38 -04:00
James E. King III f5f430df56 THRIFT-4579: Move up to Ubuntu Bionic for CI builds
make dlang library compatible with openssl-1.1 for Ubuntu Bionic
Requires an upstream deimos update to be compatible.
2018-06-16 19:16:04 +00:00
James E. King III 9bea32f73c THRIFT-4515: cross server test improvement: graceful test server shutdown
This closes #1509
2018-03-19 14:38:49 -04:00
James E. King III 3ae304268e THRIFT-4515: fix windows build
Client: cpp
2018-03-12 11:30:22 -04:00
James E. King III 70b33fb6b4 THRIFT-4515: fix up nonblocking options and enable ssl for nonblocking in cpp server cross
Client: cpp
2018-03-11 10:57:56 -04:00
James E. King, III 39eaae6675 THRIFT-2013: update docker for artful (go back to lua 5.2) and enhance
cpp client to send 0,1,2,4,8,...,131072 size binary tests, this exposed
problems in the erl and rs servers and those tests have been disabled for now.
2017-11-20 07:27:03 -05:00
James E. King, III 58402ff6a7 THRIFT-2013: add multiplex server and client test support to cpp language
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
2017-11-18 21:10:40 -05:00
Thomas Petazzoni 1744cdcb67 configure.ac, Makefile.am: introduce THRIFT variable to support cross-compilation
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
2017-09-09 07:50:54 -07:00
James E. King, III d7142b7e4f THRIFT-4295: rework the docker build images, updating them and tuning the travis builds
This closes #1340
2017-09-04 18:09:34 -07:00
James E. King, III 82ae9575cd THRIFT-2221: detect C++11 and use std namespace for memory operations (smart_ptr)
Client: C++

This closes #1328
2017-08-10 13:27:21 -04:00
Divya Thaluru 808d143245 THRIFT-4276:Add SSL support to the C++ Nonblocking Server
Client: C++ Lib
Patch: Divya Thaluru

Github Pull Request:

    This closes #1251
2017-08-06 16:36:36 -07:00