aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/tests/http_loader.rs
Commit message (Collapse)AuthorAgeFilesLines
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-124/+164
| | | | | | | | | | | | | * Use 2024 style edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reformat all code Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Don’t prompt user for credentials for non-Navigate request (#35664)Isaac Marovitz2025-02-261-1/+52
| | | Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
* libservo: Add a delegate method for HTTP authentication (#35400)Martin Robinson2025-02-101-7/+14
| | | | | | | | | | | | Add a delegate method for HTTP authentication and a related `AuthenticationRequest` object that carries with it the URL as well as whether or not the authentication request is for a proxy or not. This is now separate from the prompt API because requesting authentication doesn't necessarily involve prompting -- this is an implementation detail of the embedder. In addition, the internal bits are cleaned up slightly. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Modify the checks for upgrade-request algorithm (#35357)Shubham Gupta2025-02-071-2/+0
| | | Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
* Add support for Upgrade request to a potentially trustworthy URL. (#34986)Shubham Gupta2025-02-051-0/+2
| | | | | | | | | | | | | | | | * Add support for Upgrade request to a potentially trustworthy URL. Signed-off-by: Shubham Gupta <shubham13297@gmail.com> * script: Support inheritable insecure request policy in documents and workers. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Shubham Gupta <shubham13297@gmail.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Shubham Gupta <shubham.gupta@chromium.org> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Include `WebViewId` into EmbedderMsg variants where possible (#35211)Delan Azabani2025-01-301-34/+34
| | | | | | | | | | | | | | | | | `EmbedderMsg` was previously paired with an implicit `Option<WebViewId>`, even though almost all variants were either always `Some` or always `None`, depending on whether there was a `WebView involved. This patch adds the `WebViewId` to as many `EmbedderMsg` variants as possible, so we can call their associated `WebView` delegate methods without needing to check and unwrap the `Option`. In many cases, this required more changes to plumb through the `WebViewId`. Notably, all `Request`s now explicitly need a `WebView` or not, in order to ensure that it is passed when appropriate. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* add minimal implementation of FetchParams (#34833)arthmis2025-01-121-66/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add minimal implementation of fetchParams and fetch controller for cancellation support fix something removing fetch params from http network or cache fetch due to implementation difficult Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * run formatter Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fix incorrect spec implementation and add comments with related step number and description Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fix double borrow issue Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * remove unused code from FetchParams Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add workaround for double mutable borrow error Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * remove unnecessary comments, move import and format Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fix comments that state spec instructions Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * update comment Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * refactor tests Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * refactor tests Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> --------- Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> Co-authored-by: lazypassion <25536767+lazypassion@users.noreply.github.com>
* Update all network-related dependencies to the latest versions (#34630)Josh Matthews2025-01-081-340/+413
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update all network-related dependencies to the latest versions: * rustls * hyper * http * headers * tungstenite * async-tungstenite Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix panics with 1xx responses in WPT tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Use reported response length when calculating available ranges. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Remove unreachable match arm. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Clean up commented fragments in blob and file handlers. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Remove unreachable match arm. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix clippy warning. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Cleanup. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix up unit tests for dependency upgrades. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update aws-lc-sys to fix Windows builds. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Use ring instead of aws-lc-sys. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * embedding: Require embedder to initialize a rustls CryptoProvider. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Disable aws-lc-rs pending OhOS build fixes. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Prompt user for credentials when http request needs it (#34620)arthmis2024-12-281-2/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * prompt user to get their credentials Signed-off-by: Lloyd Massiah artmis9@protonmail.com move credential prompt to a function Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add prompt for step 15.4 Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add new prompt definition for user credentials Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * remove default implementation for HttpState which allowed making the embedder_proxy non-optional - default implementation was only used in tests so created an alternative create_http_state function Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> add credentials to authentication cache Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add tests that are successful for the happy path Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add test for user cancels prompt and user inputs incorrect credentials, and refactor shared code between tests Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * handle error when setting username and password in Url and ran formatting Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> renaming test functions Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * change authentication flag to false for proxy authentication. The spec doesn't specify that the flag should be true, and the flag is by default false Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * clean up test code a bit Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add skeleton implementation to support open harmony and android Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * update warning message to include Android Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fix build error for OH os and Android Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * remove unused import to fix warning Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> --------- Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> Co-authored-by: lazypassion <25536767+lazypassion@users.noreply.github.com>
* net: Ensure that origin serialization is consistent (#34081)Martin Robinson2024-10-311-1/+23
| | | | | | | | | | | | | | A recent refactoring (#33531) made a change that resulted in the `Origin` header including the port even when the default port for a scheme was used. This made the serialization different from that used for `rust-url`'s `Origin::ascii_serialization()`, breaking CORS on some sites. This change makes it so that the serialization is consistent again. This change also fixes the visiblity on a few methods in `http_loader.rs` since visibility needs to be adjusted for testing anyway. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Use `ROUTER::add_typed_route` instead of `ROUTER::add_route` everywhere (#33866)Simon Wülker2024-10-181-3/+3
| | | | | | | | | | | | | * Use ROUTER::add_typed_route where possible Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update webxr, media and ipc-channel Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* net: Start reducing number of IPCs channels used for fetch with a ↵Martin Robinson2024-10-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* net: Refactor `Decoder` (#33611)Cristian Brinza2024-10-021-7/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor Decoder to be fully async Signed-off-by: crbrz <cristianb@gmail.com> * Update WPT results Signed-off-by: crbrz <cristianb@gmail.com> * Fix deflate unit test Signed-off-by: crbrz <cristianb@gmail.com> * Add compressed response update count test Signed-off-by: crbrz <cristianb@gmail.com> * Fix typo Signed-off-by: crbrz <cristianb@gmail.com> * Source error check without conversion to String Signed-off-by: crbrz <cristianb@gmail.com> * Simplify error check Signed-off-by: crbrz <cristianb@gmail.com> * Fix variable name Signed-off-by: crbrz <cristianb@gmail.com> * Added TODO note for network.tls.ignore_unexpected_eof Signed-off-by: crbrz <cristianb@gmail.com> --------- Signed-off-by: crbrz <cristianb@gmail.com>
* Create HttpStatus to safely deal with HTTP responses status. (#33581)webbeef2024-09-291-55/+29
| | | Signed-off-by: webbeef <me@webbeef.org>
* dependencies: Upgrade `cookie` and rename Servo's `Cookie` to `ServoCookie` ↵Martin Robinson2024-07-261-6/+6
| | | | | | | | | | | | | | (#32861) This changes updates to the new version of the `cookie` crate in Servo which no longer uses the old `time@0.1` data types. This requires using a new version of `time` while we transition off of the old one. This is the first step in that process. In addition, the overloading of the `cookie::Cookie` name was causing a great deal of confusion, so I've renamed the Servo wrapper to `ServoCookie` like we do with `ServoUrl`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* DevTools: Replace camel case variable names (#32726)eri2024-07-081-2/+2
| | | | | | | | | * refactor: rename to snake case * refactor: more renaming * chore: format * chore: clean
* Move non-gfx things out of `gfx_traits` and create a `base` crate (#32296)Martin Robinson2024-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | For a long time, `gfx_traits` has held a lot of things unrelated to graphics and also unrelated to the `gfx` crate (which is mostly about fonts). This is a cleanup which does a few things: 1. Move non `gfx` crate things out of `gfx_traits`. This is important in order to prevent dependency cycles with a different integration between layout, script, and fonts. 2. Rename the `msg` crate to `base`. It didn't really contain anything to do with messages and instead mostly holds ids, which are used across many different crates in Servo. This new crate will hold the *rare* data types that are widely used. Details: - All BackgroundHangMonitor-related things from base to a new `background_hang_monitor_api` crate. - Moved `TraversalDirection` to `script_traits` - Moved `Epoch`-related things from `gfx_traits` to `base`. - Moved `PrintTree` to base. This should be widely useful in Servo. - Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it to `WebRenderFontApi`.
* Backout `Host`-header related change from #32024. (#32093)Philip Lamb2024-04-161-2/+0
| | | #32024 broke a different set of nginx sites, and a more sophisticated fix for the case of a missing HTTP 1.1 `Host` header is required.
* Fixes for HTTP header compliance. (#32024)Philip Lamb2024-04-111-13/+11
| | | | | - Fix 400 errors from nginx in response to Servo requests by implementing conformant albeit non-normative removal of whitespace from `Accept` and `Accept-Language` HTTP headers. (To match behaviour of Firefox, Safari, and Chrome) https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2 - Provide `Host` header as REQUIRED by HTTP protocol https://www.rfc-editor.org/rfc/rfc9110#field.host - Update tests.
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-15/+14
| | | | | * strict imports formatting * Reformat all imports
* Upgrade HyperNaveen Gattu2022-01-161-23/+5
|
* Disable all http_loader unit tests on windows.Josh Matthews2021-05-271-0/+2
|
* Disable intermittent unit test.Josh Matthews2021-05-261-0/+1
|
* Disable another intermittent test on windows.Josh Matthews2021-05-221-0/+1
|
* Disable intermittent test on windows.Josh Matthews2021-05-221-0/+1
|
* Compile fix.Josh Matthews2021-04-071-0/+2
|
* Try to work around windows unit test failures.Josh Matthews2021-04-071-5/+2
|
* Disasable net unit test on windows.Josh Matthews2021-04-041-0/+1
|
* Remove unit test that triggers frequent intermittent failure.Josh Matthews2020-07-271-78/+2
|
* Auto merge of #27198 - jdm:http-origin-test-debug, r=asajeffreybors-servo2020-07-071-7/+8
|\ | | | | | | | | | | Add debug output for intermittently failing test. This should help narrow down the cause of #26895.
| * Add debug output for intermittently failing test.Josh Matthews2020-07-071-7/+8
| |
* | Update referrer computationUtsav Oza2020-07-021-26/+10
|/ | | | | | | | Update unit tests for determine_requests_referrer Update wpt metadata Add missing spec links
* Use global.get_referrer() when appropiateMatthias Deiml2020-06-171-2/+2
|
* Make url for "client" referrer mandatoryMatthias Deiml2020-06-171-32/+32
|
* fix streaming request bodies, terminate fetch if the body stream errorsGregory Terzian2020-06-161-3/+4
|
* partially integrate streaming request bodies with http re-directGregory Terzian2020-06-041-5/+1
|
* integrate readablestream with fetch and blobGregory Terzian2020-06-041-4/+35
|
* check http_state in determine_request_referrerAlexandrov Sergey2020-05-191-1/+3
|
* add a core resource thread-poolGregory Terzian2020-02-141-8/+8
|
* Fix HSTSJan Andre Ikenmeyer2020-01-071-1/+1
|
* Let hyper automatically add a host header for HTTP/1Jan Andre Ikenmeyer2019-12-161-5/+0
|
* Limit referer header value length to 4096teapotd2019-10-241-1/+46
|
* Upgrade headers, headers-core, and hyper_serde.Josh Matthews2019-06-131-4/+4
|
* Implementing the builder pattern for RequestInitLucas Fantacuci2019-04-101-272/+238
|
* Rustfmt has changed its default style :/Simon Sapin2018-12-281-186/+144
|
* net: Suppress default ports in Origin header.Josh Matthews2018-12-171-7/+2
|
* refactored performance timing to align with updated specddh2018-11-201-16/+16
| | | | | | | | | | | | refactoring with ResourceFetchMetadata implemented deprecated window.timing functionality created ResourceTimingListener trait fixed w3c links in navigation timing updated include.ini to run resource timing tests on ci
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* Update crossbeam-channel to 0.3Bastien Orivel2018-11-181-5/+5
|