Commit Graph

1022 Commits

Author SHA1 Message Date
Sergio Benitez
33e9726151 Use 'decl_macro' in markdown docs. 2017-09-14 22:13:07 -07:00
Sergio Benitez
245f815657 Document 'FromUriParam'. 2017-09-14 22:13:07 -07:00
Sergio Benitez
eeef8a44ce Document the 'uri!' macro. 2017-09-14 22:13:07 -07:00
Sergio Benitez
17b8ab694c Use 'FromUriParam' trait for better ergonomics in 'uri!'. 2017-09-14 22:13:07 -07:00
Sergio Benitez
3bf577db6e Handle segments parameters in 'uri!'.
This commit also moves the 'uri' module into its own directory,
includes the beginning of the 'FromUriParam' trait, and abandons the
'url' crate in favor of 'percent_encoding' for percent encoding.
2017-09-14 22:13:07 -07:00
Sergio Benitez
5efc4b1096 Rename 'URI' to 'Uri'. 2017-09-14 22:13:07 -07:00
Sergio Benitez
b033a2e2a9 Document 'UriDisplay' trait. 2017-09-14 22:13:03 -07:00
Sergio Benitez
909eae894a Don't implement 'UriDisplay' for all 'T: Display'.
We don't know if that 'Display' implementation is URI safe, so using
it blindly could result in generating bad URIs.
2017-09-14 22:12:54 -07:00
Sergio Benitez
f623d92484 Implement 'FromParam' for 'Cow<str>'. 2017-09-14 22:12:54 -07:00
Sergio Benitez
24f7734c00 Check mount point validity in 'uri!' macro. 2017-09-14 22:12:54 -07:00
Sergio Benitez
d8acd04789 Fix mountpoint in 'mount_point' test. 2017-09-14 22:12:47 -07:00
Sergio Benitez
bbeb95357b Add compile-fail tests for 'uri!' macro. 2017-09-14 22:12:47 -07:00
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