Commit Graph

149 Commits

Author SHA1 Message Date
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
Paolo Barbolini cd5f96ae15 Update 'uuid', 'unicode-xid', and 'base64' dependencies. 2019-11-30 09:33:14 -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
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
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 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 746023fe1f Use '&*' in database docs for reliable deref coercions.
Resolves #855.
2018-12-10 22:20:34 -08:00
Sergio Benitez b88a2d7d05 Add notes about enabling features to contrib docs. 2018-12-07 09:07:27 -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
jeb d14c3393a0 Fix notify dependency version. 2018-11-19 02:29:41 -08:00
jeb af84f60bb8 Fix forced HSTS logic in 'SpaceHelmet'. 2018-11-17 23:51:54 -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 ef3e7ca2c6 Make all top-level crates publishable. 2018-10-31 03:57:37 -07:00
jeb d5fec97fcb Update 'contains_template' documentation. 2018-10-28 22:10:43 -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 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 21932cc277 Temporarily disable MySQL pooling support.
See rust-lang/rust#55219.
2018-10-21 20:04:17 -07:00
Sergio Benitez 2845b8d4d4 Add coloring disabling with 'ROCKET_CLI_COLORS=off'.
Resolves #703.
2018-10-21 19:46:37 -07:00
Sergio Benitez 0b2ece2f65 Update rusqlite dependencies. 2018-10-15 00:28:25 -07:00
Sergio Benitez 8741e678f8 Document contrib modules. 2018-10-12 18:52:38 -07:00
Sergio Benitez f857f81d9c Import 'database' attribute with 'macro_use'. 2018-10-09 04:31:09 -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
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
Sergio Benitez 61f107f550 Reimplement route attribute as a proc-macro.
This commits also implement the query reform from #608. It also consists
of many, many breaking changes. Among them are:

  * Query parts in route paths use new query reform syntax.
  * Routing for queries is now lenient.
    - Default ranking has changed to reflect query reform.
  * Format routing matching has been fixed.
    - Routes with formats matching "accept" will always collide.
    - Routes with formats matching "content-type" require requests to
      have an equivalent content-type header to match.
    - Requests with imprecise content-types are treated as not having a
      content-type.
  * Generated routes and catchers respect visibility modifiers.
  * Raw getter methods from request were renamed and retooled.
    - In particular, the index parameter is based on segments in the
      route path, not dynamic parameters.
  * The method-based attributes no longer accept a keyed 'path'.
  * The 'rocket_codegen' crate is gone and will no longer be public.
  * The 'FormItems' iterator emits values of type 'FormItem'.
    - The internal form items' string can no longer be retrieved.
  * In general, routes are more strictly validated.
  * Logging from codegen now funnels through logging infrastructure.
  * Routing has been optimized by caching routing metadata.

Resolves #93.
Resolves #608.
Resolves #693.
Resolves #476.
2018-10-09 04:18:04 -07:00
Sergio Benitez ec4cc3a293 Allow transforms in 'FromData'. Add 'FromDataSimple'.
The new 'FromData' trait allows an implementor to instruct the caller to
maintain state on its stack and later pass a borrow for processing.
Among other things, it greatly simplifies the 'Form' type, removing a
use of unsafe, and allows references in deserialized data guards.
2018-09-26 21:33:02 -07:00
Sergio Benitez 74007815a0 Replace 'SerdeError' with 'JsonError' in 'Json' data guard.
The new 'JsonError' type allows users to inspect the raw string that
failed to parse as a given JSON value.

Resolves #772.
2018-09-18 18:57:11 -07:00
jeb 95cbc241db Ensure 'ContextManager' is 'Sync' on all platforms. 2018-09-16 23:39:32 -07:00
jeb 8e779610c4 Reimplement 'routes!' and 'catchers!' as proc-macros. 2018-09-16 18:52:23 -07:00
Sergio Benitez 46afabdfea Remove neglected and obscure 'Error' type. 2018-09-16 03:07:50 -07:00
Christophe Courtaut 7b050ebaae Update 'uuid' dependency to '0.7'. 2018-09-11 11:04:50 -07:00
Sébastien Santoro bac186fc0d Fix typo in contrib 'Cargo.toml'. 2018-09-03 19:54:02 -07:00
Sergio Benitez fd6d577158 Remove 'use_extern_macros' feature: stabilized. 2018-08-18 17:06:28 -07:00
Sergio Benitez 58519e495e Test all contrib features individually. 2018-08-18 16:52:45 -07:00
Sergio Benitez 9966a07c58 Update 'redis' to '0.9'.
Closes #743.
2018-08-18 16:50:55 -07:00
EloD10 46da03c3c3 Fix typo in 'DatabaseConfig' docstring. 2018-08-17 11:19:37 -07:00
Sergio Benitez a62248f7ce Consistently use 'diesel_postgres_pool' feature. 2018-08-17 11:16:36 -07:00
Sergio Benitez fe9fad339e Clean up connection pooling documentation. 2018-08-15 23:31:49 -07:00
Eric Dattore 60b9f06407 Implement connection pooling support in contrib.
Resolves #167.
2018-08-15 22:11:53 -07:00
Sergio Benitez 429c0dfeb6 Fix template fairing given 'ConfigError::Missing'. 2018-08-15 19:00:43 -07:00
Sergio Benitez 55459db773 Properly constrain 'serde_json' version. 2018-08-14 11:20:42 -07:00
Sergio Benitez d699827079 Reexport new 'serde_json::json_internal_vec' macro. 2018-08-14 09:53:04 -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
Sean Stangl 9bf585496c Apply more Clippy suggestions. 2018-08-11 23:41:35 -07:00
Sergio Benitez 0612c644ad Fix typo in 'Template::finalize()' docstring. 2018-08-11 23:17:22 -07:00
Sergio Benitez f941b1310b Improve template engine customization docs. 2018-08-10 23:29:12 -07:00
jeb 491b04cf5a Implement template auto-reload.
Resolves #163.
2018-08-10 23:29:12 -07:00
Sergio Benitez 56c6a96f6a Overhaul URI types.
This is fairly large commit with several entangled logical changes.

The primary change in this commit is to completely overhaul how URI
handling in Rocket works. Prior to this commit, the `Uri` type acted as
an origin API. Its parser was minimal and lenient, allowing URIs that
were invalid according to RFC 7230. By contrast, the new `Uri` type
brings with it a strict RFC 7230 compliant parser. The `Uri` type now
represents any kind of valid URI, not simply `Origin` types. Three new
URI types were introduced:

  * `Origin` - represents valid origin URIs
  * `Absolute` - represents valid absolute URIs
  * `Authority` - represents valid authority URIs

The `Origin` type replaces `Uri` in many cases:

  * As fields and method inputs of `Route`
  * The `&Uri` request guard is now `&Origin`
  * The `uri!` macro produces an `Origin` instead of a `Uri`

The strict nature of URI parsing cascaded into the following changes:

  * Several `Route` methods now `panic!` on invalid URIs
  * The `Rocket::mount()` method is (correctly) stricter with URIs
  * The `Redirect` constructors take a `TryInto<Uri>` type
  * Dispatching of a `LocalRequest` correctly validates URIs

Overall, URIs are now properly and uniformly handled throughout Rocket's
codebase, resulting in a more reliable and correct system.

In addition to these URI changes, the following changes are also part of
this commit:

  * The `LocalRequest::cloned_dispatch()` method was removed in favor of
    chaining `.clone().dispatch()`.
  * The entire Rocket codebase uses `crate` instead of `pub(crate)` as a
    visibility modifier.
  * Rocket uses the `crate_visibility_modifier` and `try_from` features.

A note on unsafety: this commit introduces many uses of `unsafe` in the
URI parser. All of these uses are a result of unsafely transforming byte
slices (`&[u8]` or similar) into strings (`&str`). The parser ensures
that these casts are safe, but of course, we must label their use
`unsafe`. The parser was written to be as generic and efficient as
possible and thus can parse directly from byte sources. Rocket, however,
does not make use of this fact and so would be able to remove all uses
of `unsafe` by parsing from an existing `&str`. This should be
considered in the future.

Fixes #443.
Resolves #263.
2018-07-29 00:17:33 -07:00
Sergio Benitez 49365d5fdf Update 'handlebars' to 1.0. 2018-07-22 21:59:40 -07:00
jeb 0c80217289 Fix various spelling and grammar issues in core and contrib. 2018-07-20 22:14:58 -06:00
Sergio Benitez 5acb08a026 Make contrib MsgPack tests actually run. 2018-07-10 17:08:58 -07:00
Sergio Benitez 0045486227 Implement Serialize + Deserialize for contrib JsonValue. 2018-07-10 17:08:26 -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 88d3b59c71 Use 'or_else' to tidy up 'Template::show()'. 2018-07-02 19:14:17 -07:00
Sergio Benitez 397a646dcf Fix conditional compilation for contrib templates tests. 2018-06-03 20:42:15 +02:00
Sergio Benitez 1e8e4cc553 Fix Cargo.toml path to README. 2018-06-03 19:39:32 +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