Commit graph

412 commits

Author SHA1 Message Date
Josh Matthews
2550600131 net: Use a POST request for allowing certs temporarily. 2020-06-09 16:51:21 -04:00
Josh Matthews
0ce2aa917a net: Pass certs that fail the SSL handshake out of the network layer. 2020-06-09 15:03:18 -04:00
Gregory Terzian
c1b76533fa partially integrate streaming request bodies with http re-direct 2020-06-04 11:38:38 +08:00
Gregory Terzian
3535dd7412 net: use an empty body for the null body case 2020-06-04 11:38:38 +08:00
Gregory Terzian
ca686313ee net: don't set content-length in obtain response 2020-06-04 11:38:37 +08:00
Gregory Terzian
bd5796c90b integrate readablestream with fetch and blob 2020-06-04 11:38:35 +08:00
Gregory Terzian
fa765168b9 net: shutdown async runtime on exit 2020-05-30 21:04:34 +08:00
Alexandrov Sergey
357b486455 make is_origin_trustworthy a method of ServoUrl + fix localhost handling 2020-05-19 20:06:59 +03:00
Alexandrov Sergey
a7c5c97616 check http_state in determine_request_referrer 2020-05-19 20:06:59 +03:00
bors-servo
66b81d51dc
Auto merge of #26430 - Eijebong:referrer-policy, r=jdm
Implement referrer policy

Fixes #26270
2020-05-12 17:37:53 -04:00
Bastien Orivel
8249be38c9 Implement cross origin resource policy check
I removed the window getter usage from those tests as servo does not
support that yet.
2020-05-08 19:15:24 +02:00
Josh Matthews
4a1732a761 Remove outdated HTTP redirection handling code. 2020-05-05 21:22:51 +02:00
Bastien Orivel
2b28042446 Fix a mistake in the redirect fetch code
The spec says to ignore both HEAD and GET in step 11
2020-05-05 20:43:56 +02:00
Bastien Orivel
566147dab3 Strip request-body-header when redirecting from a POST to GET
This doesn't change any expectation because we're not setting
response.redirected properly so all the tests fail later on when it's
asserted to be true.

Fixes #25257
2020-05-05 20:43:55 +02:00
Bastien Orivel
c14ab259d0 Implement referrer policy
Fixes #26270
2020-05-05 19:43:44 +02:00
Simon Sapin
1c0549ce7f Upgrade to rustc 1.44.0-nightly (42abbd887 2020-04-07) 2020-04-09 21:33:44 +02:00
Patrick Shaughnessy
fc13bd8b2f Cookie header values can be utf8 2020-01-28 12:47:18 -05:00
Patrick Shaughnessy
6d31827464 Cookies are now expired immediately before each lookup 2020-01-24 20:07:08 -05:00
bors-servo
e201b1688b
Auto merge of #25404 - Darkspirit:hsts, r=asajeffrey
Fix HSTS

The headers crate does not [expose](0c42ad8cf5/src/common/strict_transport_security.rs (L42)) HSTS struct fields. At the moment, it's only usable for HSTS header encoding. An update of the headers crate would require a huge update of http, hyper, hyper_serde, net::decoder as well. Therefore I've copied the `typed_get::<StrictTransportSecurity>` decoding feature  for now, but with exposed struct fields. Let's remove this custom struct with the next hyper upgrade. I tried to prevent needless HSTS database lookups when network.enforce_tls.enabled is set.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #14363, fix #20120.

- [x] There are tests for these changes
2020-01-08 13:20:09 -05:00
Jan Andre Ikenmeyer
68ebecb775
Fix HSTS 2020-01-07 16:07:12 +01:00
Simon Sapin
fdcc7653f2 Fix some warnings in future Rust nightlies 2020-01-02 19:22:03 +01:00
bors-servo
79408fa36b
Auto merge of #25294 - Darkspirit:h2, r=jdm
Let hyper automatically set the host header if needed

Google's gws web server did not expect to receive an unneeded Host header via HTTP/2, therefore it responded with 400 Bad Request over a working HTTP/2 connection.

https://tools.ietf.org/html/rfc7540#page-55
> Clients that generate HTTP/2 requests directly SHOULD use the ":authority" pseudo-header field instead of the Host header field.

It's hyper's job to take care of this for the HTTP/1 case, therefore we can remove old code.
When calling [Client::builder()](1974c875a1/components/net/connector.rs (L116-L119)) we do not disable hyper's default [set_host](4b6099c7aa/src/client/mod.rs (L1019-L1024)) config option, therefore hyper [automatically adds a Host header for non-HTTP/2 connections](4b6099c7aa/src/client/mod.rs (L289-L292))  based on the [URI](3f663d7ab2/components/net/http_loader.rs (L418-L421)).

r? @jdm

---
<!-- 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 #25286.
2019-12-17 18:16:13 -05:00
Patrick Shaughnessy
67827debd8 Now just one is_cors_safelisted_request_header, with closer spec alignment 2019-12-16 09:07:02 -05:00
Jan Andre Ikenmeyer
19226c5190
Let hyper automatically add a host header for HTTP/1 2019-12-16 14:01:18 +01:00
Jan Andre Ikenmeyer
b811be764c
Add ALPN and signature algorithms to OpenSSL config 2019-11-30 05:18:00 +01:00
Shinichi Morimoto
70c62ceee7 Fix check conditions 2019-11-05 11:24:38 +09:00
Shinichi Morimoto
b0a12f6a8a fix #24367 2019-11-05 11:24:38 +09:00
teapotd
c54df2b965 Limit referer header value length to 4096 2019-10-24 20:59:00 +02:00
Tommy Lincoln
fcad88cddd Add start_time to resource timing. 2019-10-20 07:28:11 -07:00
bors-servo
d28d9fe273
Auto merge of #23990 - tomasdivito:add-secure-connection-start, r=jdm
Add secure connection start

Implementing `secure_connection_start` as well as we can, this is related to #21268

We are setting the value as well as we can since we don't have a way to know if we are currently using a secure transport or where the handshake before the connection is done as the spec says on the step 15 [https://w3c.github.io/resource-timing/#sec-process](https://w3c.github.io/resource-timing/#sec-process)

Regarding the Timing Allow Check, that's being done on another PR by another person which will take care of setting the rest of the values on `PerformaceResourceTiming` to Zero and prevent them to set them any other way.

I'm currently setting the `secure_connection_time` using `precise_time_ms()` as the `connection_start` and `connection_end` are set that way... but other attributes inside `PerformanceResourceTiming` are set using `precise_time

Another thing, the issue talks about setting `redirect_start` but I'm not really sure if it's related, if so I can look up into that too... I might have just read and thought it was all about secure connection start.

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

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

<!-- 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/23990)
<!-- Reviewable:end -->
2019-10-10 22:16:27 -04:00
Tomas Di Vito
bd0c0b65ba implemented secure_connection_start 2019-10-10 14:30:03 -03:00
bors-servo
b34fc13eee
Auto merge of #24401 - gterzian:ensure_done_chan_is_none_when_revalidating, r=jdm
Fetch: ensure consistency between response, done-chan, and cache state.

This ensures that when a cached response is not used because it requires revalidation, the done chan is set back to `None`(since the cache might have set it to `Some` when constructing the response requiring revalidation).

<!-- 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: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #24399 (GitHub issue number if applicable)

<!-- 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. -->

<!-- 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/24401)
<!-- Reviewable:end -->
2019-10-09 10:53:17 -04:00
Gregory Terzian
bb1fa88864 fetch: ensure consistency between response, done-chan, and cache state. 2019-10-09 17:13:03 +08:00
CYBAI
f771e5f371 Use RequestBuilder for CORS preflight fetch 2019-10-09 12:23:43 +09:00
Gregory Terzian
4f3ba70704 http-cache: wait on pending stores
and various small improvements
2019-10-08 17:58:20 +08:00
Josh Matthews
a241232c2b Add useful debug output for HTTP response and image cache. 2019-10-04 15:08:40 -04:00
Javed Nissar
bb8166bb97 Add PerformanceResourceTiming: TimingAllowCheck
The purpose of this commit is to implement https://w3c.github.io/resource-timing/#dfn-timing-allow-check
2019-09-18 11:54:28 -04:00
Alan Jeffrey
aeac382058 Make http_loader more robust against hyperium parse errors 2019-09-10 16:13:50 -05:00
Thomas Delacour
18178fa107
ISSUE-21257: set redirectEnd on PerformanceResourceTiming 2019-07-19 21:36:24 +02:00
Kamil Niski
d84513cc50 Add PerformanceResourceTiming: domainLookupStart
Remove wpt tests for domainLookupStart

Set ResourceAttribute::DomainLookupTime

Move DomainLookupStart timing before HTTP request initialization

Change label of domainLookupStart TAO zero test to PASS

Adjust the from_resource_timing method to initialize domain_lookup_start value

Restore domainLookupsStart test
2019-06-30 00:20:26 +02:00
bors-servo
5592682c4b
Auto merge of #23494 - gterzian:improve_http_cache, r=jdm
Various improvements and update to the http cache

<!-- 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: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- 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. -->

<!-- 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/23494)
<!-- Reviewable:end -->
2019-06-22 11:36:14 -04:00
Simon Sapin
1d38bc0419 Fix some new warnings 2019-06-22 14:59:09 +02:00
Gregory Terzian
049817c5a7 http-cache: remove double-store of resources 2019-06-19 05:25:32 -07:00
Josh Matthews
b1510d9ad5 Upgrade headers, headers-core, and hyper_serde. 2019-06-13 11:08:16 -04:00
Tomek LECOCQ
a11684460d Add connectStart in PerformanceResourceTiming 2019-05-03 21:47:00 +02:00
bors-servo
b73956cc37
Auto merge of #23090 - miller-time:nav-fetch-referrer, r=gterzian
Add referrer to navigation fetch request

<!-- Please describe your changes on the following line: -->
Implement step 13 of [following hyperlinks](https://html.spec.whatwg.org/#following-hyperlinks-2) and step 14.3 of [window open](https://html.spec.whatwg.org/#window-open-steps), as well as other referrer- and fetch-related updates.

---
<!-- 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 #22890 (GitHub issue number if applicable)

<!-- 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. -->

<!-- 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/23090)
<!-- Reviewable:end -->
2019-04-25 20:21:23 -04:00
Thomas Delacour
fdbec9835c ISSUE-21263: implemented attribute setting in http loader 2019-04-23 12:33:28 -04:00
Russell Cousineau
f9c58ccd40 update HTTP-network-or-cache fetch per spec 2019-04-19 16:50:37 -07:00
pylbrecht
f478357567 Add connectEnd attribute to PerformanceResourceTiming interface 2019-04-04 07:19:25 +02:00
Josh Matthews
086d2f4c26
Avoid locking network timing data unnecessarily. 2019-02-01 15:47:14 -05:00