1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! URI struct definition and default port mapping.
//!
//! Mirrors C++ `UriStruct` and `FeatureConfig::getDefaultPort`.
// ---------------------------------------------------------------------------
// Default port mapping (mirrors C++ FeatureConfig::getDefaultPort)
// ---------------------------------------------------------------------------
/// Return the default port for well-known URI schemes.
///
/// Matches C++ `getDefaultPort()`:
/// - http → 80, https → 443, ftp → 21, sftp → 22
/// - Unknown → 0
// ---------------------------------------------------------------------------
// UriStruct — parsed URI components (mirrors C++ uri::UriStruct)
// ---------------------------------------------------------------------------
/// Parsed components of a URI, mirroring the C++ `UriStruct`.
///
/// Key differences from the C++ struct:
/// - `dir` includes the trailing `/` (e.g. `/path/to/`), matching C++ behavior
/// where `dir` is the path minus the basename.
/// - `file` is the last path segment (basename). Empty when the path ends with `/`.
/// - `query` includes the leading `?` when present (e.g. `?key=val`).
/// - `port` is always filled: explicit from the URI or the scheme default.