Commit Graph

18 Commits

Author SHA1 Message Date
Yat Ho
4bc74e3dd4 feat: allow non-ASCII announce and webseed URLs (#8420)
* test: `tr_urlPercentEncode()`

* refactor: percent-encode URLs provided in announce list or webseeds

* test: announce list and webseed
2026-02-10 16:19:04 -06:00
Charles Kerr
554cc56bdf refactor: rename our namespace to tr (#8256)
tr and tr::app are less cluttered than libtransmission:: and transmission::app
2026-01-28 18:11:34 -06:00
Yat Ho
cf0a596a45 fix: url port parsing (#8109)
* fix: url port parsing

- `tr_urlParse()` should fail if cannot parse port
- Avoid parsing scheme ports to numbers
- Port should not be parsed to a negative number
- Port should not be parsed to `0`
- Directly parse number string to `uint16_t`

* test: invalid port
2026-01-11 11:43:12 -06:00
Charles Kerr
d7d0d87f78 refactor: remove tr_url_query_view (#8049)
replace bespoke struct with std:: container
2026-01-02 22:39:37 -06:00
Charles Kerr
27f0e2e20d test: always call tr_lib_init() in libtransmission tests (#7992)
* test: add TransmissionTest fixture that calls tr_lib_init()

* refactor: use std::call_once() in tr_lib_init()

* test: ensure quarks are sorted in RpcTest::sessionGet

* refactor: use ::libtransmission::test::TransmissionTest

prefer this over ::testing::Test to ensure tr_lib_init() is called once
2025-12-23 14:32:29 -06:00
Yat Ho
2ff3ae07d1 fix: more misc net.cc fixes (#6735)
* feat: accept ipv6 string in square brackets for `tr_address::from_string()`

* test: add test case for ipv6 string in square brackets

* fix: include square brackets in host component

According to RFC3986:
  host       = IP-literal / IPv4address / reg-name
  IP-literal = "[" ( IPv6address / IPvFuture  ) "]"

* fix: set ipv6-only socket before binding UDP socket

Will return EINVAL on Linux otherwise

* refactor: simplify code using `evutil` when binding TCP socket

* fix: do not set SO_REUSEADDR for listening sockets on Windows systems

Reason: https://stackoverflow.com/a/14388707/11390656

* fix: do not enclose ipv4 address string in square brackets
2024-03-25 21:10:06 -05:00
tearfur
5ec4ca550e chore: iwyu (#5746) 2023-07-08 10:24:03 -05:00
Charles Kerr
033d698306 fix: parsing of ipv6 tracker announce URLs (#5174) 2023-03-07 12:19:12 -06:00
Mike Gelfand
57e6b06921 Modernize CMake code (ongoing refactoring) (#4515)
* Use imported CMake target for CURL

* Use imported CMake target for fmtlib

* Use imported CMake target for WideInteger

* Use imported CMake target for FastFloat

* Use imported CMake target for UtfCpp

* Use imported CMake target for Threads

* Use imported CMake target for Iconv

* Use imported CMake target for crypto backend

* Use imported CMake target for GTK

* Use imported CMake target for Qt

* Use imported CMake target for deflate

* Use imported CMake target for libevent

* Use imported CMake target for natpmp

* Use imported CMake target for miniupnpc

* Use imported CMake target for dht

* Use imported CMake target for psl

* Use imported CMake target for libutp

* Use imported CMake target for libb64

* Use include directories from libtransmission target
2023-01-02 16:23:51 +00:00
Charles Kerr
092d411663 refactor: tr_rand_buffer(), tr_rand_int() again (#4415) 2022-12-21 09:58:32 -06:00
Charles Kerr
c0f29a89ea refactor: add [[nodiscard]] (#3793) 2022-09-08 21:49:51 -05:00
Charles Kerr
83ffa6bf1b chore: fix spdx abbreviations (#3602) 2022-08-08 13:05:39 -05:00
Charles Kerr
2f97655981 refactor: remove tr_url_parsed_t.portstr (#2929) 2022-04-16 13:13:42 -05:00
Charles Kerr
a134445caa test: fuzz test tr_torrent_metainfo.parseBenc() (#2891)
* 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
76f44b4b6f fix: sonarcloud (#2868)
* 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
e14c7f38e5 feat: use libpsl (#2575)
Use libpsl to calculate public and private parts of URL hosts.
2022-02-12 11:30:27 -06:00
Charles Kerr
df1cca9b57 chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr
d8b57fe4dc refactor: web_utils (#2121)
* chore: move web utils from web, utils to web-utils
2021-11-08 21:30:03 -06:00