Jeb Rosen
3a40d1071c
Remove 'rusted_cypher' integration from 'contrib'.
2020-07-21 10:54:07 -07:00
Jeb Rosen
62113abcd2
Upgrade 'redis' to 0.15 in 'contrib'.
2020-07-21 10:54:07 -07:00
Jeb Rosen
fbe6c1081f
Upgrade 'rusqlite' to 0.23 in 'contrib'.
2020-07-21 10:54:07 -07:00
Jeb Rosen
2879f44148
Upgrade 'mysql' to 18.0 in 'contrib'.
2020-07-21 10:54:07 -07:00
Jeb Rosen
7f276eb2fc
Update 'devise' to the latest commit.
2020-07-20 23:26:36 -07:00
Sergio Benitez
3f2b8f6006
Remove 'proc_macro' features.
2020-07-16 05:46:39 -07:00
Sergio Benitez
33e95f4900
Rename 'FromDataSimple' to 'FromData'. Make async.
...
The 'FromData' trait becomes 'FromTransformedData'.
2020-07-12 02:23:00 -07:00
Sergio Benitez
f4c82d7ffe
Remove unnecessary 'dev-dependencies'.
2020-07-11 11:27:23 -07:00
Sergio Benitez
62355b424f
Remove use of stable 'proc_macro_hygiene' feature.
2020-07-11 10:48:08 -07:00
Sergio Benitez
08b34e8263
Fix and re-enable UI tests.
2020-07-11 09:24:30 -07:00
Jeb Rosen
06975bfaea
Use the blocking testing API everywhere.
...
Co-authored-by: Sergio Benitez <sb@sergio.bz>
2020-07-11 09:24:30 -07:00
Sergio Benitez
03127f4dae
Add blocking variant of 'local'.
...
This commit adds the 'local::blocking' module and moves the existing
asynchronous testing to 'local::asynchronous'. It also includes several
changes to improve the local API, bringing it to parity (and beyond)
with master. These changes are:
* 'LocalRequest' implements 'Clone'.
* 'LocalResponse' doesn't implement 'DerefMut<Target=Response>'.
Instead, direct methods on the type, such as 'into_string()', can
be used to read the 'Response'.
* 'Response::body()' returns an '&ResponseBody' as opposed to '&mut
ResponseBody', which is returned by a new 'Response::body_mut()'.
* '&ResponseBody' implements 'known_size()` to retrieve a body's size,
if it is known.
Co-authored-by: Jeb Rosen <jeb@jebrosen.com>
2020-07-11 09:24:30 -07:00
Sergio Benitez
d89c7024ed
Replace 'Manifest' with 'Cargo'.
...
This is largely an internal change. Prior to this commit, the 'Manifest'
type, now replaced with the 'Cargo' type, robbed responsibility from the
core 'Rocket' type. This new construction restores the previous
responsibility and makes it clear that 'Cargo' is _only_ for freezing,
and representing the stability of, Rocket's internal state.
2020-07-11 09:24:30 -07:00
Sergio Benitez
1704ff7743
Asyncify 'Handler'. Rename 'ErrorHandlerFuture' to 'CatcherFuture'.
2020-07-11 09:24:30 -07:00
Sergio Benitez
f7cd455558
Make 'NamedFile' async. Fix 'Handler' trait.
...
Previously, 'NamedFile::open()' called a synchronous I/O method. This
commit changes it to instead use tokio's 'File' for async I/O.
To allow this to change, the 'Handler' trait was fixed to enforce that
the lifetime of '&self', the reference to the handler, outlives the
incoming request. As a result, futures returned from a handler can hold
a reference to 'self'.
2020-07-11 09:24:30 -07:00
Sergio Benitez
2465e2f136
Make 'Responder' trait sync; fix its lifetimes.
...
In summary, this commit modifies 'Responder' so that:
* ..it is no longer 'async'. To accommodate, the 'sized_body' methods
in 'Response' and 'ResponseBuilder' are no longer 'async' and accept
an optional size directly. If none is supplied, Rocket will attempt
to compute the size, by seeking, before writing out the response.
The 'Body' type was also changed to differentiate between its sized
'Seek' and chunked body variants.
* ..'&Request' gains a lifetime: 'r, and the returned 'Response' is
parameterized by a new 'o: 'r. This allows responders to return
references from the request or those that live longer.
2020-07-11 09:24:29 -07:00
Sergio Benitez
12308b403f
Add '#[rocket::launch]' attribute.
...
The attribute is applied everywhere it can be across the codebase and is
the newly preferred method for launching an application. This commit
also makes '#[rocket::main]` stricter by warning when it is applied to
functions other than 'main'.
2020-07-11 09:24:29 -07:00
Jeb Rosen
bc1b90cbdb
Add '#[rocket::main]' attribute and make 'launch()' an 'async fn'.
...
'#[rocket::main]' works like '#[rocket::async_test]', but it uses
tokio's multithreaded scheduler.
2020-07-11 09:24:29 -07:00
Jeb Rosen
e72058de81
Add 'config()' and 'state()' functions directly to 'Rocket' for convenience.
2020-07-11 09:24:29 -07:00
Jeb Rosen
b0238e5110
Make 'Fairing::on_attach()' async.
...
This transitively requires that 'Rocket::inspect()', 'Client::new()',
and 'Client::untracked()' also become async.
2020-07-11 09:24:29 -07:00
Jeb Rosen
dea940c7a8
Defer execution of operations on 'Rocket' until their effects will be
...
observed.
This is a prerequisite for async on_attach fairings. 'Rocket' is now a
builder wrapper around the 'Manifest' type, with operations being
applied when needed by 'launch()', 'Client::new()', or 'inspect()'.
'inspect()' returns an '&Manifest', which now provides the methods that
could be called on an '&Rocket'.
2020-07-11 09:24:29 -07:00
Jeb Rosen
3796673740
Update UI tests for latest nightly.
2020-07-11 09:24:29 -07:00
Sergio Benitez
98a90808b4
Fix an array of broken doc links.
2020-07-11 09:24:29 -07:00
Sergio Benitez
c0c6c79a7f
Use 'async_trait' for 'Responder'.
...
Also:
* Remove 'response::ResultFuture'.
* Re-export 'tokio' and 'futures' from the crate root.
* Make 'ResponseBuilder::sized_body()' and 'async fn'.
* Remove the 'Future' implementation for 'ResponseBuilder'.
* Add 'ResponseBuilder::finalize()' for finalizing the builder.
2020-07-11 09:24:29 -07:00
Sergio Benitez
431b963774
Use 'async_trait' for 'FromRequest'.
...
Removes 'FromRequestAsync'.
2020-07-11 09:24:29 -07:00
Sergio Benitez
48c333721c
Use 'async_trait' for 'Fairing' trait.
...
Also re-exports the 'async_trait' attribute from 'rocket'.
2020-07-11 09:24:29 -07:00
Sergio Benitez
a4e7972b4b
Remove unnecessary 'extern crate's.
2020-07-11 09:24:29 -07:00
Jeb Rosen
4bb4c61528
Allow implementations of on_request fairings to return a Future that borrows from self, request, and data.
2020-07-11 09:24:29 -07:00
Jeb Rosen
cc3298c3e4
Allow implementations of FromData to return a Future that borrows from the request.
2020-07-11 09:24:29 -07:00
Jeb Rosen
468f4d9314
Simplify FromRequestAsync trait definition.
2020-07-11 09:24:29 -07:00
Paolo Barbolini
003bf77c29
Upgrade to tokio 0.2.0.
...
* Update 'tokio', 'tokio-rustls', and 'hyper'.
* Remove unused dependencies on some `futures-*` crates.
* Rework 'spawn_on', which is now 'serve'.
* Simplify Ctrl-C handling.
2020-07-11 09:24:29 -07:00
Jeb Rosen
6321797a74
Update compile error tests for databases.
2020-07-11 09:24:29 -07:00
Jeb Rosen
0ab787e216
Use 'tokio_executor::blocking' when acquiring connections from synchronous database pools to avoid tying up the executor.
2020-07-11 09:24:29 -07:00
Jeb Rosen
ea06878581
Update 'hyper', 'futures-*-preview', and 'tokio-*' dependencies.
...
Use I/O traits and types from 'tokio-io' as much as possible.
A few adapters only exist in futures-io-preview and use
futures-tokio-compat as a bridge for now.
2020-07-11 09:24:29 -07:00
Jeb Rosen
76ef92a2e1
Use a tokio timer instead of std: 🧵 :sleep in template reload test.
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
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
e44c5896b8
Remove stabilized 'async_await' feature gate and update the minimum nightly version.
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
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
Jeb Rosen
633e495a6b
Update many doc tests in 'core' for async.
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
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
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
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
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
6a1e4c668c
Improve docs for 'Options::NormalizeDirs'.
2020-05-30 01:40:44 -07:00
Sergio Benitez
c3187bfe91
Add 'Options::NormalizeDirs' to 'StaticFiles'.
...
Closes #1198 .
Co-authored-by: Keith Wansbrough <keithw@lochan.org>
2020-05-29 17:49:37 -07:00
Sergio Benitez
06e146e7d1
Update 'time' to 0.2 in 'contrib'.
2020-03-25 14:39:55 -07:00
Sergio Benitez
53353df633
Fix more broken links.
2020-03-09 02:03:38 -07:00
Sergio Benitez
ee1a9903b6
Update UI tests for latest nightly.
2020-02-15 03:51:56 -08:00
Jeb Rosen
31712018bb
Update versions and links for updated dependencies.
2020-01-20 14:51:00 -08:00
Jeb Rosen
4151cd46db
Remove [target.'cfg(debug_assertions)'.dependencies] in contrib Cargo.toml.
...
This is not supported and is the same as putting the contents in
[dependencies] anyway. It became a warning in rust-lang/cargo#7660 .
2020-01-19 12:45:08 -08:00
Razican
f4bb8bb511
Update depedencies:
...
* contrib: 'rmp-serde', 'tera', 'memcache', 'mysql', 'postgres', 'redis'.
* examples: 'parking-lot', 'rand'
2020-01-19 11:01:11 -08:00
Jeb Rosen
ff2000293c
Update 'compiletest' and fix and re-enable compile UI tests.
2020-01-15 17:09:57 -08:00
Paolo Barbolini
cd5f96ae15
Update 'uuid', 'unicode-xid', and 'base64' dependencies.
2019-11-30 09:33:14 -08:00
Jeb Rosen
343f51d550
Disable UI tests for now.
2019-11-29 11:18:26 -08:00
Jeb Rosen
22442313a7
Extend 'Engines' example to illustrate its proper use.
2019-11-16 13:15:47 -08:00
adrian5
3a1f012b56
Fix typo in databases documentation: extraneous word 'database'.
2019-11-03 10:06:45 -08:00
Jacob Pratt
4e6a7ddd5f
Remove use of the 'crate_visibility_modifier' feature.
...
Most items with 'crate' visibility become 'pub(crate)'.
Items are made 'pub' instead when they would remain private.
2019-09-21 09:16:04 -07:00
Sergio Benitez
777d01fa87
Remove unused features in contrib codegen.
2019-09-18 19:34:03 -07:00
Jacob Pratt
e3c1a4ad3a
Remove use of the 'try_trait' feature.
...
Add the 'try_outcome' macro to replace uses of '?' on 'Outcome'.
2019-09-18 18:43:16 -07:00
Sergio Benitez
0b059e06e5
Update 'devise' to 0.3.
...
This transitively updates 'syn', 'proc-macro2', and 'quote' to 1.0.
2019-09-05 15:44:25 -07:00
Jacob Pratt
2dd09f90be
Remove unused 'doc_cfg' feature.
2019-08-06 14:01:35 -07:00
Sergio Benitez
b8ab9e5b23
Add template engine versions to docs.
2019-07-19 13:35:29 -07:00
Ning Sun
93c979eb43
Update 'handlebars' to 2.0.
2019-07-19 13:34:38 -07:00
Jeb Rosen
3e4f8453ce
Remove use of the 'decl_macro' feature.
...
Also removes one internal use in the 'typed-uris' codegen test.
2019-07-19 11:39:56 -07:00
Jacob Pratt
34a741a26e
Remove use of '!' type in favor of 'Infallible'.
...
This removes the use of and dependence on the 'never_type' feature.
2019-07-09 15:10:51 -07:00
Sergio Benitez
21b10176ee
Forward from 'StaticFiles' if a file is not found.
...
Also adds a 'handler::Outcome::from_or_forward' method for easily
constructing handler outcomes that forward on responder failures.
Fixes #1036 .
2019-07-07 23:22:38 -07:00
Sergio Benitez
7f2c9f426c
Fix tests for Windows.
2019-07-06 00:59:01 -07:00
Sergio Benitez
1f9020d26f
Fix link to 'Rustqlite' in databases docs.
2019-06-28 17:38:08 -07:00
Jeb Rosen
fc78eaf836
Document contrib database library versions.
...
This commit also adds a note to the contrib database documentation
describing how to enable features in upstream database crates.
2019-06-26 09:11:27 -04:00
Jeb Rosen
2315171971
Migrate contrib to Rust 2018.
2019-06-25 11:30:39 -07:00
Sergio Benitez
e458df094f
Update 'version_check' to 0.9.
2019-05-24 01:48:42 -07:00
Sergio Benitez
8434a98d5c
Set Content-Type on 'MsgPack' responses.
...
Fixes #1009 .
2019-05-23 17:18:17 -07:00
Sergio Benitez
1e611ff86e
Set 'StaticFiles' rank with method, not bit-flags.
2019-05-17 10:25:55 -07:00
Sergio Benitez
dbcb0a75b9
Allow setting a custom rank on 'StaticFiles'.
...
Resolves #965 .
2019-05-16 16:54:35 -07:00
Sergio Benitez
59d8cfab7f
Update 'glob' dependency to 0.3.
2019-05-16 13:50:54 -07:00
Sergio Benitez
5334f17ea9
Enable 'compression' test dependencies conditionally.
2019-05-16 13:50:54 -07:00
Jeb Rosen
273c7a607d
Update 'mysql' to 16.0, 'redis' to 0.10.
2019-05-16 13:50:54 -07:00
Leonora Tindall
c6c0b3a6e1
Update 'rusqlite' dependency to 0.16.
2019-05-16 13:50:54 -07:00
Adam
fd05f998ab
Implement 'FromIterator' for 'JsonValue'.
2019-05-14 22:25:49 -07:00
Sergio Benitez
1caf87eb21
Move to 0.5.0-dev on master.
2019-05-13 16:18:48 -07:00
Unknown
aa154be51d
Fix missing '```' at end of template example code.
2019-05-04 09:07:10 -07:00
Jeb Rosen
0666e425fe
Add a few missing pieces of 'compression' documentation.
2019-05-04 08:38:11 -07:00
Jeb Rosen
0a3960b031
Clean up 'compression' module and documentation.
2019-04-27 08:54:21 -07:00
Martin1887
6a55aa7253
Add 'compression' contrib module.
2019-04-27 08:42:00 -07:00
Blake Smith
fcd64342fd
Fix typo in 'databases' documentation: 'pg_db' -> 'my_db'.
2019-03-13 06:32:28 -07:00
Peter Farr
622f4f399c
Flesh out database examples in the API documentation:
...
* Demonstrate multiple databases in ROCKET_DATABASES environment variable.
* Add a second example of connection guard type creation.
2019-03-13 06:30:31 -07:00
Sergio Benitez
d8ada552c9
Remove duplicate 'use' in 'helmet' tests.
2019-02-06 19:40:26 -08:00
jeb
90296dde80
Change `rocket_contrib` to not depend on default features from `rocket`.
2019-01-31 20:25:44 -08:00
An Long
5ce43ed4e9
Add support for memcache connection pooling in 'rocket_contrib'.
2019-01-13 11:16:11 -08:00
Austin Hartzheim
a88bc95201
Specify 'rocket_contrib' version correctly in doc examples.
2019-01-12 14:54:22 -08:00
Eric Dattore
aba3ad327b
Add database pool integration tests.
2018-12-23 21:12:44 -08:00
Sergio Benitez
3f58ea692f
Add compile tests to contrib codegen.
2018-12-23 21:08:07 -08:00
Eric Dattore
7dd0c8fd02
Implement 'DerefMut' for database pools.
...
This commit also fixes database pool codegen amidst of generics.
Fixes #854 .
Resolves #862 .
2018-12-23 21:06:45 -08:00