Expand description
Pure parsers for OS proxy string formats.
List parsers drop malformed elements and keep the rest. Dropping a scheme endpoint
without recording it would be fail-open; bypass drops are fail-closed → rejected.
§Writing a bypass list
Every store has one, no two of them read it the same way, and the differences decide which hosts go direct. What an entry means to this crate, by the list it is written in — the store’s own reading, except where a cell says the two part company:
| Entry | no_proxy, KDE NoProxyFor | Windows ProxyOverride | macOS ExceptionsList | GNOME ignore-hosts |
|---|---|---|---|---|
| separator between entries | , alone — a ; leaves the two names one dead rule, and an entry still holding a space is rejected | ;, , or whitespace | the array is the separator | the array is the separator |
example.com | that host and everything under it | that host alone | that host alone | that host and everything under it |
.example.com, *.example.com | the subdomains, not example.com itself | *.example.com is the subdomains; .example.com is rejected — Windows has no reading for a leading . (below) | the subdomains | the same rule as the bare name: the domain and its subdomains |
a * anywhere else (192.168.*) | a glob here, which is Chromium’s reading; Go and libproxy take it as literal text no host carries | a glob | syntax only as a trailing .*, which misses the bare host a Mac’s own name.* still reaches; anything else is rejected | never syntax; rejected |
a bare * | every destination direct | every destination direct | rejected — it matches no host on a Mac | rejected, same reason |
10.0.0.0/8 | the network | rejected — Windows has no / in this grammar, and one entry holding it turns the proxy off for every destination (below); write the range as 10.* | the network | the network |
example.com:8080 | holds the entry to that port | holds it | rejected — macOS compares the whole entry to the host name, so a port kills it | holds it, but a portless http:// URL is asked about with port 0 and will not meet it |
<local>, <-loopback> | read | read | read | read |
| a space at either end | trimmed | trimmed | kept, and no host carries it, so the entry is rejected | trailing trimmed, leading kept and rejected |
A rejected entry is not dropped in silence: it lands in
BypassRules::rejected with the reason, so a rule that
does nothing reads as doing nothing rather than as live.
Two spellings cost a Windows list more than themselves, and both are refused here rather
than read. An entry starting with . is granted nothing by any reader measured: WinINet
refuses the whole list over one, while WinHTTP and the registry reading keep the list and
send the subdomains to the proxy regardless — *.name is the spelling to write. An entry
holding a /, a CIDR block included, goes further still: the registry reading stops
using the proxy at all and every destination goes direct. Both land in rejected with
the reason while the entries beside them stay live — which is narrower than what the
machine does with the same list, and as wide a claim as the readings support.
Two rows are worth stating flat. A bare name changes meaning between the first column
and the next two, so contoso.com in no_proxy covers api.contoso.com and the same
text in ProxyOverride does not. And <local> / <-loopback> are read out of every
list here so the sources share one vocabulary, while only Windows’ own resolver acts on
them: a macOS or GNOME store spelling one gets a bypass from this crate and none from
the machine. the_local_token_bypasses_nothing_here in tests/mac_exceptions_list.rs
measures the macOS half; GNOME’s is read off GLib, in src/sys/linux/gsettings_map.rs.
Constants§
- WINDOWS_
DEFAULT_ PORT - The port assumed when a Windows
ProxyServerentry omits one.
Functions§
- no_
proxy - Parse
no_proxyintoBypassRules:*, CIDR, domains,:port, and a localhost bypass that stays on unless an entry clears it. Entries are separated by,alone — not whitespace and not;, which is what Go’shttpproxydoes and what KDE’s readers do withNoProxyFor. Malformed →BypassRules::rejected. An entry that repeats one already inBypassRules::patternsis dropped, first spelling kept, so the list can be shorter than the string had entries. - proxy_
override - Parse a Windows
ProxyOverrideregistry value intoBypassRules. - proxy_
server - Parse Windows
ProxyServer(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG). - windows_
manual - Assemble a
ProxyMode::Manualfrom the two Windows registry strings.