Commit Graph

1110 Commits

Author SHA1 Message Date
Sergio Benitez 02cff01e17 Give a nice error when uri! macro is empty. 2017-09-14 22:12:46 -07:00
Sergio Benitez c4524400b2 Add suite of positive tests for typed URIs. 2017-09-14 22:12:46 -07:00
Sergio Benitez a291c9b42e Improve 'uri!' macro internal code. 2017-09-14 22:12:03 -07:00
Sergio Benitez a9dd52a4fb Ensure mount points are absolute. 2017-09-14 22:12:03 -07:00
Sergio Benitez 96b3d81882 Make all run-pass tests regular tests. 2017-09-14 22:12:03 -07:00
Sergio Benitez 084481a84e Initial implementation of typed URIs.
This is a breaking change. All Rocket applications using code
generation must now additionally declare usage of the 'decl_macro'
feature.
2017-09-14 22:10:25 -07:00
Sergio Benitez 322c02f654 A better, but not yet good enough, 'rustfmt.toml'. 2017-09-09 01:54:54 -07:00
Sergio Benitez f18fa81a4e Shorten 'handle' function signature to one line. 2017-09-09 00:54:30 -07:00
Sergio Benitez 8dcbca5cda Relate a 403 status to authorization, not authentication.
Resolves #416.
2017-09-09 00:34:43 -07:00
Lucas Kolstad 2d72928ba1 Properly handle paths with spaces in shell scripts. 2017-09-07 17:07:31 -07:00
Sergio Benitez b5c2187249 Use '&*' instead of 'as_ref()' for 'String' to '&str' ref. 2017-09-07 16:55:38 -07:00
David Hotham bd08d50f59 Remove reliance on 'lookup_host'. 2017-09-07 16:45:06 -07:00
Lukas Kalbertodt 329711db3b Use 'debug_struct' to improve 'Config' 'Debug' impl.
Using the method `debug_struct()` of `fmt::Formatter` takes care of
the exact formatting for us. Additionally, it also handles the
"alternate" form of printing enabled with '#'. In the struct case it
prints the struct on multiple lines instead of just one.

This commit also changes the output slightly. Before, the field
`log_level` was printed with `log: {}`. This commit replaces "log"
with "log_level". Additionally, the value of `environment` is now
printed as a struct field instead of being combined with the struct
name.
2017-09-07 11:18:47 -07:00
Ram 0930304aad Implement 'From<Status>' for 'Failure'.
Resolves #399.
2017-09-07 11:03:57 -07:00
Joshua Rombauer e656ec87d7 Clarify 'on_request' Fairing documentation. 2017-09-07 10:52:31 -07:00
QuietMisdreavus 62f96331e2 Indent comments to prevent being commonmark code blocks. 2017-09-07 10:41:35 -07:00
Sergio Benitez 37886ce3a2 Only log nonempty fairing collections. 2017-09-04 20:31:35 -07:00
Sergio Benitez eb3d3dcfeb Don't print emojis when colors are disabled. 2017-09-04 20:22:10 -07:00
Sergio Benitez ae46d27129 Clean-up code style in 'lib/rocket.rs'. 2017-09-04 20:11:10 -07:00
Sergio Benitez aa9d9ab081 Run 'cargo update' in 'mk-docs.sh' script. 2017-09-04 19:07:39 -07:00
Sergio Benitez 2f84d4b18a Add 'Config::root_relative()'. Make TLS config paths root-relative.
Prior to this commit, relative paths to TLS PEM files were incorrectly
treated as being relative to the CWD as opposed to the Rocket config
file, when present. This commit resolves the issue.
2017-09-04 19:01:26 -07:00
Sergio Benitez 237370533c Update cert in 'tls' example for new 'rustls'.
The latest version of `rustls` acts on the SNI extension to TLS without
the apparent ability to disable the behavior. `rustls` requires that the
server's certificate match the client's requested server. The matching
is done by looking at DNS names in the `subjectAltName` extension and
checking if the requested server name is present. Since the certificate
in the `tls` example did not have the `subjectAltName` extension, this
check always failed, and the TLS connection was aborted. This commit
adds the extension to the certificate with a DNS name of `localhost`,
ensuring that TLS succeeds on `localhost`.
2017-09-01 03:16:36 -07:00
Sergio Benitez 2b3aa01463 Improve I/O and BadType config error messages. 2017-08-31 19:05:35 -07:00
Sergio Benitez 3ed0201c6e Remove unused 'extern crate's. 2017-08-31 17:03:47 -07:00
Sergio Benitez 7ce250b82f Update dependencies for ring 0.12. 2017-08-31 16:58:24 -07:00
Pascal Brandt c2e4c520f1 Fix typo in site overview: by -> be. 2017-08-29 17:48:21 -07:00
Linus Heckemann c63bb67fb9 Avoid sorting routes on every add. 2017-08-29 17:24:09 -07:00
Sergio Benitez a019f0d1f3 Use new 'JsonValue' type as return type of 'json!'.
Prior to this commit, a 'json!' invocation returned a value of type
'Value' from 'serde_json'. Because 'Value' does not implement
'Responder', most uses of 'json!' were wrapped in 'Json':
'Json(json!(..))`. By returning a crate-local 'JsonValue' type that
implements 'Responder', this repetition is resolved, and a 'json!' can
appear unwrapped.

This commit also removes the reexport of 'Value' from 'rocket_contrib'
as well as the default type of 'Value' for 'T' in 'Json<T>'.
2017-08-25 23:14:42 -07:00
Lee Baillie 31fd24d027 Fix typo in site overview: 'Reponder' -> 'Responder'. 2017-08-22 01:53:27 -07:00
Sergio Benitez c5890934c0 Improve missing argument compile-time error. 2017-08-22 01:01:57 -07:00
Sergio Benitez 89443bcdf0 Remove unnecessary 'RouteGenerateExt' trait. 2017-08-20 11:13:45 -07:00
Sergio Benitez 4df7ce6bf5 Propogate route names through codegen to runtime.
This commit modifies `codegen` so that a route's name (the name of the
route handler) is stored in the generated static route information
structure and later propogated into the corresponding `Route`
structure.

The primary advantage of this change is an improvement to debug and
error messages which now include route names. The collision error
message, in particular, has been improved dramatically in this commit.
Additionally, the `LaunchError::Collision` variant now contains a
vector of the colliding routes.
2017-08-20 10:55:23 -07:00
Sergio Benitez 944736208e Update CHANGELOG for 0.3.2. 2017-08-15 12:17:31 -07:00
Sergio Benitez 8183f63630 Remove lints and associated code from 'rocket_codegen'.
Rust's linting API is incredibly unstable, resulting in unnecessary
breakage to `rocket_codegen`. Rocket's lints are also not as
conservative as would be desired, resulting in spurious warnings. For
these reasons, this commit removes linting from `rocket_codegen`.

These lints will likely be reintroduced as part of a 'rocket_lints'
crate. Factoring the lints out to a separate crate means that lint
breakage can be dealt with by uncommenting the dependency instead of
waiting for a new release or backtracking nightlies. In the same vein,
it will likely improve stability of the 'rocket_codegen' crate.
2017-08-15 11:39:22 -07:00
adrian5 f66780bd9e Add missing comma in 'FromParam' docs. 2017-08-14 11:49:59 -07:00
Sergio Benitez 31cbe65704 Fix example in 'Request::guard()' documentation.
Resolves #378.
2017-08-13 03:13:20 -07:00
Rolf Sievers 3a76fe03db Improve commentary on collisions in pastebin example. 2017-08-13 02:56:23 -07:00
Katrina Brock 527051d136 Improve bootstrapping instructions in todo example. 2017-08-13 02:50:28 -07:00
Daiki Mizukami 667a057e39 Add 'Box' conversion methods to 'UncasedStr'. 2017-08-13 02:17:53 -07:00
Sergio Benitez a58790d6d9 Additional changes to fairings guide overview. 2017-08-11 15:32:24 -07:00
Lori Holden 536dd39636 Improve overview in fairings guide. 2017-08-11 15:30:02 -07:00
Arne Bahlo 6279039361 Fix database usage code in state guide: '&*conn'. 2017-08-11 15:11:45 -07:00
Sergio Benitez df1ca03458 Update CHANGELOG for 0.3.1. 2017-08-11 10:24:35 -07:00
Sergio Benitez 6f180d9d7c Require 'yansi' 0.3.3. 2017-08-11 10:09:23 -07:00
Sergio Benitez 3f6c6fd576 Move to 0.4.0-dev on master. 2017-08-11 09:32:27 -07:00
Sergio Benitez 721f6204ea Update lints for latest nightly, '2017-08-10'. 2017-08-11 09:14:54 -07:00
Sergio Benitez 9108e79fb9 Fix typo in 'Limits' docs: anf -> and. 2017-08-04 20:21:21 -07:00
Sergio Benitez 86c7a67b02 Allow named parameters to be ignored. 2017-08-02 18:44:31 -07:00
Sergio Benitez 0b7d9f4602 Remove unused doc comments. 2017-08-02 17:48:00 -07:00
Sergio Benitez 95452af449 Improve form field name error message. 2017-08-02 17:41:10 -07:00