1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-25 23:42:30 +00:00
Commit graph

351 commits

Author SHA1 Message Date
Charles Kerr
83ffa6bf1b
chore: fix spdx abbreviations () 2022-08-08 13:05:39 -05:00
Charles Kerr
31a733fab7
refactor: make tr_session_id a class () 2022-08-06 14:27:37 -05:00
Charles Kerr
868fc1ab78
Refactor/tr variant from buf ()
* refactor: use std::string in tr_watchdir_inotify_on_event()

* refactor: add template tr_variantFromBuf() variant

if it has .data() and .size() it is good
2022-08-05 16:12:45 -05:00
Charles Kerr
4bc1589c5d
refactor: remove tr_win32_utf8_to_native_ex() () 2022-08-05 14:16:25 -05:00
Charles Kerr
8b983b3d1c
refactor: tr_sys_path_resolve() returns a std::string ()
* refactor: tr_sys_path_resolve returns std::string
2022-08-05 11:36:01 -05:00
Charles Kerr
3ed6b187bb
refactor: iwyu utils.h () 2022-08-04 08:44:18 -05:00
Charles Kerr
4f6909a27a
refactor: tr_sys_dir_get_current() returns a std::string () 2022-08-03 23:59:41 -05:00
Charles Kerr
ef34c7c4dc
refactor: use std::wstring on win32 () 2022-08-03 18:07:38 -05:00
Charles Kerr
bf8f72e61f
refactor: tr_metainfo_builder() () 2022-08-02 14:46:08 -05:00
Charles Kerr
5eb7f75010
refactor: tr_sys_path_get_info() now returns a tr_sys_path_info ()
* refactor: tr_sys_path_get_info() now returns a tr_sys_path_info

* refactor: tr_sys_file_get_info() now returns a tr_sys_path_info
2022-08-02 12:41:04 -05:00
Charles Kerr
18e2a04f88
refactor: make sha1, sha256 RAII safe () 2022-07-31 15:58:14 -05:00
Charles Kerr
e0ca366b2d
refactor: remove tr_loadFile() ()
* refactor: use the std::vector variant of tr_loadFile() in rpc-server.cc

* refactor: use the std::vector variant of tr_loadFile() in rename-test.cc

* refactor: remove the unused raw ptr variant of tr_loadFile()
2022-07-28 14:22:32 -05:00
Charles Kerr
15056045bd
perf: batch up calls to the RNG () 2022-07-28 10:01:59 -05:00
Charles Kerr
ec79a2a888
fix: clang-tidy misc-const-correctness warnings () 2022-07-27 09:03:13 -05:00
Charles Kerr
0e7ef51d5c
refactor: tr_env_get_string() now returns a std::string () 2022-07-26 23:26:37 -05:00
Charles Kerr
1a0afbe95e
refactor: iwyu () 2022-07-25 21:45:54 -05:00
Charles Kerr
d09aba0e6a
refactor: remove tr_address_from_string() ()
use tr_address::fromString() instead

* refactor: use tr_address.isIPv4()
2022-07-25 17:25:55 -05:00
Mike Gelfand
4a18c503c7
Don't call front() on an empty string () 2022-07-25 00:01:42 +01:00
Charles Kerr
4f7051fe7f
refactor: make tr_session's directory fields private () 2022-07-23 02:13:18 -05:00
Charles Kerr
47fe7c47d2
refactor: replace per-torrent callbacks with per-session ones. () 2022-07-23 01:04:34 -05:00
Charles Kerr
445aad56a0
test: add platform tests ()
* test: add tr_getDefaultDownloadDir() tests

this also indirectly tests xdg and homedir

* test: add PlatformTest.defaultConfigDirEnv

* test: add PlatformTest.defaultConfigDirXdgConfig

test: add PlatformTest.defaultConfigDirXdgConfigHome

* test: add PlatformTest.webClientDirEnvClutch

test: add PlatformTest.webClientDirEnvTr

test: add PlatformTest.webClientDirXdgDataHome

* fixup! test: add PlatformTest.webClientDirEnvClutch

fix: win32 breakage
2022-07-22 20:10:02 -05:00
Charles Kerr
9bf2918ad0
refactor: remove tr_strvPath() () 2022-07-22 13:07:23 -05:00
Charles Kerr
0da1cbb6ec
fix: 3508 location invalidation ()
* Revert "refactor: remove tr_sessionGetConfigDir() ()"

This reverts commit c50da43ae0.

* Revert "fix: do not leak in tr_getWebClientDir() ()"

This reverts commit 5a75e37033.
2022-07-22 00:52:48 -05:00
Charles Kerr
c50da43ae0
refactor: remove tr_sessionGetConfigDir() ()
* refactor: remove tr_sessionGetConfigDir() from GTK client

* refactor: remove tr_sessionGetConfigDir() from daemon

* refactor: remove tr_sessionGetConfigDir()

* refactor: remove tr_getTorrentDir()

* fixup! refactor: remove tr_sessionGetConfigDir()
2022-07-21 20:12:45 -05:00
David Miguel Susano Pinto
f8b3514c0e
tr_makeMetaInfo: new anonymize option (closes ) () 2022-07-19 16:48:24 -05:00
Charles Kerr
41c0f8885e
fix: limit pad search during encrypted handshake () 2022-07-18 13:00:26 -05:00
Charles Kerr
fe91f04351
test: add plaintext & encrypted handshake tests () 2022-07-16 15:25:44 -05:00
Charles Kerr
2bcab6be7e
refactor: remove tr_dh code ()
Refactor the MSE handshake Diffie-Hellman key code.
2022-07-14 19:54:10 -05:00
Colin B
c3db52e310
Fix , support single file hybrid torrents. () 2022-07-14 13:53:00 -05:00
Charles Kerr
0a39cb9302
refactor: migrate tr_crypto C functions to members () 2022-07-10 21:57:05 -05:00
Charles Kerr
71bc7143b8
Revert "refactor: tr_address cleanup ()" ()
This reverts commit 9a44eeaa27.
2022-07-09 18:44:20 -05:00
Charles Kerr
9a44eeaa27
refactor: tr_address cleanup ()
* refactor: remove tr_address_compare()

* refactor: remove tr_address_to_string()

* refactor: remove NUM_TR_AF_INET_TYPES

* refactor: replace tr_sessionGetPublicAddress with tr_session::getPublicAddress()

* refactor: tr_peerIo() takes tr_address by value

* refactor: replace tr_sessionIsAddressBlocked with tr_session::isAddressBlocked()

* refactor: tr_peerMgrAddIncoming now takes tr_address by value

* refactor: replace tr_address_is_valid_for_peers() with tr_address.isValidForPeers()

* refactor: tr_netOpenPeerSocket takes tr_address by value

* refactor: remove tr_generateAllowedSet()

* refactor: setup_sockaddr takes a tr_address by value

* refactor: tr_netBindTCP() takes a tr_address by value

* refactor: tr_dhtAddNode() takes a tr_address by value

* refactor: remove tr_address_from_string()

* refactor: rename tr_address.isValidForPeers() to .isValidPeerAddress()

* refactor: replace tr_address_from_sockaddr_storage() with tr_address::fromSockaddrStorage()

* refactor: minor cleanup to tr_address::readable()
2022-07-08 13:23:41 -05:00
Charles Kerr
e9a7ddf7f9
fix: minor warnings ()
* fix: signed-unsigned comparison warning

* fix: readability-implicit-bool-conversion warning

* fix: signed-unsigned comparison warning
2022-07-05 18:32:30 -05:00
Charles Kerr
513f4bc91b
fix: assertion failed "s->leftUntilDone <= s->sizeWhenDone" () 2022-07-04 11:48:54 -05:00
Mike Gelfand
142b2a088d
Support wolfSSL 4.6+ ()
* Fix testing against reference crypto implementation

Build would fail on CI if using cyassl/wolfssl or polarssl/mbedtls as a
backend and testing it against reference openssl implementation due to
missing include directories, but only if bundled (non-system) b64 is
used.

* Iniitalize size arguments to `wc_DhGenerateKeyPair`

Despite it not being mentioned in the documentation [1] and v4.6 release
notes [2], the two size parameters became [3] not purely "out", but
"in/out", to avoid potential buffer overflows.

[1] https://www.wolfssl.com/documentation/manuals/wolfssl/group__Diffie-Hellman.html
[2] https://github.com/wolfSSL/wolfssl/releases/tag/v4.6.0-stable
[3] 4364700c01
2022-07-03 14:05:40 +01:00
Colin B
5e43731bcf
Ensure hybrid torrents are parsed correctly. () 2022-07-02 12:16:34 -05:00
Colin B
3237323b8e
Add basic support for v2 hashes in transmission-show ()
* Add basic support for v2 hashes in transmission-show

* Add sha256 for more libraries

* Fix issue with sha256 digest length
* Add sha256 for polarssl
    Note: Bumping miniumum PolarSSL version to 1.3 because of
    sha2->sha256 name change.
* Add sha256 for CommonCrypto/ccrypto
* Add sha256 for cyassl
2022-07-01 09:49:33 -05:00
Charles Kerr
85c11b7f03
fix: requests across piece boundaries when piece is not a multiple of block_size
Fixes .
2022-06-19 23:08:58 -05:00
Charles Kerr
25fdb5805c
refactor: use tr_torrent_id_t ()
* refactor: use semantic type tr_torrent_type_t in libtransmission

* refactor: use semantic type tr_torrent_type_t in gtk client

* refactor: use semantic type tr_torrent_type_t in qt client
2022-06-17 10:43:04 -05:00
Charles Kerr
34cb56b2af
refactor: remove unused tr_ptrArray class ()
* refactor: remove unused tr_ptrArray class

* fixup! build: add sanitizer CI runs when libtransmission-test changes ()
2022-06-11 21:45:00 -05:00
Dmytro Lytovchenko
d34bd0b4d6
refactor: modernize cache.cc ()
* Modernize cache.cc: Convert tr_cache to a class

* Modernize cache.cc: Replaced ptrArray with vector

* refactor: Cache now takes a tr_torrents reference

* refactor: add Key type to Cache

* refactor: avoid std::back_inserter

* refactor: add Cache::flushOldest()
2022-06-11 19:46:30 -05:00
Charles Kerr
256b436023
fix: clang 15 warnings ()
* fix modernize-macro-to-enum libtransmission warnings

* fix readability-simplify-boolean-expr libtransmission warnings

* fix bugprone-unchecked-optional-access libtransmission warnings
2022-06-01 11:56:59 -05:00
Charles Kerr
84d65d8e61
fix: coverity warnings ()
* fix: uninitialized peer_atom field

* fix: silence inaccurate open-files-test warning

* fix: assertion-is-always-true

asserting unsigned val is >= 0

* fix: unnecessary nullptr check

* fix: nullptr dereference warning
2022-05-31 18:58:20 -05:00
Charles Kerr
fe288b45e5
perf: do not use tr_variant when parsing .torrent files 2022-05-23 23:05:16 -05:00
Charles Kerr
19db28c04d
perf: faster detection of invalid filenames ()
* refactor: move file_info into tr_torrent_files

* chore: rename files-test as torrent-files-test.cc

* test: add tests for tr_torrent_files::isSubpathPortable()
2022-05-23 17:53:26 -05:00
Charles Kerr
67a078402d
fix: compiler warnings ()
* fix: unused function warning tr_rpc_address_is_valid

* fix: unused variable warning old_byte_pop

* fix: method-can-be-made-static warning assertValidRules

* fix: signed-unsigned comparison warning

* fix: invalid case style warning for KBps

* chore: disable warning for static class member varaible
2022-05-22 21:22:34 -05:00
Charles Kerr
c0bb2d40f1
refactor: add pathbuf and std::string-friendly helpers to tr_sys file and path funcs ()
* refactor: add sv-friendly tr_sys_dir_create() variant

* refactor: add sv-friendly tr_sys_path_get_info() variant

* refactor: add sv-friendly tr_sys_path_exists() variant

* refactor: add sv-friendly tr_sys_path_remove() variant

* refactor: add sv-friendly tr_sys_path_rename() variant

* fixup! refactor: add sv-friendly tr_sys_path_rename() variant
2022-05-21 20:17:00 -05:00
Charles Kerr
690cf50e53
perf: tr_sys_path_dirname() returns a std::string_view ()
* refactor: use nodejs impl of path.win32.dirname()

* refactor: use nodejs impl of path.posix.dirname()
2022-05-21 11:10:58 -05:00
Charles Kerr
a28b07b390
Revert "refactor: move tr_torrent callbacks to tr_session ()" ()
This reverts commit 27fbfd8da6.

Fixes .
2022-05-16 13:48:43 -05:00
Charles Kerr
27fbfd8da6
refactor: move tr_torrent callbacks to tr_session ()
* refactor: move tr_torrent callbacks to tr_session

* Support tr_sessionSet* ()

Co-authored-by: Antoine Cœur <coeur@gmx.fr>
2022-05-14 10:00:13 -05:00
Charles Kerr
5dbe1f4669
refactor: replace tr_fdlimit with tr_open_files () 2022-04-28 21:35:47 -05:00
Charles Kerr
5e769fbc55
refactor: make tr_recentHistory a template class ()
This gives more flexibility on the size of the count bins, so we can save space on smaller counts
2022-04-28 10:52:26 -05:00
Charles Kerr
32facb50d7
refactor: prefer tr_pathbuf over tr_strvPath() () 2022-04-22 11:35:56 -05:00
Charles Kerr
3643a8aee5
refactor: prefer std::vector as the default container () 2022-04-22 08:08:02 -05:00
Charles Kerr
41cb8cbc91
refactor: add tr_address.readable () 2022-04-21 18:37:02 -05:00
Charles Kerr
a52edbcbbe
refactor: remove tr_announce_list.tiers () 2022-04-21 15:48:30 -05:00
Antoine Cœur
bdac708762
docs: fix various typos and misspellings () 2022-04-21 09:28:38 -05:00
Charles Kerr
c1faebca6e
fix: new MSVC warning in file-piece-map-test.cc () 2022-04-16 23:36:05 -05:00
Charles Kerr
6cdc7e3828
refactor: remove tr_announce_list::tracker info.announce () 2022-04-16 15:41:51 -05:00
Charles Kerr
ef4fcf7ffd
refactor: remove tr_announce_list.tracker_info.scrape () 2022-04-16 14:14:18 -05:00
Charles Kerr
2f97655981
refactor: remove tr_url_parsed_t.portstr () 2022-04-16 13:13:42 -05:00
Charles Kerr
4a2a6b2985
test: use uniform naming scheme for fuzz tests. ()
Use case: libtransmission-test --gtest_filter='*Fuzz' --gtest_repeat N
2022-04-16 11:47:51 -05:00
Charles Kerr
2866638e1b
refactor: add tr_torrent_files::move() and remove() () 2022-04-15 18:39:04 -05:00
Charles Kerr
ec57d10954
refactor: tr_files::hasAnyLocalData() () 2022-04-13 21:41:06 -05:00
Charles Kerr
9f9f60f1e3
refactor: tr_block_info () 2022-04-13 20:22:59 -05:00
Charles Kerr
4a65956cc9
refactor: extract some file management into tr_files class () 2022-04-12 10:00:02 -05:00
Charles Kerr
205abbbcce
refactor: iwyu string, vector, cstdint ()
* refactor: use cstdint for intX_t types

* refactor: iwyu sstring_view

* refactor: iwyu <cstring>

* refactor: iwyu <vector>
2022-04-07 20:50:26 -05:00
Charles Kerr
b256da02e3
refactor: remove unused macros ()
* refactor: remove unused fu nction tr_lowerBound()

* refactor: tr_timerAdd() takes a reference, not a pointer

* refactor: tr_timerAddMsec() takes a reference, not a pointer

* refactor: tr_moveFile() takes a reference, not a pointer

* refactor: tr_wildmat() takes std::string_views

* refactor: remove unused macro TR_GNUC_NONNULL

* refactor: remove unused macro TR_GNUC_PRINTF

* refactor: remove unused macro TR_GNUC_NULL_TERMINATED

* refactor: remove unused macro TR_GNUC_HOT

* refactor: remove unused macro __has_feature

* refactor: remove unused macro __has_attribute

* refactor: remove unused macro TR_DEPRECATED

* refactor: remove unused macro TR_DISABLE_COPY_MOVE
2022-04-07 19:20:29 -05:00
Charles Kerr
31c65eec1f
refactor: remove tr_strvJoin() () 2022-04-07 17:26:59 -05:00
Charles Kerr
ffda5bb68a
refactor: remove tr_strip_positional_args() ()
* refactor: use fmt in gtk/SystemIconTray

* refactor: use fmt in gtk/MakeDialog

* refactor: remove unused tr_strip_positional_args()

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-04-07 08:23:04 -05:00
Charles Kerr
f79a75cb21
test: fuzz test tr_variantFromBuf() ()
* test: fuzz test tr_torrent_metainfo.parseBenc()

* fix: better error-checking in benc string parsing

* fix: return benc failure if the parse stack is unbalanced

* fix: stack range error when logging json parse errors

* test: fuzz test tr_variantFromBuf()
2022-04-06 16:39:39 -05:00
Charles Kerr
a134445caa
test: fuzz test tr_torrent_metainfo.parseBenc() ()
* test: fuzz test tr_urlParse()

* fix: stack error checking in benc parser

* test: fuzz test tr_torrent_metainfo.parseBenc()
2022-04-06 15:26:13 -05:00
Charles Kerr
e88ebbc3e5
test: fuzz test tr_magnet_metainfo.parseMagnet() () 2022-04-06 13:22:08 -05:00
Charles Kerr
eb33b2faf5
fix: tr_clientForId() ()
* fix: memory corruption when parsing negative numbers

* fix: stack-buffer-overflow on escape chars in tr_clientForId

* test: add tr_clientForId() fuzz tests
2022-04-06 12:06:11 -05:00
Charles Kerr
68bec3f8e3
refactor: remove tr_snprintf() () 2022-04-04 13:36:48 -05:00
Charles Kerr
1d7d17396f
refactor: remove tr_snprintf() pt 2 () 2022-04-03 13:23:00 -05:00
Charles Kerr
76f44b4b6f
fix: sonarcloud ()
* refactor: make this variable const

* refactor: replace redundant type with auto

* refactor: use the nullptr literal

* refactor: replace declaration by structured binding declaration
2022-04-02 17:42:51 -05:00
Charles Kerr
1cc9da26ba
fix: sonarcloud ()
* refactor: implement FileTreeItem::children_ with a std::vector

* fix: std::move should not be called on forwarding reference

* fix: uninitialized scalar variable

* fix: unchecked return value from library

* fix: dereference before null check

* fix: unchecked return value from library

* fix: unchecked return value from library

* fixup! refactor: implement FileTreeItem::children_ with a std::vector

* fix: signed-unsigned comparison in libtransmission tests

* fix: avoid unnecessary copy by using const reference

* fix: function should be declared const

* refactor: use fmt::format to build log timestamps

* fix: use init-statement to reduce variable scope

* fixup! refactor: use fmt::format to build log timestamps

* fix: remove tau_tracker destructor for rule-of-zero

* fix: remove tr_peerIo destructor for rule-of-zero

* Revert "fix: dereference before null check"

This reverts commit cd78967815.

* fix: signed-unsigned comparison in libtransmission tests

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: signed-unsigned comparison in libtransmission tests

* fixup! fix: extract nested code block into separate method

* fix: mark possibly-unused as [[maybe_unused]]

* fix: invalid stack memory reference in tr_found_file_t

* fix: signed-unsigned comparison in libtransmission tests
2022-04-02 09:06:02 -05:00
Charles Kerr
a250690f30
fix: sonarcloud ()
* fix: break will never be executed

* fix: rewrite rimraf() to be non-throwing

* fix: conditional operation returns same value whether condition is true or false

* fix: use std::array instead of a C-style array

* fix: remove redundant access specifier

* fix: replace switch with if for readability

* fix: convert integer literal to a bool literal

* fix: replace const std::string reference to std::string_view

* fix: remove redundant access specifier

* fix: replace const std::string reference to std::string_view

* fix: remove unused parameter

* fix: remove redundant access specifier

* fix: use std::array instead of C-style array

* fix: remove redundant access specifier

* fix: replace const std::string reference with std::string_view

* fix: remove redundant access specifier

* fix: use std::array instead of C-style array

* fix: remove redundant access specifier

* fix: replace const std::string reference to std::string_view

* fix: remove redundant access specifier

* fix: merge if statement with enclosing one

* chore: clang-format

* chore: clang-format

* Revert "fix: remove redundant access specifier"

This reverts commit 054e4e7eec.

* Revert "fix: remove redundant access specifier"

This reverts commit 2c92f227e8.

* Revert "fix: remove redundant access specifier"

This reverts commit a0710202a8.

* Revert "fix: remove redundant access specifier"

This reverts commit 54da1d9397.

* Revert "fix: remove redundant access specifier"

This reverts commit f7b1777578.

* Revert "fix: remove redundant access specifier"

This reverts commit ad8e3dfff4.

* chore: revert access specifier change
2022-04-01 14:16:33 -05:00
Charles Kerr
e64430941f
refactor: remove tr_strdup_printf() () 2022-03-31 19:13:37 -05:00
Charles Kerr
6e91136b53
fix: three asan issues ()
* fixup! feat: add support for adding torrents by raw hash values ()

fix array-bounds-read issue found by asan

* fixup! refactor: tr_completion ()

fix array-bounds-read issue in tests fixtures

* fixup! refactor: tr_torrents ()

fix memory leak in torrent-tests
2022-03-31 12:12:54 -05:00
Charles Kerr
4dd25d8112
fix: tr_strbuf move op loses zero-termination () 2022-03-30 12:10:51 -05:00
Charles Kerr
66638cc80c
test: fix race condition in move-test () 2022-03-30 01:30:39 -05:00
Charles Kerr
2996e223dd
refactor: strbuf for metainfo files ()
* refactor: tr_ctorSaveContents takes a string_view filename

* refactor: remove tr_ctorSaveMagnetContents

* refactor: announce_list::save takes a std::string_view

* refactor: magnet() takes an OutputIt arg

Generate the magnet link URL into an output iterator

* refactor: remove deprecated calls to tr_http_escape

* refactor: tr_torrent.torrentFile takes an OutputIterator

* refactor: tr_torrent.torrentFile returns a tr_pathbuf

* refactor: tr_torrent_metainfo.makeFilename returns a tr_pathbuf

* refactor: use tr_urlbuf in announcer-http
2022-03-28 17:13:32 -05:00
Charles Kerr
9d141ee2b1
refactor: add fmt::formatters ()
* refactor: add fmt::formatters
2022-03-27 21:55:30 -05:00
Charles Kerr
71ad42b1ef
refactor: make err arg optional in tr_sys_* funcs () 2022-03-27 12:37:29 -05:00
Charles Kerr
977b2a1bab
refactor: tr_loadFile() tr_saveFile() take a std::string_view filename arg ()
* refactor: tr_saveFile takes a string_view

* refactor: tr_saveFile, tr_loadFile take string_view filename
2022-03-25 19:31:27 -05:00
Charles Kerr
1051160b99
feat: strbuf features ()
* feat: strbuf is always zero-terminated

* feat: tr_strbuf::append() now takes any number of args

* feat: tr_strbuf handles zero-terminated string inputs

* feat: add tr_strbuf::ends_with()

* feat: add tr_strbuf::starts_with()

* refactor: replace buildPath() with join()
2022-03-25 16:16:26 -05:00
Charles Kerr
bd895b5052
test: fix file-info test edge case () 2022-03-24 19:03:15 -05:00
Charles Kerr
6e8f9f3ff0
feat: add tr_strbuf ()
* feat: add tr_strbuf class for building tmp strings

Based on fmt::basic_memory_buf, this is a growable string buffer that
has an initial size that's large enough to build most filenames or URLs
without needing heap allocations.

Adds a couple of extra helpers such as a `c_str()` method to make dealing
with old zero-terminated string APIs easier.
2022-03-24 16:41:29 -05:00
Charles Kerr
03ee0028d4
refactor: tr_sys_path_dirname returns a std::string () 2022-03-21 15:22:50 -05:00
Charles Kerr
fcc1510ecb
refactor: use fmt to build the GTK client's user-visible strings ()
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-21 09:15:48 -05:00
Charles Kerr
a942c67199
refactor: use fmt ()
* deps: use fmt (8.1.1 tag) to build log strings

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-13 23:43:35 -05:00
Charles Kerr
af339a15ed
refactor: remove deep logging ()
* refactor: remove "deep logging"
2022-03-09 23:51:14 -06:00
Charles Kerr
60ef1abadf
refactor: tr_torrents ()
* refactor: add tr_torrents container
2022-03-01 15:06:29 -08:00
Charles Kerr
d115ee6dfb
refactor: remove utils dep from peer-io () 2022-02-28 14:26:26 -08:00
Charles Kerr
abfd47a4a8
refactor: remove unused tr_block_info.n_blocks_in_piece () 2022-02-24 12:14:46 -06:00
Charles Kerr
9c3acc7e8a
fixup: handle unhandled scrape/announce responses ()
followup to the  benc refactor
2022-02-24 07:59:58 -06:00
Charles Kerr
13ad2b58dc
refactor: always use a blocksize of 16 KB ()
Fixes .
2022-02-23 14:25:06 -06:00
Charles Kerr
95e30768c4
refactor: rename mediator classes () 2022-02-22 09:09:24 -06:00
Ilkka Kallioniemi
cff1d0a7d0 Add regression test for tr_strlcpy 2022-02-22 10:34:10 +02:00
Charles Kerr
581c3f9854 refactor: do not mix torrent, default trackers 2022-02-21 08:34:59 -06:00
Stefan Talpalaru
7b377511a9 feat: default public trackers 2022-02-21 08:34:57 -06:00
Charles Kerr
87d9f9b00a
refactor: use tr_block_info::Location in cache.cc () 2022-02-19 07:45:19 -06:00
Charles Kerr
f88f3c4b03
Feat: add tr_block_info::Location () 2022-02-18 17:17:19 -06:00
Charles Kerr
02b6cc76d1
feat: add tr_torrentSetTrackerList(), tr_torrentGetTrackerList() ()
Add a getter/setter for torrent announce URLs as text that can be copied
and pasted: one URL per line, with a blank line between tiers.

C API: tr_torrentGetTrackerList() and tr_torrentSetTrackerList()
RPC APi: `trackerList` in `torrent-get` and `torrent-set`.

This deprecates `trackerAdd`, `trackerRemove`, and `trackerEdit`
from the RPC API.
2022-02-18 11:52:01 -06:00
Charles Kerr
9f9b6cdaa2
feat: run script when done seeding ()
* feat: add seeding-done script to core and rpc

* feat: add seeding-done script to gtk client

* feat: add seeding-done script to qt client

* feat: add seeding-done script to transmission-remote

* refactor: make Qt and GTK client text match

* test: update tests

Co-authored-by: Timothy Nibeaudeau <timothy.nibeaudeau@gmail.com>
2022-02-13 22:07:12 -06:00
Charles Kerr
96178b1a9f
feat: add support for adding torrents by raw hash values ()
* Add support for adding torrents by raw hash values

Co-authored-by: vjunk <vjunk@mail.ru>
2022-02-12 22:16:55 -06:00
Charles Kerr
cddd400f7e
test: fix race condition in rename-test () 2022-02-12 13:51:43 -06:00
Charles Kerr
2410ad2fa6
feat: support webseeds in transmission-create () 2022-02-12 12:50:47 -06:00
Charles Kerr
e14c7f38e5
feat: use libpsl ()
Use libpsl to calculate public and private parts of URL hosts.
2022-02-12 11:30:27 -06:00
Charles Kerr
7bdb6f777b
refactor: remove callback from tr_torrentVerify() public API () 2022-02-09 12:02:59 -06:00
Charles Kerr
318d60b72d
refactor: fix sonarcloud "use enum class" code smells ()
* refactor: prefer constexpr over enum for GUI_PAD values

* refactor: prefer constexpr over enum for PrefsDialog values

* refactor: prefer constexpr over enum for StatsDialog values

* refactor: use enum class for GtrUnicode types

* refactor: prefer constexpr over enum for BT peer msg codes

* refactor: use enum class for TrMakemetaResult

* refactor: prefer constexpr over enum for BT metadata message types

* refactor: use enum class for AwaitingBt

* refactor: use enum class for EncryptionPreference

* refactor: use enum class for TrFormat in rpcimpl

* refactor: prefer constexpr over enum for QApp intervals

* refactor: prefer constexpr over enum for tr_resume bitfields

* refactor: prefer constexpr over enum for Qt/TrFileModel bitfields

* refactor: remove obsolete TODO comment in announce-list
2022-02-08 20:25:19 -06:00
Charles Kerr
253f4fe009
chore: remove /upload endpoint from rpc-server ()
It's never been documented or supported and is unused by the web client.

In the unlikely case that a 3rd party app is using it, use 'torrent-add'
instead; it's documented + supported.
2022-01-31 14:54:21 -06:00
Charles Kerr
6f9cba4088
fixup! refactor: SAX-like benc parser pt. 1 () () 2022-01-30 21:12:57 -06:00
Charles Kerr
52f6e80a61
test: add tr_torrent_metainfo.infoDictSize() tests () 2022-01-29 15:37:42 -06:00
Charles Kerr
9e264250d1
refactor: add benc::Handler::Context ()
Prerequisite for using the new benc parser in tr_torrent_metainfo:
That code needs to know the span of the bencoded info dict.
2022-01-28 16:46:14 -06:00
Charles Kerr
3c5442dd7b
test: add tests for parsing http tracker scrape responses () 2022-01-27 17:18:50 -06:00
Ilkka
020a9e45ae
Add more decimals for low ratios () 2022-01-25 10:52:22 -06:00
Charles Kerr
064ad6a436
refactor: saxlike benc pt. 2: add announce response parsing tests () 2022-01-24 22:25:55 -06:00
Charles Kerr
e83a57efa3
refactor: re-enable some clang-tidy rules () 2022-01-24 13:07:55 -06:00
Charles Kerr
5efec26a3b
refactor: SAX-like benc parser pt. 1 ()
* refactor: add SAX-like benc parser

This is the first part of a series of PRs whose end goal is to avoid
the overhead of tr_variant when parsing bencoded data, e.g. when
parsing .torrent files on startup or when parsing announce/scrape
tracker responses.

This PR introduces a SAX-like benc parser, reimplements variant-benc
to use the SAX benc parser (so that we don't have two benc parsers),
and updates the benc + variant tests.
2022-01-24 00:30:00 -06:00
Charles Kerr
b5cbbb7f8f
refactor: clang-tidy 14 ()
get transmission building cleanly with clang-tidy 14
2022-01-23 20:44:14 -06:00
Charles Kerr
85566c372e
test: tests for magnet links with bad/junk values ()
Co-authored-by: Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>
2022-01-23 13:01:48 -06:00
Charles Kerr
df1cca9b57
chore: update copyright years, make notices consistent () 2022-01-20 12:27:56 -06:00
Charles Kerr
8d75736ad1
fix: empty torrent filename ()
fix torrents readded due to unremoved cfg files.
2022-01-17 23:14:00 -06:00
Charles Kerr
2c09e99515
fix: parse utorrent peer-id version components as hex () 2022-01-16 10:27:23 -06:00
Charles Kerr
db23ca4c6b
refactor: replace tr_info with tr_torrent_metainfo ()
* refactor: replace tr_info with tr_torrent_metafo
2022-01-15 13:33:57 -06:00
Frank Aurich
41b2a802cf
Fix another integer overflow bug on 32-bit platforms with torrents > 4GB () 2022-01-12 22:52:36 -06:00
Charles Kerr
b0ee4007ff
refactor: include cleanups ()
* refactor: include <memory> when using shared_ptr or unique_ptr

* refactor: include <cstdio> iff we use it

* refactor: include <cstring> iff we use it

* refactor: include <cstdlib> iff we use it

* refactor: include <string_view> or <string> iff we use it

* refactor: include <array> iff we use it

* refactor: include <ctime> iff we use it

* refactor: include <cctype> iff we use it

* refactor: misc #include cleanups in libtransmission
2022-01-12 20:13:58 -06:00
Charles Kerr
43b9d5c147
fix: potential infinite loop when parsing benc () 2022-01-10 14:27:05 -06:00
Charles Kerr
dfc06fe918
refactor: use std::vector in tr_info () 2022-01-09 10:55:09 -06:00
Charles Kerr
49f2823d6f
refactor: use std::string in tr_info () 2022-01-08 17:41:05 -06:00
Charles Kerr
8b65b660c8
refactor: use std::string in tr_file () 2022-01-08 12:53:35 -06:00
Charles Kerr
0c16c454ba
refactor: base64 utils ()
base64 encode/decode now take std::string_views and return std::strings
2022-01-08 06:46:25 -06:00
Charles Kerr
385a119fb1
refactor: make tr_torrent aggregates tr_block_info instead of subclassing () 2022-01-07 13:13:37 -06:00
Charles Kerr
a5c6168805
refactor: make tr_buildPath() private () 2022-01-02 11:51:59 -06:00
Charles Kerr
88f9704eed
refactor: remove varargs code in tr_sys_file () 2021-12-28 09:08:04 -06:00
Charles Kerr
02aa2f46d4
refactor: don't use varargs in tr_error () 2021-12-27 20:32:22 -06:00
Charles Kerr
fa35b8ad39
refactor: use std::string in tr_variantToStr() ()
* refactor: use std::string in tr_variantToStr()
2021-12-27 16:47:25 -06:00
Charles Kerr
6149870540
refactor: remove tr_file.priv () 2021-12-26 16:04:20 -06:00
Charles Kerr
fd96a9270b
refactor: remove tr_file.offset () 2021-12-26 12:43:27 -06:00
Charles Kerr
a515c1d94b
refactor: use tr_torrent_metainfo in tr ctor () 2021-12-26 10:25:07 -06:00
Charles Kerr
a505447454
refactor: use tr_torrent_metainfo in makemeta tests () 2021-12-26 08:30:24 -06:00
Charles Kerr
7c87cb36eb
refactor: tr_torrent_metainfo ()
* refactor: add tr_torrent_metainfo class

Can be used for parsing bencoded .torrent data without instantiating
a tr_torrent. This will be used in all the places where client code
needs to test a .torrent file for validity / to add a preview window
before adding the torrent.
2021-12-25 15:21:13 -06:00
Charles Kerr
0e321c2d21
fix: clang warnings ()
* fix: comparison-is-always-false warning

* fix: C/C++ mixing (memset() to clear a C++ object)
2021-12-25 11:22:12 -06:00
Charles Kerr
b058daff4b
refactor: change tr_torrentNew() args () 2021-12-24 16:05:17 -06:00
Charles Kerr
f3228e9670
refactor: further decouple tr_torrent and tr_info () 2021-12-24 15:12:33 -06:00
Charles Kerr
33553c5331
refactor: move tr_ioFindFileLocation() to tr_file_piece_manager () 2021-12-24 00:39:55 -06:00
Charles Kerr
dd1379b0b6
refactor: add tr_interned_string () 2021-12-23 11:16:05 -06:00