gecko-dev/netwerk
Valentin Gosu b9501927ed Bug 1616252 - Exclude domains in /etc/hosts from using TRR r=necko-reviewers,dragana
This patch adds a task that is dispatched to the background thread when TRR
is first enabled. This may mean during the TRRService initialization at
startup or later when the pref is flipped.

The task will call into rust_parse_etc_hosts which does the actual file
opening and parsing. We pass the path to the file, that being either
/etc/hosts or the Windows equivalent obtained by calling
SHGetSpecialFolderPathA.

The rust code opens the file and proceeds to read it line by line while
accumulating all the hostnames in an array. Since these files can be
quite large, on the order of several megabytes, we need to make sure we
don't block shutdown doing this - so once more than 100 domains have
accumulated in the array we call back into C++ code to add them to the
exclusion list. The callback will return true if we should continue to
parse the file or false otherwise.

We also change the tests to use "excluded" rather than localhost when
testing the excluded-domains prefs, since localhost is unually present
in /etc/hosts and may interfere with the test.

We also use an atomic sTRRServicePtr to make sure that we don't have
a data race between the TRRService being freed and the callbacks of the
parsing.

Differential Revision: https://phabricator.services.mozilla.com/D90663
2020-10-01 07:01:58 +00:00
..
base Bug 1616252 - Exclude domains in /etc/hosts from using TRR r=necko-reviewers,dragana 2020-10-01 07:01:58 +00:00
build Bug 1631722 - Add wrapper for structured-headers crate,r=valentin 2020-08-12 07:07:33 +00:00
cache Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi 2020-09-23 15:17:15 +00:00
cache2 Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi 2020-09-23 15:17:15 +00:00
cookie Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi 2020-09-23 15:17:15 +00:00
dns Bug 1616252 - Exclude domains in /etc/hosts from using TRR r=necko-reviewers,dragana 2020-10-01 07:01:58 +00:00
ipc Backed out 2 changesets (bug 1652677) on request from kershaw for causing bug 1667801 2020-09-30 13:14:00 +02:00
locales Bug 1654556 - Log also "failed the samesite tests" cookie rejection reason, r=baku 2020-07-23 14:48:12 +00:00
mime Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi 2020-09-23 15:17:15 +00:00
protocol Bug 1668232 - Add support for draft 30 r=necko-reviewers,valentin 2020-09-30 12:01:27 +00:00
sctp Bug 1666570 - Cherrypick ffed0925f27d404173c1e3e750d818f432d2c019 from usrsctp; r=drno 2020-09-23 21:52:29 +00:00
socket Bug 1668232 - Add support for draft 30 r=necko-reviewers,valentin 2020-09-30 12:01:27 +00:00
srtp Bug 1653182 - Part 2: Remove redundant -std=gnu99 from netwerk/sctp and srtp. r=froydnj 2020-07-29 19:12:25 +00:00
streamconv Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi 2020-09-23 15:17:15 +00:00
system Bug 1654992 - Use std::move instead of SwapElements where possible. r=froydnj 2020-08-04 11:27:07 +00:00
test Bug 1616252 - Exclude domains in /etc/hosts from using TRR r=necko-reviewers,dragana 2020-10-01 07:01:58 +00:00
url-classifier Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi 2020-09-23 15:17:15 +00:00
wifi Bug 1610070 - Part 3: Convert the rest of netwerk/ to use UniquePtr. r=mayhemer 2020-02-11 16:20:08 +00:00
moz.build Bug 1623593 - Get rid of NECKO_COOKIES compilation flag, r=mayhemer 2020-03-24 16:30:03 +00:00