Commit graph

89 commits

Author SHA1 Message Date
mrnayak
a3026499f4 Implement Subresource Integrity
Implemented response validation part of
https://w3c.github.io/webappsec-subresource-integrity/.
Implemented step eighteen of the main fetch. If a request has integrity
metadata, then following steps are performed
*Wait for response body
*If the response does not have a termination reason and response does not
match request’s integrity metadata, set response to a
network error.# Please enter the commit message for your changes. Lines starting
2017-01-08 08:52:18 +05:30
Raghav
6020b4c15c Implement HSTS fetch step
Implemented step nine of the main fetch. If current URL scheme is 'HTTP'
and current URL's host is domain and if current URL's host matched with
Known
HSTS Host Domain Name Matching results in either a superdomain match with
an asserted includeSubDomains directive or a congruent match then we
change request scheme to 'https'. This change has been made in method.rs

A test case to validate this has been added in fetch.rs. For asserting
https scheme, a https localhost was required. For this purpose I have
created a self-signed certificate and refactored fetch-context and
connector.rs to programmatically trust this certificate for running this
test case.
2016-12-29 12:55:31 +05:30
Nick Price
a56a7baa9a Implement port-based blocking 2016-12-21 09:43:39 -05:00
Ms2ger
1e0ab08c42 Stop returning the response from fetch(). 2016-12-15 10:50:15 +01:00
Ms2ger
217f44b67a Make the fetch target non-optional. 2016-12-15 10:49:04 +01:00
Ms2ger
1222db62aa Remove Request::done.
It does not appear to be used at all.
2016-12-09 12:36:46 -10:00
Ms2ger
12aa4694cb Rewrite determine_request_referrer() to explicitly limit it to the checks it can do.
Checks for the Client value should reside in the script thread.

I also noted some other issues in this code.
2016-12-08 12:05:44 -10:00
Ms2ger
3a27fda368 Stop handling a None referrer policy in determine_request_referrer(). 2016-12-08 09:39:41 -10:00
Ms2ger
38db554b5e Move the http-specific fetch code to http_loader. 2016-11-24 14:00:35 +01:00
Ms2ger
675d8f518c Unify ReadResult and Data. 2016-11-24 14:00:34 +01:00
Ms2ger
ffc2e09ea7 Remove unused CancellationListener argument to obtain_response. 2016-11-24 11:46:26 +01:00
Ms2ger
ae1340bf50 Pass the UIProvider to FileManager::handle() as needed. 2016-11-21 10:37:26 +01:00
Emilio Cobos Álvarez
913c874cb5
Urlmageddon: Use refcounted urls more often. 2016-11-17 18:34:23 +01:00
bors-servo
e3f07dfa16 Auto merge of #14156 - frewsxcv:cors-capitalization, r=KiChjang
Update CORS naming from 'CORS' to 'Cors'.

As per:

https://aturon.github.io/style/naming/README.html#general-conventions-[rfc-#430]

Acronyms should be considered one word and not all caps.

<!-- Reviewable:start -->

---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14156)
<!-- Reviewable:end -->
2016-11-10 14:43:36 -06:00
Ms2ger
15b55c3231 Make Response::url private. 2016-11-10 13:18:43 +01:00
Ms2ger
c1e1695f66 Pass the URL to Response::new(). 2016-11-10 13:17:02 +01:00
Corey Farwell
bf8752ac9e Update CORS naming from 'CORS' to 'Cors'.
As per:

https://aturon.github.io/style/naming/README.html#general-conventions-[rfc-#430]

Acronyms should be considered one word and not all caps.
2016-11-09 18:30:30 -05:00
Ms2ger
234b47e33e Pass a borrowed fetch context to fetch().
This will allow inspecting its state after fetching in unit tests.
2016-11-08 18:01:23 +01:00
bors-servo
32a953f0ba Auto merge of #14106 - servo:deindent-http-network-fetch, r=nox
Deindent some of the code in http_network_fetch.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14106)
<!-- Reviewable:end -->
2016-11-08 00:03:24 -06:00
bors-servo
4a7ea72429 Auto merge of #14114 - servo:fetch-unit-http, r=jdm
Start using fetch for the HTTP unit tests.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14114)
<!-- Reviewable:end -->
2016-11-07 22:04:27 -06:00
Ms2ger
d777016b3a Use set_default_accept_language in fetch_with_cors_cache. 2016-11-07 19:42:16 +01:00
Ms2ger
14bd876400 Stop creating an unused Response in the error case. 2016-11-07 09:47:27 +01:00
Ms2ger
40c6b21fd7 Deindent some of the code in http_network_fetch. 2016-11-07 09:47:26 +01:00
Ms2ger
621d018dbd Stop unnecessarily wrapping the response argument to http_redirect_fetch in Rc. 2016-11-07 09:37:21 +01:00
Ms2ger
277c6d0154 Move ReferrerPolicy to net_traits. 2016-11-04 10:43:37 +01:00
Ms2ger
479cf1ef23 Stop panicking when trying to load ftp URLs. 2016-11-02 16:15:26 +01:00
Ms2ger
b9ad395a61 Set cookies in http_network_fetch. 2016-11-02 09:25:55 +01:00
Ms2ger
f34534740a Pass the entire FetchContext to http_network_fetch. 2016-11-02 09:20:31 +01:00
Ms2ger
28d06ab40a Store the referrer in the Response and return it in Response::metadata(). 2016-11-02 09:20:30 +01:00
Ms2ger
a66f186866 Return a network error Response from http_network_fetch when obtain_response fails. 2016-11-02 09:20:29 +01:00
Ms2ger
784c45a306 Store the NetworkError in network error Responses. 2016-11-02 09:20:28 +01:00
Ms2ger
6af63d6af1 Make the status handling in http_fetch more robust. 2016-11-02 09:20:27 +01:00
Ms2ger
e134871a95 Implement blob url support in the fetch stack. 2016-10-14 14:18:03 +02:00
Ms2ger
fc68e0a6ca Add a FileManager to FetchContext. 2016-10-14 11:30:09 +02:00
Corey Farwell
60afad1b61 Migrate user agent string to Cow<'static, str>.
In most scenarios, where the user of Servo will not override the default
user agent, the user agent can be a `&'static str`. But since we allow
for customization, we currently use a `String` to represent the user
agent. This commit migrates the user agent to be represented as a
`Cow<'static, str>`, which (at the cost of ergonomics) prevents
unnecessary allocations whenever cloning the user agent string in the
scenario the user doesn't override the user agent.
2016-10-10 16:34:20 -04:00
Jan Zerebecki
95a7482d26 Remove same-origin-data-url flag from fetch implementation
The spec removed it. Check the scheme instead, data is always same origin now,
except for workers.
This also updates the comments to make step numbers match the spec.
Closes #13362
2016-10-01 00:27:03 -07:00
Ms2ger
ccfd977076 Avoid a possible deadlock in main_fetch's synchronous code.
On playpen, similar code caused a deadlock on 1.11 stable, and worked fine
on nightly 1.13; it seems safer to avoid the pattern entirely.
2016-09-23 09:36:02 +02:00
Keith Yeung
6fbd2aa5b7 Avoid deadlock in main_fetch 2016-09-21 14:26:09 -07:00
Keith Yeung
07c9cfecec Add FetchMetadata and update corresponding methods 2016-09-21 14:26:03 -07:00
bors-servo
8ccfffaa77 Auto merge of #13294 - 6112:referrer-typo-fix, r=jdm
Fix most typoes for: "referer" -> "referrer"

Replace most uses of the word "referer" with "referrer", except for `hyper::header::Referer`. Also update the unit tests to compile & pass after those changes.

---
<!-- 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 #13286

<!-- Either: -->
- [ ]  There are tests for these changes OR
- [X] These changes do not require tests because they're only typo fixes.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13294)
<!-- Reviewable:end -->
2016-09-16 15:43:54 -05:00
Nicolas
924136ee0c Fix most typoes for: "referer" -> "referrer" 2016-09-16 12:40:17 -04:00
Bryan Gilbert
82e45a403f updated basic auth cache to key off of url origin 2016-09-15 22:08:52 -04:00
Malisa Smith
faf32a7cfb dom::Response implementation 2016-09-06 19:58:32 -07:00
bors-servo
f66382f75c Auto merge of #13071 - wdv4758h:cors_preflight_fetch, r=jdm
Solved wrong referrer policy in cors_preflight_fetch

Solved wrong referrer policy in cors_preflight_fetch

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13026
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13071)
<!-- Reviewable:end -->
2016-08-27 05:20:46 -05:00
Chiu-Hsiang Hsu
3c93ced76a Solved wrong referrer policy in cors_preflight_fetch 2016-08-27 16:02:23 +08:00
hsinewu
1db1a7671e pass request value instead of constant 2016-08-27 12:03:49 +08:00
Anthony Ramine
6cc862d0c6 Lessen pressure on the thread-local RNG
When loading HTTP requests, initialise the request ID only if devtools
are used, to lessen the pressure put on the RNG initialisation.

This tentatively fixes #11100 on OS X.
2016-08-16 10:12:33 +02:00
Anthony Ramine
7ad51dcd7a Update serde to 0.8 (fixes #12659) 2016-08-12 18:37:27 +02:00
ddh
db808ca75d Added devtools support to fetch for XHR + Manish's XHR ident fix
added unit test for request fetch with devtools

added devtools/fetch test
2016-07-29 11:20:38 +01:00
Aravind Gollakota
bfda32ea00 msg: Rename ReferrerPolicy::NoRefWhenDowngrade NoReferrerWhenDowngrade
This is more consistent with the other variants.
2016-07-15 08:13:57 -07:00