Jeb Rosen
0d6e46944b
Use tokio's current_thread runtime for async_test to increase performance.
2020-07-11 09:24:28 -07:00
Jacob Pratt
c7ecfc69c3
Use 'futures::future::BoxFuture' instead of 'Pin<Box<...>>' for readability.
2020-07-11 09:24:28 -07:00
Jacob Pratt
bd929ef617
Remove unnecessary boxing of some Futures.
2020-07-11 09:24:28 -07:00
Jacob Pratt
1f90a9b6d1
Update hyper to '=0.13.0-alpha.1'.
2020-07-11 09:24:28 -07:00
Jeb Rosen
baa2ed27f3
Update UI tests affected by removal of typed headers.
2020-07-11 09:24:28 -07:00
Jeb Rosen
facc00454c
Re-enable the entire test suite:
...
* Disable compression tests
* Finish migrating all other examples and tests
2020-07-11 09:24:28 -07:00
Jeb Rosen
047b1620f9
Update pinned hyper and tokio versions.
2020-07-11 09:24:28 -07:00
Jacob Pratt
05426881b0
Use 'File' from 'async_std' instead of from 'tokio'.
...
Additionally pin tokio to '=0.2.0-alpha.2'; before this change cargo
selects '0.2.0-alpha.3' which hyper does not compile against.
2020-07-11 09:24:28 -07:00
Jeb Rosen
1f0577bfc5
Update remaining examples for async.
2020-07-11 09:24:28 -07:00
Jeb Rosen
560f0977d3
Revamp testing system for async.
...
* body_string_wait and body_bytes_wait are removed; use `.await` instead
* `dispatch()` is now an async fn and must be .await-ed
* Add `#[rocket::async_test]` macro, similar in purpose to `tokio::test`
* Tests now use either `rocket::async_test(async { })` or
`#[rocket::async_test]` in order to `.await` the futures returned
from `dispatch()` and `body_{string,bytes}()`
* Update 'test.sh' to reflect the tests that should be passing.
Broken:
* Cloned dispatch and mut_dispatch() with a live previous response now both fail, due to a (partial) check for mutable aliasing in LocalRequest.
* Some tests are still failing and need example-specific changes.
2020-07-11 09:24:28 -07:00
Jacob Pratt
a87e1577aa
Add 'Rocket::spawn_on' to spawn a server on a user-provided (tokio) runtime.
2020-07-11 09:24:28 -07:00
Jacob Pratt
e44c5896b8
Remove stabilized 'async_await' feature gate and update the minimum nightly version.
2020-07-11 09:24:28 -07:00
Jeb Rosen
af95129590
Use futures 0.3-compatible hyper and tokio and the tokio runtime instead
...
of futures-rs executor.
Despite this change, using body_bytes_wait on (for example) a File will
still fail due to tokio-rs/tokio#1356 .
2020-07-11 09:24:28 -07:00
Jeb Rosen
8c8598b4fd
Fix 'static_files' and 'serve' tests.
2020-07-11 09:24:28 -07:00
Jeb Rosen
b780f9d8e0
Fix or ignore remaining doc tests in 'core'.
...
This adds an unstable "async_test" function for use in tests, to ensure
they stay working while refactoring other APIs.
2020-07-11 09:24:28 -07:00
Jeb Rosen
aee7f35095
Use read_to_string (from futures-preview 0.3.0-alpha.18) to more closely match the pre-async code.
2020-07-11 09:24:28 -07:00
Jacob Pratt
0e6841da66
Convert two internal functions returning `Pin<Box<_>>` to `async fn`.
2020-07-11 09:24:28 -07:00
Jeb Rosen
b56e889a0e
Disable some known-failing tests for now.
2020-07-11 09:24:28 -07:00
Jeb Rosen
633e495a6b
Update many doc tests in 'core' for async.
2020-07-11 09:24:28 -07:00
Jeb Rosen
1601e5c814
Fix a few 'unused use' warnings.
2020-07-11 09:24:28 -07:00
Jeb Rosen
094146b929
Update 'fairings' example for async.
2020-07-11 09:24:28 -07:00
Jeb Rosen
bc404f1f6d
Use 'body_string_wait' in all example tests.
2020-07-11 09:24:28 -07:00
Redrield
5e578e9c3b
Upgrade 'msgpack' for async in contrib and examples.
2020-07-11 09:24:28 -07:00
Jeb Rosen
6044961680
Update parts of contrib and associated tests and examples:
...
* json
* templates
* helmet
* databases
* serve
* examples/cookies
* examples/handlebars_templates
* examples/json
* examples/session
* examples/static_files
* examples/tera_templates
2020-07-11 09:24:28 -07:00
Jeb Rosen
7c34a3a93e
Make 'Fairing::on_response' and 'Responder::respond_to' async.
...
This is required to be able to do anything useful with the body in the
outgoing response. Request fairings do not appear to need to be async
as everything on Data that returns a future moves self and on_request only
gets &Data, but the same change in this commit should work for on_request
if desired.
2020-07-11 09:24:28 -07:00
Jeb Rosen
5d439bafc0
Convert core to async and add support for async routes.
...
Minimum rustc bump required for rust-lang/rust#61775
2020-07-11 09:24:28 -07:00
Marc Schreiber
96b4142156
Upgrade to hyper 0.12.
...
* Use hyper's 'MakeService' implementation with futures API.
* Use tokio runtime to serve HTTP backend.
2020-07-11 09:24:03 -07:00
Sergio Benitez
263e39b5b4
Always override config defaults with env vars.
...
Fixes a regression introduced in f7b1089
.
2020-07-08 19:39:28 -07:00
arctic-alpaca
1e623c8aaa
Fix invalid JSON data in a guide example.
2020-06-28 10:35:15 -07:00
gcarq
86d0bdddb2
Replace manual ASCII checks with 'std::char' calls.
2020-06-22 05:07:14 -07:00
Sergio Benitez
83925bbae1
Use clearer variables names in guide test macro.
...
Also removes latent, unnecessary 'guide' test.
2020-06-14 18:56:45 -07:00
Sergio Benitez
336353ced6
Foreshadow routing and catcher options in overview.
...
Resolves #1206 .
Co-authored-by: Jeb Rosen <jeb@jebrosen.com>
2020-06-11 20:42:32 -07:00
Sergio Benitez
74f15a7ab5
Use top-level doc image URLs.
2020-06-11 02:30:14 -07:00
Sergio Benitez
63a4ae0485
Silence warnings on 'extern crate proc_macro'.
2020-06-08 12:25:10 -07:00
Sergio Benitez
e1a3d2b6e8
Fix minor formatting issues in 'todo' example.
2020-06-08 12:18:34 -07:00
Sergio Benitez
a4f5be93ef
Clean up todo example.
2020-06-08 12:12:02 -07:00
Cedric Hutchings
da34b66eb4
Use 'Result's instead of 'bool's in todo example.
2020-06-08 12:11:41 -07:00
Ning Sun
bbad427079
Update 'handlebars' to 3.0.
2020-06-08 11:41:01 -07:00
Jeb Rosen
c19365dcbe
Make 'notify' an optional dependency.
...
It is now required only when the 'templates' feature is active.
2020-06-07 04:02:35 -07:00
Sergio Benitez
55d2b2bfb6
Properly mock 'Key::try_generate()'.
2020-06-07 04:02:35 -07:00
Sergio Benitez
f7b1089b49
Allow setting config path via 'ROCKET_CONFIG_FILE'.
2020-06-07 03:46:43 -07:00
Sergio Benitez
a4301c0a9a
Add 'Config::read()' and 'Config::read_from()'.
...
The former method allows constructing a 'Config' in the exact manner
Rocket does internally: reading the active environment's properties from
'Rocket.toml' and overriding values from environment variables. The
'read_from()' property does the same except it allows a custom config
file path.
This PR also improves the internal structure of the configuration code.
2020-06-07 02:42:15 -07:00
Sergio Benitez
ea9865ec42
Allow multiple versions of 'rustls' and 'ring'.
...
Co-authored-by: TotalKrill <kristoffer.odmark90@gmail.com>
2020-06-04 18:59:11 -07:00
Sergio Benitez
3c47fa895a
Enable minimal set of 'cookie' features.
2020-06-04 18:54:23 -07:00
Jeb Rosen
91fb0804be
Hide docs for more generated items.
2020-06-04 18:01:20 -07:00
Lionel G
b38753eaf8
Add 'X-DNS-Prefetch-Control' header to helmet.
...
Co-authored-by: Sergio Benitez <sb@sergio.bz>
2020-06-04 17:54:28 -07:00
Sergio Benitez
ac4cca7b0a
Update copyright in LICENSE files.
...
Resolves #1290 .
2020-06-03 23:02:05 -07:00
Sergio Benitez
3f20e4ac93
Use proper SPDX license expression in 'Cargo.toml'.
2020-06-03 23:02:05 -07:00
Jeb Rosen
097fbd7df0
Fix some broken links in API documentation.
2020-05-31 11:32:14 -07:00
Sergio Benitez
6844a189d7
Update CHANGELOG for 0.4.5.
2020-05-30 14:55:03 -07:00