Commit Graph

42 Commits

Author SHA1 Message Date
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
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 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 633e495a6b Update many doc tests in 'core' for async. 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
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 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
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
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
Jeb Rosen 2315171971 Migrate contrib to Rust 2018. 2019-06-25 11:30:39 -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 5334f17ea9 Enable 'compression' test dependencies conditionally. 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
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
Sergio Benitez d8ada552c9 Remove duplicate 'use' in 'helmet' tests. 2019-02-06 19:40:26 -08:00
Eric Dattore aba3ad327b Add database pool integration tests. 2018-12-23 21:12:44 -08:00
Sergio Benitez 1bb23b8115 Rename 'space_helmet' to 'helmet'. Rework API. 2018-11-08 20:35:30 -08:00
Tal c5167f1150 Add 'space_helmet' contrib module. 2018-11-08 20:35:26 -08:00
Sergio Benitez 26db5ecb4e Fix normalization and Windows issues. 2018-10-24 00:01:56 -07:00
Sergio Benitez e0973d95f1 Log I/O error when live template reloading fails. 2018-10-23 23:58:12 -07:00
Sergio Benitez 9cb031a47d Modularize contrib. 2018-10-09 04:31:09 -07:00
Sergio Benitez 2839aca8ce Update features for latest nightly. 2018-10-09 04:31:09 -07:00
Sergio Benitez 360b0e80b0 Port all codegen tests to codegen_next. 2018-10-09 04:31:08 -07:00
jeb 8e779610c4 Reimplement 'routes!' and 'catchers!' as proc-macros. 2018-09-16 18:52:23 -07:00
Sergio Benitez fd6d577158 Remove 'use_extern_macros' feature: stabilized. 2018-08-18 17:06:28 -07:00
Eric Dattore 60b9f06407 Implement connection pooling support in contrib.
Resolves #167.
2018-08-15 22:11:53 -07:00
Sergio Benitez ec130f96ee Implement a 'StaticFiles' custom handler in contrib.
Closes #239.
2018-08-13 02:17:50 -07:00
Sergio Benitez 4098ddd92f Improve templates contrib test by reusing code. 2018-08-13 02:14:16 -07:00
jeb 491b04cf5a Implement template auto-reload.
Resolves #163.
2018-08-10 23:29:12 -07:00
Sergio Benitez 39c952f8eb Clean up 'TemplateMetadata' implementation. 2018-07-10 17:07:53 -07:00
Marc Mettke c381386098 Add 'TemplateMetadata' request guard to contrib.
The request guard allows a user to query information about loaded
templates. In particular, a user can check whether a template was
loaded.
2018-07-10 15:11:43 -07:00
Beatriz Rizental 965c90afc9 Add 'log = off' config option to disable all logging. 2018-07-07 18:12:25 -07:00
Sergio Benitez 397a646dcf Fix conditional compilation for contrib templates tests. 2018-06-03 20:42:15 +02:00
Sergio Benitez f171dc9d09 Reorganize repository.
The directory structure has changed to better isolate crates serving
core and contrib. The new directory structure is:

  contrib/
    lib/ - the contrib library
  core/
    lib/ - the core Rocket library
    codegen/ - the "compile extension" codegen library
    codegen_next/ - the new proc-macro library
  examples/ - unchanged
  scripts/ - unchanged
  site/ - unchanged

This commit also removes the following files:

  appveyor.yml - AppVeyor (Rust on Windows) is far too spotty for use
  rustfmt.toml - rustfmt is, unfortunately, not mature enough for use

Finally, all example Cargo crates were marked with 'publish = false'.
2018-06-03 18:44:38 +02:00