6531 Commits

Author SHA1 Message Date
Charles Kerr
41e8279a73 refactor: add LocalData facade (#8743)
* refactor: add LocalData facade

* fixup! refactor: add LocalData facade

chore: add using namespace std::literals

* fix: narrowing conversion errors on win32

* build: add local-data.cc, .h to pbxproj

* refactor: use tr_error_code_t

* fix: clang-tidy warnings

* chore: silence clang-tidy warnings

* chore: fix hicpp-named-parameter
2026-03-31 09:13:45 -05:00
Charles Kerr
6b24c1c214 fix: add clickjack safeguards when serving http responses (#8747) 2026-03-30 23:17:13 -05:00
Yat Ho
1445d7dd27 refactor: TCP segment payloads at least 128 bytes (#8745) 2026-03-30 20:33:54 -05:00
Yat Ho
8a636aee21 fix(core): bugprone-narrowing-conversions (#8714) 2026-03-29 21:41:10 -05:00
Charles Kerr
445302855d refactor: async file IO prep (#8740)
* refactor: make TrBlockSize a constant

* refactor: add tr_byte_span::is_valid()

refactor: add tr_byte_span::size()

* refactor: add tr_block_info::byte_span_for_block()

refactor: add tr_block_info::byte_span_for_req()

* refactor: tr_ioRead(), tr_ioWrite() take an open_files arg

* refactor: use std::span for open-files fallback writes
2026-03-29 21:31:12 -05:00
Yat Ho
980cd07722 fix: reject values outside of uint16_t range in port settings (#8730) 2026-03-29 19:34:59 -05:00
Yat Ho
98e94795c9 fix: bugprone-narrowing-conversions surrounding tr_session_stats::uploadedBytes (#8725) 2026-03-29 14:01:13 -05:00
Yat Ho
c8d6bebf6d fix: use static_cast to cast from void pointers (#8724) 2026-03-29 14:00:49 -05:00
Yat Ho
51c3dc45b8 refactor: use range-checked value_if to serialize/deserialize integer types (#8727) 2026-03-25 10:15:32 -05:00
Yat Ho
566d3d96ef refactor: fixes and preventive measures against strict aliasing violations (#8695)
* fix: strict aliasing violations in net.h

* refactor: restrict value_type for buffers

* chore: housekeeping
2026-03-23 09:33:37 -05:00
Leopoldo Pla Sempere
22bb8a0838 daemon: avoid periodic idle stats.json rewrites (#8679) 2026-03-23 09:19:44 -05:00
Eduardo Fernandes
879954d893 Fix #8111: reject trailing garbage in RPC URL (#8711)
The RPC server accepted any URL starting with /transmission/rpc,
including /transmission/rpc/xyz and /transmission/rpcx. Changed
the prefix check (tr_strv_starts_with) to an exact match so that
only /transmission/rpc is accepted.
2026-03-23 09:15:36 -05:00
Yat Ho
dba3e8f9d3 fix: bugprone-narrowing-conversions surrounding error codes (#8716) 2026-03-23 09:12:38 -05:00
Yat Ho
7b92be7a52 fix: handle peer ReqQ smaller than floor (#8689) 2026-03-19 18:07:30 -05:00
Yat Ho
f138e2644c perf(wishlist): ditch PImpl and make methods constexpr (#8694) 2026-03-19 18:02:43 -05:00
Yat Ho
9387db8e3e docs: document the global ip cache behaviour in quirky networking environments (#8696) 2026-03-19 18:01:27 -05:00
Charles Kerr
849cd0ecea refactor: remove write cache (#8669)
* refactor: mark cache_size_mib as deprecated in RPC

* refactor: make RPC session_set cache_size_mib a no-op

* refactor: tr_ioRead(), tr_ioWrite() now take a std::span

* refactor: add BufferReader::to_buf(std::span<uint8_t>)

* refactor: migrate some methods to to_buf(std::span<uint8_t>)

* refactor: remove the write memory cache

* chore: simplify recalculate_hash()

* refactor: simplify span use in tr_peerMsgsImpl::read_piece_data()
2026-03-11 07:16:39 -05:00
Yat Ho
a483792783 feat: configurable ip query endpoint (#8650)
* feat: configurable ip query endpoint

* fix(test): don't query global IP
2026-03-10 11:36:10 -05:00
Yat Ho
8dfce3c90c perf: constexpr tr_variant::value_if() specialisations (#8670)
* refactor: move `tr_variant::value_if<int64_t>()` to header and constexpr

* refactor: move `tr_variant::value_if<bool>()` to header and constexpr

* refactor: move `tr_variant::value_if<std::string_view>()` to header and constexpr
2026-03-10 08:48:24 -05:00
Yat Ho
a3545eb9c2 feat: bound-checked tr_variant::value_if() for smaller integer types (#8660)
* feat: bound-checked `tr_variant::value_if()` for smaller integer types

* feat(rpc): ignore values outside the `tr_torrent_id_t` range
2026-03-09 19:35:08 -05:00
Charles Kerr
a84c769f94 refactor: remove unused tr_ctorSetFilePriorities() (#8667)
refactor: remove unused tr_ctorSetFilesWanted()
2026-03-09 17:01:03 -05:00
Charles Kerr
974b16e71c refactor: remove tr_torrentsQueueMoveTop() from public API (#8666)
* refactor: remove tr_torrentsQueueMoveTop() from public API

refactor: remove tr_torrentsQueueMoveUp() from public API

refactor: remove tr_torrentsQueueMoveDown() from public API

refactor: remove tr_torrentsQueueMoveBottom() from public API

* refactor: remove unused tr_torrentGetQueuePosition()
2026-03-09 17:00:42 -05:00
Yat Ho
5c6b6db42c fix: modernize-use-integer-sign-comparison (#8662) 2026-03-09 09:58:51 -05:00
Yat Ho
282f085e30 refactor: move tr_pex/tr_variant converters to serializer.cc (#8655) 2026-03-08 12:22:30 -05:00
Yat Ho
eac99ff1a0 fix: readability-container-contains (#8656)
* fix(core): `readability-container-contains`

* fix(test): `readability-container-contains`

* build(gtk): enable `readability-container-contains`

* fix(qt): `readability-container-contains`
2026-03-05 10:00:29 -06:00
Yat Ho
b40adc411e fix: don't overwrite *_enabled if preferred_transports is not in settings.json (#8657) 2026-03-05 08:47:51 -06:00
reardonia
cee65c7606 security: sanitise CTRL characters in filenames on all systems (#8495)
* disallow CTRL characters in filenames on Unixen

* fixup: compact into is_reserved_char()
2026-03-04 18:08:38 -06:00
Yat Ho
4eaf91fda5 refactor: compare_failed spaceship (#8634) 2026-03-04 16:04:10 -06:00
Yat Ho
59abf6e1db fix: re-create candidate when got bad block if needed (#8644)
* refactor: use the same salter everywhere

* fix: re-create candidate when got bad block if needed

* refactor: housekeeping

* fix: emit bad piece signal after all bookkeeping
2026-03-04 15:59:21 -06:00
Charles Kerr
5e305a2d26 refactor: simplify session callbacks (#8646)
* refactor: add a Torrent.id property

* feat: add Controller.torrentForId

* refactor: make tr_session_idle_limit_hit_func a std::function

* refactor: make tr_session_metadata_func a std::function

* refactor: make tr_session_ratio_limit_hit_func a std::function

* refactor: make tr_torrent_completeness_func a std::function

* refactor: make tr_altSpeedFunc a std::function

* refactor: make tr_sessionSetQueueStartCallback callback a std::function

* refactor: make tr_rpc_callback_status callback a std::function

* refactor: remove user_data arg from tr_torrent_rename_done_func

* refactor: harden `tr_torrentFindFromId()` by making it safe to pass in a nullptr session
2026-03-03 16:02:54 -06:00
Yat Ho
7d3b22639d fix: don't process failed HTTP announce response if one the same group succeeded (#8631) 2026-03-01 21:16:20 -06:00
Yat Ho
b561960d51 fix: enable modernize-use-ranges (#8626)
* fix(core): enable `modernize-use-ranges`

* fix(test): enable `modernize-use-ranges`

* fix(qt): enable `modernize-use-ranges`

* fix(gtk): enable `modernize-use-ranges`
2026-02-26 08:22:29 -06:00
Charles Kerr
152e528d9b perf: add a constexpr/consteval tr5/legacy key lookup table (#8625)
* perf: add a constexpr/consteval tr5/legacy key lookup table

* fix: readability-use-anyofallof
2026-02-25 22:18:50 -06:00
Yat Ho
d56a8e80c3 refactor: use char8_t as underlying type of tr_interned_string (#8556) 2026-02-25 09:07:01 -06:00
Yat Ho
fe879f5817 fix: revert percent-encoding announce urls and webseeds (#8620) 2026-02-25 08:48:34 -06:00
Yat Ho
4e26df6671 fix: modernize-use-ranges in peer-*.cc (#8599) 2026-02-24 07:48:36 -06:00
Yat Ho
fa2dfe11b1 fix: reset metainfo before parsing new benc (#8590) 2026-02-23 09:07:26 -06:00
Yat Ho
33b2388a43 fix: modernize-use-ranges in peer-mgr-wishlist.cc (#8594) 2026-02-22 22:45:03 -06:00
Yat Ho
f89242c855 fix: enable modernize-loop-convert (#8579) 2026-02-21 09:06:59 -06:00
Yat Ho
ece1d7b6c2 fix: fail when encountering invalid benc character. (#8573)
* fix: fail when encountering invalid benc character

* fix(test): wrong `pieces` length in test string

* test: more benc test cases
2026-02-19 13:53:01 -06:00
Yat Ho
d18f48dae9 fix: respect umask when creating directories (#8574) 2026-02-19 11:14:24 -06:00
Charles Kerr
aa8039cfb5 refactor: safeguard against nullptr tr_torrent* args in tr_torrentFoo() methods (#8550)
* refactor: safeguard against nullptr `tr_torrent*` args in `tr_torrentFoo()` methods (#8504)

* feat: safeguard tr_torrentFoo() calls against nullptr torrents

* refactor: tr_log_if_fail(tr_isTorrent(tor))

* test: add tests for invalid args to torrent C API

* fix: cppcoreguidelines-pro-type-member-init

* fix: readability-simplify-boolean-expr
2026-02-17 17:58:34 -06:00
Yat Ho
fc309238ce ci(gtk): run clang-tidy (#8251)
* ci: infra for parallel clang-tidy runs

* ci(gtk): run clang-tidy

* chore(gtk): silence warnings

* code review: use constexpr auto

* code review: use constants over magic numbers in Utils.cc

* code review: use `std::ignore` to ignore return value

* code review: add back visibility labels that indicated sections

* fix: wrap each command argument in single quotes
2026-02-17 17:53:01 -06:00
Yat Ho
6c92d06854 refactor: store dynamic quarks as char8_t (#8546) 2026-02-17 13:26:28 -06:00
Yat Ho
e44b261f92 refactor: store static quarks as char8_t (#8532) 2026-02-17 00:41:17 -06:00
reardonia
31047493f5 UTF8-clean torrent 'path' (#8328)
* fix: mask non-UTF-8 characters in torrent file paths

BEP-3 requires strings to be UTF-8. Run path components through
tr_strv_to_utf8_string() to replace invalid bytes with U+FFFD
before sanitizing. Adds test with good and bad UTF-8 paths.

* replace ctrl characters in 'name' and 'path'

* Revert "replace ctrl characters in 'name' and 'path'"

This reverts commit 6816f59295.

* fix: mask non-UTF-8 characters in torrent file paths

BEP-3 requires strings to be UTF-8. Run path components through
tr_strv_to_utf8_string() to replace invalid bytes with U+FFFD
before sanitizing. Adds test with good and bad UTF-8 paths.

* replace ctrl characters in 'name' and 'path'

* Revert "replace ctrl characters in 'name' and 'path'"

This reverts commit 6816f59295.

* prepare for future Bittorrent v2 usage
2026-02-16 08:49:20 -06:00
Charles Kerr
40ae72888c fix: potential fd leak when running scripts (#8524) 2026-02-15 23:06:49 -06:00
Charles Kerr
1e33e950b2 fix: limit the number of simultaneous connections libcurl can have (#8525) 2026-02-15 23:06:28 -06:00
Charles Kerr
a9068d73ad refactor: use spaceship operator in tr::Values (#8518) 2026-02-15 23:06:02 -06:00
Yat Ho
1e14cc605b refactor: migrate to Madler's crc32c (#8475) 2026-02-15 15:16:01 -06:00