Commit Graph

96 Commits

Author SHA1 Message Date
Sergio Benitez
8283bf0a2b Make obvious when and which tests in '--all' fail. 2021-03-10 22:52:37 -08:00
Sergio Benitez
88cb6ec4d1 Always test on stable on publish. 2021-03-10 14:56:34 -08:00
Sergio Benitez
c9d7b4fbe0 Use '-Zrustdoc-map' to fill in external doc URLs. 2021-03-09 22:00:52 -08:00
Sergio Benitez
17dd8dafd0 Move examples to their own workspace.
This allows us to test all of the "core" crates (and the guide) by
testing the root workspace, and all of the examples by testing in the
examples workspace.
2021-03-09 21:57:30 -08:00
Sergio Benitez
4e06ee64aa Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.

This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.

The summary of changes in this commit are:

  * Config 'secret_key' success and failure are now tested.
  * 'secret_key' validation was moved to pre-launch from 'Config:from()'.
  * 'Config::from()' only extracts the config.
  * Added 'Config::try_from()' for non-panicking extraction.
  * 'Config' now knows the profile it was extracted from.
  * The 'Config' provider sets a profile of 'Config.profile'.
  * 'Rocket', 'Client', 'Fairings', implement 'Debug'.
  * 'fairing::Info' implements 'Copy', 'Clone'.
  * 'Fairings' keeps track of, logs attach fairings.
  * 'Rocket::reconfigure()' was added to allow modifying a config.

Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.

Resolves #1543.
Fixes #1564.
2021-03-09 21:57:26 -08:00
Sergio Benitez
fd8af3a2c5 Pass extra testing script flags as cargo flags. 2021-03-09 21:57:03 -08:00
Sergio Benitez
bbfe2ba5cc Point all docs and doc links to 'master' branch. 2020-10-21 04:54:24 -07:00
Sergio Benitez
1fb061496d Revamp configuration.
This commit completely overhauls Rocket's configuration systems, basing
it on the new Figment library. It includes many breaking changes
pertaining to configuration. They are:

  * "Environments" are replaced by "profiles".
  * 'ROCKET_PROFILE' takes the place of 'ROCKET_ENV'.
  * Profile names are now arbitrary, but 'debug' and 'release' are given
    special treatment as default profiles for the debug and release
    compilation profiles.
  * A 'default' profile now sits along-side the meta 'global' profile.
  * The concept of "extras" is no longer present; users can extract any
    values they want from the configured 'Figment'.
  * The 'Poolable' trait takes an '&Config'.
  * The 'secrets' feature is disabled by default.
  * It is a hard error if 'secrets' is enabled under the 'release'
    profile and no 'secret_key' is configured.
  * 'ConfigBuilder' no longer exists: all fields of 'Config' are public
    with public constructors for each type.
  * 'keep_alive' is disabled with '0', not 'false' or 'off'.
  * Inlined error variants into the 'Error' structure.
  * 'LoggingLevel' is now 'LogLevel'.
  * Limits can now be specified in SI units: "1 MiB".

The summary of other changes are:

  * The default config file can be configured with 'ROCKET_CONFIG'.
  * HTTP/1 and HTTP/2 keep-alive configuration is restored.
  * 'ctrlc' is now a recognized config option.
  * 'serde' is now a core dependency.
  * TLS misconfiguration errors are improved.
  * Several example use '_' as the return type of '#[launch]' fns.
  * 'AdHoc::config()' was added for simple config extraction.
  * Added more documentation for using 'Limits'.
  * Launch information is no longer treated specially.
  * The configuration guide was rewritten.

Resolves #852.
Resolves #209.
Closes #1404.
Closes #652.
2020-10-20 19:21:56 -07:00
Sergio Benitez
52320020bc Use thread-safe 'CookieJar's.
The user-facing changes effected by this commit are:

  * The 'http::Cookies<'_>' guard is now '&http::CookieJar<'_>'.
  * The "one-at-a-time" jar restriction is no longer imposed.
  * 'CookieJar' retrieval methods return 'http::CookieCrumb'.
  * The 'private-cookies' feature is now called 'secrets'.
  * Docs flag private cookie methods with feature cfg.
  * Local, async request dispatching is never serialized.
  * 'Client::cookies()' returns the tracked 'CookieJar'.
  * 'LocalResponse::cookies()' returns a 'CookieJar'.
  * 'Response::cookies()' returns an 'impl Iterator'.
  * A path of '/' is set by default on all cookies.
  * 'SameSite=strict' is set by default on all cookies.
  * 'LocalRequest::cookies()' accepts any 'Cookie' iterator.
  * The 'Debug' impl for 'Request' prints the cookie jar.

Resolves #1332.
2020-08-16 02:19:45 -07:00
Sergio Benitez
549c9241c4 Require data limits on 'Data::open()'.
Closes #1325.
2020-08-06 02:46:04 -05:00
Necmettin Karakaya
fde6eda915 Fix various typos throughout the codebase. 2020-07-22 12:56:01 -07:00
Sergio Benitez
4a1a4c0e45 Support cargo '+' flags in testing script. 2020-07-21 15:31:44 -07:00
Sergio Benitez
949b01cb9d Remove 'redis' integration from 'contrib'.
The latest version of 'redis' is async and implements its own connection
retrieval.
2020-07-21 15:11:07 -07:00
Jeb Rosen
9d4fea2937 Remove 'mongodb' integration from 'contrib'.
The latest version of 'mongodb' is async and implements its own internal
connection pooling.
2020-07-21 10:54:07 -07:00
Jeb Rosen
3a40d1071c Remove 'rusted_cypher' integration from 'contrib'. 2020-07-21 10:54:07 -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
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
b56e889a0e Disable some known-failing tests for now. 2020-07-11 09:24:28 -07:00
Sergio Benitez
22c5e261b4 Prefix release codenames with 'v'. 2020-02-29 18:19:54 -08:00
Sergio Benitez
32e86c3b69 Inline macro docs into core crate. 2020-02-25 16:56:59 -08:00
Sergio Benitez
f8e72d2e2e Add prerelease flag to 'config.sh'. 2020-01-29 14:16:50 -08:00
Jeb Rosen
ff2000293c Update 'compiletest' and fix and re-enable compile UI tests. 2020-01-15 17:09:57 -08:00
Sergio Benitez
1caf87eb21 Move to 0.5.0-dev on master. 2019-05-13 16:18:48 -07:00
Jeb Rosen
0a3960b031 Clean up 'compression' module and documentation. 2019-04-27 08:54:21 -07:00
jeb
b9c3a5c64b Remove test bootstrapping. 2019-02-08 16:50:14 -08:00
An Long
5ce43ed4e9 Add support for memcache connection pooling in 'rocket_contrib'. 2019-01-13 11:16:11 -08:00
Sergio Benitez
a4dcb0cf4c New version: 0.4.0. 2018-12-06 09:19:11 -08:00
Eric Dattore
50a635ed8e Add support for MongoDB connection pooling in 'rocket_contrib'. 2018-12-06 08:17:12 -08:00
Sergio Benitez
90a6749313 New version: 0.4.0-rc.2. 2018-11-30 21:00:18 -08:00
Sergio Benitez
b405b181a3 Test 'rocket_contrib' before publishing. 2018-11-30 21:00:18 -08:00
Sergio Benitez
7919ceac39 Strip dev-dependencies more reliably. 2018-11-30 20:58:29 -08:00
Sergio Benitez
4224419e63 Reduce 'cfg' usage for 'private-cookies' feature. 2018-11-08 23:56:15 -08:00
Linus Unnebäck
53758c6dd7 Introduce the 'private-cookies' feature. 2018-11-08 23:38:18 -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
4dbd87a36f New version: 0.4.0-rc.1. 2018-10-31 14:35:30 -07:00
Sergio Benitez
4b5000e33b Pass flags along in 'publish' script. 2018-10-31 04:47:21 -07:00
Sergio Benitez
ef3e7ca2c6 Make all top-level crates publishable. 2018-10-31 03:57:37 -07:00
Sergio Benitez
34c76dd0a9 Keep release info in site's 'index.toml'. 2018-10-28 20:17:44 -07:00
Sergio Benitez
5c40d3b7e2 Reenable MySQL pooling support. 2018-10-27 18:14:17 -07:00
Sergio Benitez
556206e8b3 Version all URLs to 'rocket.rs'. 2018-10-26 21:20:12 -07:00
Sergio Benitez
ed15e6685d Track major version in scripts config. 2018-10-26 20:36:19 -07:00
Sergio Benitez
9ef0b731c8 Rename 'codegen_next' to 'codegen'. 2018-10-22 00:01:41 -07:00
Sergio Benitez
ed9d6096aa Really disable MySQL pooling support. 2018-10-22 00:01:41 -07:00
Sergio Benitez
f5219174d0 Allow docs to be built without cleaning with '-d'. 2018-10-10 04:21:06 -07:00
Sergio Benitez
8b1e93192e Version documentation. 2018-10-09 04:31:09 -07:00
Sergio Benitez
9cb031a47d Modularize contrib. 2018-10-09 04:31:09 -07:00
Sergio Benitez
28f2a33abd Use inter/intra-crate links in all documentation. 2018-10-09 04:31:09 -07:00