Commit graph

376 commits

Author SHA1 Message Date
rabisg
de2b9b7707 Fixes #14787: Set Origin header in http_network_or_cache_fetch
Sets Origin header on request with CORS flag set or on requests other
than those with GET/HEAD methods
2017-03-10 11:44:21 +05:30
Ms2ger
5a61d8b2ea Remove unused content blocker code.
I don't know what it is for, so I believe it would be better to remove it
entirely until and unless we start using it.
2017-03-07 10:29:27 +01:00
Connor Brewster
bfd7b950ad Add ImmutableOrigin to allow for serializing origins 2017-02-22 11:11:59 -06:00
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
Matt McCoy
09194a15ac Updating http_network_or_cache_fetch to better match the fetch API spec 2017-01-02 12:00:57 -05:00
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
Matt McCoy
ed075ab552 Reuse the http connector pool between fetches 2016-12-26 19:39:11 -05:00
Keith Yeung
63a7e8efdf Add domain and path checks for secure cookies eviction 2016-12-21 03:39:38 -08:00
Ms2ger
217f44b67a Make the fetch target non-optional. 2016-12-15 10:49:04 +01:00
Ms2ger
8a4a5c0cb5 Avoid unlocking the response body while it is in an inconsistent state. 2016-12-15 10:12:13 +01:00
Alan Jeffrey
9be4fd56ce Removed util. 2016-12-14 18:04:37 -06:00
bors-servo
882d5512bb Auto merge of #14508 - servo:determine_request_referrer, r=jdm,frewsxcv
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.

<!-- 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/14508)
<!-- Reviewable:end -->
2016-12-09 13:13:27 -08:00
bors-servo
da2f41ba13 Auto merge of #14502 - servo:filter-map, r=frewsxcv
Replace an unidiomatic use of filter_map().

<!-- 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/14502)
<!-- Reviewable:end -->
2016-12-08 15:12:42 -08:00
bors-servo
fffdcc1d7d Auto merge of #14501 - servo:LoadError, r=Manishearth
Remove LoadError.

<!-- 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/14501)
<!-- Reviewable:end -->
2016-12-08 14:22:17 -08:00
Ms2ger
fb456402b0 Replace an unidiomatic use of filter_map(). 2016-12-08 12:13:53 -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
87979ef65e Remove LoadError. 2016-12-08 10:25:23 -10:00
Ms2ger
3a27fda368 Stop handling a None referrer policy in determine_request_referrer(). 2016-12-08 09:39:41 -10:00
Raghav
c1518adba8 Redesign CookieStorage and Implement Leave Secure Cookie Alone
CookieStorage has been refactored to use HashMap with base domain as the
key. Values of hashmap is vector of cookies.
CookieStorage now has max_per_host which restricts maximum cookies that
can be added per base domain.
Cookie eviction doesnot take place if max_per_host is not reached.
Cookie eviction logic implemented here does following steps
1) Evict all expired cookies
2) Remove oldest accessed non-secure cookie If any
3) When no non-secure cookie exist, remove oldest accessed secure cookie
if new cookie being added is secure. Else ignore new cookie
2016-12-04 16:29:38 -05:00
Michael Mokrysz
52194c01d5 Made http_redirect_fetch error for non-HTTPS. #14069 2016-11-30 20:46:27 +00:00
Ms2ger
7192a747f2 Remove WrappedHttpRequest. 2016-11-24 16:14:54 +01:00
Ms2ger
04d5f6e7fa Inline WrappedHttpRequest::send(). 2016-11-24 14:00:44 +01:00
Ms2ger
53856bf312 Simplify obtain_response() a little. 2016-11-24 14:00:43 +01:00
Ms2ger
47fa025e89 Return an io::Result from StreamedResponse::from_http_response(). 2016-11-24 14:00:42 +01:00
Ms2ger
c20d647b61 Remove StreamedResponse::new(). 2016-11-24 14:00:41 +01:00
Ms2ger
4d9f9feb1c Remove StreamedResponse::metadata. 2016-11-24 14:00:40 +01:00
Ms2ger
d9947cdf7b Avoid some unnecessary Options in http_network_fetch. 2016-11-24 14:00:39 +01:00
Ms2ger
f24be9ad51 Remove the HttpResponse trait. 2016-11-24 14:00:38 +01:00
Ms2ger
87fd4a2d79 Remove the HttpRequest trait. 2016-11-24 14:00:37 +01:00
Ms2ger
fc6fa56af5 Remove the HttpRequestFactory trait. 2016-11-24 14:00:36 +01: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
74ea269fc3 Use url::Origin as UrlOrigin in http_loader. 2016-11-24 14:00:32 +01:00
Ms2ger
6219105eed Use more specific names for Hyper's Request/Response types in http_loader. 2016-11-24 14:00:31 +01:00
Ms2ger
5febfdc4d6 Remove unused UIProvider trait definition. 2016-11-24 11:46:29 +01:00
Ms2ger
ffc2e09ea7 Remove unused CancellationListener argument to obtain_response. 2016-11-24 11:46:26 +01:00
Ms2ger
fb1279ec3a Remove CoreResourceMsg::Load.
Also remove now-dead code that rustc warns about.

It turns out that we lost support for some of our custom URL schemes; I intend
to reimplement them, but I believe this will be significantly easier to do
once the legacy code is out of the way.
2016-11-24 11:46:24 +01:00
bors-servo
ac6a2681ae Auto merge of #14274 - stshine:servo-url-index, r=emilio
Implement range index with the Position enum on ServoUrl

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because refactoring

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

r? @emilio

<!-- 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/14274)
<!-- Reviewable:end -->
2016-11-20 12:35:14 -06:00
Anthony Ramine
7a8c5ae8e3 Use FnvHasher in http_loader::load
Should help with #11100.
2016-11-19 14:10:37 +01:00
Pu Xingyu
0818b44459 Implement range index with the Position enum on ServoUrl 2016-11-18 17:46:36 +08:00
Emilio Cobos Álvarez
913c874cb5
Urlmageddon: Use refcounted urls more often. 2016-11-17 18:34:23 +01:00
Ms2ger
56dd6417e6 Remove the network.http.redirection-limit preference.
The Fetch standard defines this value as twenty; there is no good reason to
allow changing that at runtime.
2016-11-14 14:44:08 +01:00
Ms2ger
783f754d09 Log debug messages when devtools is not notified about a HTTP request. 2016-11-08 14:49:45 +01: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
Raghav
e0e734fa7f Remove return and resolve merge conflicts
Since last execution statement is the value which is returned, return
keyword has been removed from method strict_origin and
strict_origin_when_cross_origin.

Merge conflicts in Cargo.lock has been handled
2016-11-04 13:27:08 -04:00
Raghav
26dac98546 Code review comments and upstream merge conflicts
Incorporated code review comments in components/net/http_loader.rs
Resolved merge conflicts in cargo.lock file. Updated ReferrerPolicy in
lib.rs
2016-11-04 11:18:22 -04:00
Ms2ger
277c6d0154 Move ReferrerPolicy to net_traits. 2016-11-04 10:43:37 +01:00
Raghav
c24aa56377 Network Security : Implement StrictOrigin and StrictOriginWhenCrossOrigin
Referer policy strict-origin and strict-origin-when-cross-origin changes have been implemented. Relevant unit test cases have been added. Enum for RefererPolicy has been added to hyper codebase and v 0.9.11 of hyper contains these changes.

This commit also contains changes related to upgrade of hyper from v0.9.10 to v0.9.11. Other dependencies changed are rayon, utils, num_cpus.
2016-11-04 03:17:04 -04:00
Alan Jeffrey
f3993d99b9 Lookup frames by frame_id, not pipeline_id. 2016-11-03 15:39:51 -05:00