diff options
author | bors-servo <infra@servo.org> | 2023-05-18 10:45:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-18 10:45:00 +0200 |
commit | 918557ad6d04cd2bd73516e9ccb9019bdaa53500 (patch) | |
tree | 340f02256191bbbbb592bfe257f2acfe3dc4b984 /components/net_traits/request.rs | |
parent | c7f8a6ecb5e55db86b0524bf7bcbe7cd842b1e9f (diff) | |
parent | ed239931bb476af4fac5b8649ca2ef40ca1bc0eb (diff) | |
download | servo-918557ad6d04cd2bd73516e9ccb9019bdaa53500.tar.gz servo-918557ad6d04cd2bd73516e9ccb9019bdaa53500.zip |
Auto merge of #29752 - mrobinson:fix-29741-by-extending-request-builder, r=mukilan
Fix 29741 by extending request builder
Extend RequestBuilder to include ResponseTainting and used said functionality to set response_tainting to `::CorsTainting` in `cors_preflight_fetch()`.
---
<!-- 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 #29741
<!-- 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. -->
Diffstat (limited to 'components/net_traits/request.rs')
-rw-r--r-- | components/net_traits/request.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/components/net_traits/request.rs b/components/net_traits/request.rs index 443f4c57dab..c1852e48843 100644 --- a/components/net_traits/request.rs +++ b/components/net_traits/request.rs @@ -93,7 +93,7 @@ pub enum RedirectMode { } /// [Response tainting](https://fetch.spec.whatwg.org/#concept-request-response-tainting) -#[derive(Clone, Copy, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)] pub enum ResponseTainting { Basic, CorsTainting, @@ -253,6 +253,7 @@ pub struct RequestBuilder { pub parser_metadata: ParserMetadata, pub initiator: Initiator, pub https_state: HttpsState, + pub response_tainting: ResponseTainting, } impl RequestBuilder { @@ -282,6 +283,7 @@ impl RequestBuilder { initiator: Initiator::None, csp_list: None, https_state: HttpsState::None, + response_tainting: ResponseTainting::Basic, } } @@ -375,6 +377,11 @@ impl RequestBuilder { self } + pub fn response_tainting(mut self, response_tainting: ResponseTainting) -> RequestBuilder { + self.response_tainting = response_tainting; + self + } + pub fn build(self) -> Request { let mut request = Request::new( self.url.clone(), @@ -407,6 +414,7 @@ impl RequestBuilder { request.integrity_metadata = self.integrity_metadata; request.parser_metadata = self.parser_metadata; request.csp_list = self.csp_list; + request.response_tainting = self.response_tainting; request } } |