mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
f6f72ddd13
This patch is replacing the code to parse the hosts file with the [parse-hosts](https://crates.io/crates/parse-hosts) crate. This crate has a [CC0 1.0 Universal License](https://creativecommons.org/publicdomain/zero/1.0/deed.en). I could have used [HostsFile::load()](https://clarcharr.github.io/parse-hosts/parse_hosts/struct.HostsFile.html#method.load) directly, but this method loads `/etc/hosts` by default and does not allow to override the default path (for example with [env::var("HOST_FILE")](https://dxr.mozilla.org/servo/source/components/net_traits/hosts.rs#19)), so I kept the existing code to open and read the content of `env::var("HOST_FILE")` and also kept the [parse_hostsfile](https://dxr.mozilla.org/servo/source/components/net_traits/hosts.rs#42) method (used by the unit tests), but I modified it to use [HostsFile::read_buffered](https://clarcharr.github.io/parse-hosts/parse_hosts/struct.HostsFile.html#method.read_buffered), which is doing the actual hosts parsing for a given string buffer. - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #15756 . - [X] There are tests for these changes (tests/unit/net/resource_thread.rs and tests/unit/net/http_loader.rs) Source-Repo: https://github.com/servo/servo Source-Revision: 8f7c69e15f0b9beddad2ba67e3419f88aca0d579 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 1a04f0ca1484f93aa39e1f0d511a7b7d061e8afd |
||
---|---|---|
.. | ||
image | ||
blob_url_store.rs | ||
Cargo.toml | ||
filemanager_thread.rs | ||
hosts.rs | ||
image_cache_thread.rs | ||
lib.rs | ||
net_error_list.rs | ||
pub_domains.rs | ||
request.rs | ||
response.rs | ||
storage_thread.rs |