Commit graph

339 commits

Author SHA1 Message Date
ddh
e527c9a991 Update Hyper and OpenSSL 2017-03-31 16:32:21 +02:00
Anthony Ramine
f66cae3f96 Revert "Introduce create_ssl_context"
This reverts commit 7a4632bfa2.
2017-03-31 16:19:00 +02:00
bors-servo
0f9dbcc808 Auto merge of #16156 - ferjm:issue-16130-http-network-or-cache-fetch, r=jdm
Update http_network_or_cache_fetch according to spec

There are still many steps blocked by the absence of an HTTP cache and the inability to trigger a credentials dialog.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #16130

<!-- 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/16156)
<!-- Reviewable:end -->
2017-03-29 19:38:45 -05:00
Anthony Ramine
d022535f9c Make the WebSocket handshake ourselves to ease switching libs
We need to switch to tungstenite to finally update openssl, this commit
rewrites the whole websocket infrastructure to properly follow the Fetch
spec and to make switching to a different websocket library easier.
2017-03-29 19:17:27 +02:00
Anthony Ramine
3ed32f8078 Introduce NetworkError::from_hyper_error and from_ssl_error 2017-03-29 18:01:01 +02:00
Anthony Ramine
7a4632bfa2 Introduce create_ssl_context 2017-03-28 00:37:25 +02:00
Fernando Jiménez Moreno
d919f55884 Update http_network_or_cache_fetch according to spec 2017-03-27 19:45:05 +02:00
Anthony Ramine
e2e2d42e38 Introduce http_loader::is_redirect_status 2017-03-27 14:51:10 +02:00
Anthony Ramine
b096bf4806 Use Url::port instead of Url::port_or_known_default to set Host
AFAIK, if there is no explicit port in the request URL, there should be
no explicit port in the Host header.
2017-03-26 16:15:10 +02:00
Anthony Ramine
92c4a43946 Use NetworkConnector directly to account for replaced hosts
This let us remove a hack where we had to replace the host in the request URL.
2017-03-26 16:15:09 +02:00
Anthony Ramine
54d37d920c Remove some useless Option<T> wrappers from ServoUrl methods 2017-03-26 16:15:06 +02:00
Anthony Ramine
bc5c4fa892 Rework replace_hosts and host_replacement
They do less cloning now.
2017-03-26 16:14:22 +02:00
Fernando Jiménez Moreno
469eb192c5 Allow for redirects after a CORS-preflight 2017-03-10 16:39:33 +01:00
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