aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/fetch
Commit message (Collapse)AuthorAgeFilesLines
* Remove referrer policy from document (#34263)shanehandley2024-11-191-8/+6
| | | | | | | | | | | | | | | | | | | | | * Remove the referrer policy from document and rely on its policy container Signed-off-by: Shane Handley <shanehandley@fastmail.com> * Make ReferrerPolicy non-optional, instead using a new enum value to represent the empty string case Signed-off-by: Shane Handley <shanehandley@fastmail.com> * Fix clippy issue Signed-off-by: Shane Handley <shanehandley@fastmail.com> * Fix usage of Option<ReferrerPolicy> in unit test Signed-off-by: Shane Handley <shanehandley@fastmail.com> --------- Signed-off-by: Shane Handley <shanehandley@fastmail.com>
* Implement PolicyContainer and update the default ReferrerPolicy (#33977)shanehandley2024-11-081-22/+60
| | | | | | | | | | | | | | | | | | | | | * Implement PolicyContainer Signed-off-by: Shane Handley <shanehandley@fastmail.com> * implement small parts of fetch that interact with policy container Signed-off-by: Shane Handley <shanehandley@fastmail.com> * fix: allow policy container's csp list to be unset Signed-off-by: Shane Handley <shanehandley@fastmail.com> * fix: use the correct default policy when parsing from a token Signed-off-by: Shane Handley <shanehandley@fastmail.com> --------- Signed-off-by: Shane Handley <shanehandley@fastmail.com>
* net: Start reducing number of IPCs channels used for fetch with a ↵Martin Robinson2024-10-161-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `FetchThread` (#33863) Instead of creating a `ROUTER` for each fetch, create a fetch thread which handles all incoming and outcoming fetch requests. Now messages involving fetches carry a "request id" which indicates which fetch is being addressed by the message. This greatly reduces the number of file descriptors used by fetch. In addition, the interface for kicking off fetches is simplified when using the `Listener` with `Document`s and the `GlobalScope`. This does not fix all leaked file descriptors / mach ports, but greatly eliminates the number used. Now tests can be run without limiting procesess on modern macOS systems. Followup work: 1. There are more instances where fetch is done using the old method. Some of these require more changes in order to be converted to the `FetchThread` approach. 2. Eliminate usage of IPC channels when doing redirects. 3. Also eliminate the IPC channel used for cancel handling. 4. This change opens up the possiblity of controlling the priority of fetch requests. Fixes #29834. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Implement fetch metadata headers (#33830)Simon Wülker2024-10-161-1/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement sec-fetch-dest header Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement "is same site" algorithm Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement remaining sec-fetch-* headers Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix casing of header names Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix handling Destination::None in sec-fetch-dest This also removes the comment about wanting to upgrade to a newer content-security-protocol version because the csp doesn't implement the "empty" case. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Remove colon from spec comment Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Adjust expected default headers Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix test expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Create HttpStatus to safely deal with HTTP responses status. (#33581)webbeef2024-09-291-8/+8
| | | Signed-off-by: webbeef <me@webbeef.org>
* Let protocol handlers decide if they are fetchable (#33573)webbeef2024-09-281-5/+7
| | | | | | | This adds a 'is_fetchable()' method on the ProtocolHandler trait that is then used in the fetch code. The 'data:' protocol handler is updated to return true instead of hardcoding the scheme comparison, as well as the 'urlinfo:' handler since it's just a testing one. Signed-off-by: webbeef <me@webbeef.org>
* Improve spec conformance around request header validation (#33418)shanehandley2024-09-141-149/+2
| | | | | | | | | | | | | | | | | * fix: improve spec conformance around request header validation Signed-off-by: Shane Handley <shanehandley@fastmail.com> * account for additional test passes Signed-off-by: Shane Handley <shanehandley@fastmail.com> * fix: remove redundant .to_vec call Signed-off-by: Shane Handley <shanehandley@fastmail.com> --------- Signed-off-by: Shane Handley <shanehandley@fastmail.com>
* Initial support for `<link rel="prefetch">` (#33345)Simon Wülker2024-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Properly store link relations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Send fetch request for prefetch links We don't actually *do* anything with the response yet (handle errors etc) but its a first step. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fire load/error events for prefetch loads Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Set prefetch destination/cors setting correctly Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix ./mach test-tidy errors Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Set correct "Accept" value for prefetch requests Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Add spec text to individual steps Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* net: Stop using legacy time in the HTTP and CORS caches (#33259)Martin Robinson2024-08-301-9/+10
| | | | | This is part of switching away from using a very old version of `time`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* make protocol handlers registrable (#33104)webbeef2024-08-221-201/+12
| | | Signed-off-by: webbeef <me@webbeef.org>
* Remove unused constant from `components/net/fetch/methods.rs` (#33054)Martin Robinson2024-08-141-4/+1
| | | | | This was revealed by the recent switch to `LazyLock`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Replace the lazy_static crate with std::sync::LazyLock in components/net ↵Hayashi Mikihiro2024-08-141-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | (#33046) * replace in net/fetch/methods.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in net/hosts.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in net/async_runtime.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in net/tests/main.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * remove lazy_static crate from components/net Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> --------- Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
* Allow navigations that include cross-origin redirects to succeed. (#32996)Josh Matthews2024-08-121-7/+18
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Add a directory listing feature for `file` URLs (#32580)Martin Robinson2024-06-261-8/+5
| | | | | Signed-off-by: Bobulous <Bobulous@users.noreply.github.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Bobulous <Bobulous@users.noreply.github.com>
* clippy: fix some leftover warnings in components/net (#32476)Peter Mikola2024-06-111-1/+1
|
* clippy: fix `result_unit_err` warnings (#31791)eri2024-03-211-8/+6
| | | | | | | | | | | | | | | | | * clippy: fix `result_unit_err` warnings * feat: fix result warnings in script * doc: document `generate_key` return type Co-authored-by: Martin Robinson <mrobinson@igalia.com> * feat: add back result to RangeRequestBounds::get_final Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* clippy: Fix warnings in `components/net` (#31626)eri2024-03-131-15/+9
| | | | | * clippy: fix warnings in `components/net` * fix: review comments
* Fix more clippy warnings in `components/shared/net` (#31548)Mucha Naibei2024-03-101-4/+4
| | | | | | | | | | | * Fix clippy warnings in components/shared * Fix build error * Fixes in order to solve some merge issues --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* clippy: fix warnings in components/net (#31564)eri2024-03-103-37/+33
| | | | | | | * clippy: fix some warnings in components/net * fix: review comments * fix: tidy
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-1/+1
| | | | This fixes many rustdoc errors that occur due to raw URLs in rustdoc comments as well as unescaped Rust code that should be in backticks.
* Revert "Replace time with std::time in components/net (#31079)" (#31120)Martin Robinson2024-01-181-11/+9
| | | This reverts commit 580062228bb083ccdc2144a43491bc4f916c57ad.
* Replace time with std::time in components/net (#31079)Taym Haddadi2024-01-171-9/+11
| | | | | | | | | | | | | * Replace time with std::time in components/net Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Fix cookie::test_sort_order test Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-112-27/+31
| | | | | * strict imports formatting * Reformat all imports
* remove `extern crate` (#30311)Samson2023-09-081-0/+3
| | | | | | | | | | | * remove extern crate * Update components/script_plugins/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* constellation: crash to a new “sad tab” error page (#30290)Delan Azabani2023-09-061-0/+7
| | | | | | | | | | | | | | | | | | | | | * constellation: crash to a new “sad tab” page * check in resources/crash.html * use a separate enum variant instead of keying on reason * fmt + tidy * rename Resource::Crash to Resource::CrashHTML * clean up crash page and add details (reason + backtrace) * avoid repeating crash errors in script::script_thread warn log * make new LoadData init more idiomatic * clarify comments and new fields * fix doc comment style
* Switch to rustls and webpki-roots (#30025)Martin Robinson2023-08-081-27/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change replaces OpenSSL with rustls and also the manually curated CA certs file with webpki-roots (effectively the same thing, but as a crate). Generally speaking the design of the network stack is the same. Changes: - Code around certificate overrides needed to be refactored to work with rustls so the various thread-safe list of certificates is refactored into `CertificateErrorOverrideManager` - hyper-rustls takes care of setting ALPN protocols for HTTP requests, so for WebSockets this is moved to the WebSocket code. - The safe set of cypher suites is chosen, which seem to correspond to the "Modern" configuration from [1]. This can be adjusted later. - Instead of passing a string of PEM CA certificates around, an enum is used that includes parsed Certificates (or the default which reads them from webpki-roots). - Code for starting up an SSL server for testing is cleaned up a little, due to the fact that the certificates need to be overriden explicitly now. This is due to the fact that the `webpki` crate is more stringent with self-signed certificates than SSL (CA certificates cannot used as end-entity certificates). [2] 1. https://wiki.mozilla.org/Security/Server_Side_TLS 2. https://github.com/briansmith/webpki/issues/114 Fixes #7888. Fixes #13749. Fixes #26835. Fixes #29291.
* bump base64 from 0.10 to 0.21 (#29804)Tuna2023-08-021-1/+3
| | | | | | | | | * bump base64 from 0.10 to 0.21 * Fix configuration of bitflags --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Fix concept-header-list-get-decode-split2shiori172023-03-261-2/+2
|
* Fix return value of concept-header-list-get to Option<Vec<u8>>2shiori172023-03-261-13/+17
|
* Remove net from dependencies2shiori172023-03-201-16/+1
|
* Implement concept-header-list-sort-and-combine2shiori172023-03-061-1/+1
|
* Upgrade HyperNaveen Gattu2022-01-162-5/+7
|
* Fix warnings.Josh Matthews2022-01-031-2/+0
|
* Non-blocking network IONaveen Gattu2021-12-231-89/+108
|
* Update nightly rustc.Josh Matthews2021-11-011-1/+1
|
* Block port 10080Vincent Ricard2021-04-161-2/+2
| | | | See https://github.com/whatwg/fetch/issues/1191
* Add port blocking for tftp, netbios-ns, snmp, rtsp, h323gatestat, ↵Vincent Ricard2021-03-291-5/+6
| | | | | | h323hostcall, pptp, sane-port Spec update: https://github.com/whatwg/fetch/pull/1148
* Fix some 'nosniff' testsVincent Ricard2021-03-082-12/+180
|
* Update the "bad ports" listVincent Ricard2020-11-041-2/+2
| | | | https://github.com/whatwg/fetch/issues/1108
* Update referrer computationUtsav Oza2020-07-021-20/+14
| | | | | | | | Update unit tests for determine_requests_referrer Update wpt metadata Add missing spec links
* Make url for "client" referrer mandatoryMatthias Deiml2020-06-171-7/+1
|
* fix streaming request bodies, terminate fetch if the body stream errorsGregory Terzian2020-06-161-2/+6
|
* net: Use a POST request for allowing certs temporarily.Josh Matthews2020-06-091-14/+22
|
* net: Add option to temporarily accept certs that failed the handshake.Josh Matthews2020-06-091-11/+35
|
* net: update list of bad portsGregory Terzian2020-06-041-4/+4
|
* check http_state in determine_request_referrerAlexandrov Sergey2020-05-191-0/+1
|
* Update content-security-policy.Josh Matthews2020-03-251-0/+1
|
* Auto merge of #25740 - gterzian:per_fetch_filemanager_handle, r=Manishearthbors-servo2020-02-251-3/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per fetch file token for blob url <!-- Please describe your changes on the following line: --> Depends on https://github.com/servo/servo/pull/25724 First step of https://github.com/servo/servo/issues/25226 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
| * add a fetch token for blob urlsGregory Terzian2020-02-211-3/+4
| |
* | Auto merge of #25768 - pshaughn:corsstar, r=jdmbors-servo2020-02-141-9/+10
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handle access-control header wildcards <!-- Please describe your changes on the following line: --> We were checking Access-Control-Expose-Headers for wildcards inconsistently and then discarding the result; this fixes the check and its use, passing the WPT test for having a wildcard there. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #24913 <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->