Commit Graph

564 Commits

Author SHA1 Message Date
Sergio Benitez 5240f860cb Remove superfluous logic in 'Rocket.write_response()'. 2018-01-19 11:23:13 -08:00
Sergio Benitez d2727972fd Always strip bodies on 'HEAD' requests.
Closes #544.
Closes #514.
2018-01-19 11:21:56 -08:00
Sergio Benitez 72d2ccc2a5 Don't preallocate in 'Body.into_bytes()'. 2018-01-19 11:20:06 -08:00
Sergio Benitez 69abd4fc83 Update dependencies for 'ring' '0.13.0-alpha'.
Closes #533.
2018-01-13 10:51:33 -08:00
Sergio Benitez 0f9828d095 Pin 'hyper-sync-rustls' version. 2018-01-13 10:05:30 -08:00
Sergio Benitez 1ba71cdb25 Group 'Rocket.state()' method with other accessors. 2018-01-12 20:15:55 -08:00
Sergio Benitez 5d4908e74a Update minimum nightly to '2018-01-12'.
The '2018-01-12' nightly release includes a commit that reverts the
change that broke 'ring', un-breaking 'ring', and thus un-breaking
Rocket. As a result, the '[patch]' workaround is no longer required.
Rocket is back on the latest nightly!
2018-01-12 19:44:21 -08:00
Sergio Benitez 11b769438c Fix incorrect handling of nested 'attach' calls. 2018-01-12 08:34:53 -08:00
Zachary Golba 9bf33bdd1b Add 'application/vnd.api+json' as known media type. 2018-01-05 19:45:08 -08:00
Sergio Benitez e9c68ba666 Add regression test for issue #505. 2018-01-05 19:36:05 -08:00
Sergio Benitez a583137d96 Update 'state' to '0.3.3' for 'Storage.clone()' fix.
Fixes #505.
2018-01-05 19:36:05 -08:00
Sergio Benitez 65baa83fb4 Update dependencies.
* 'memchr' to 2.0
  * 'base64' to 0.9
  * 'smallvec' to 0.6
  * 'lazy_static' to 1.0

Update example dependencies.

  * 'rand' to 0.4
  * 'parking_lot' to 0.5
2018-01-05 02:00:26 -08:00
Sergio Benitez 1b77376162 Bump 'cookie' dependency for 'SameSite' changes. 2018-01-04 23:47:28 -08:00
Stanislav Ivanov 70413b155f Add 'LocalRequest::private_cookie()'.
Resolves #368.
2017-12-29 09:16:08 -08:00
Sergio Benitez dd07c367d5 Add 'Request::client_ip()' method. 2017-12-29 00:40:09 -08:00
Alexander Mielczarek c2899b2391 Don't rewrite request remote. Add 'Request::real_ip()'.
Resolves #479.
2017-12-28 23:51:14 -08:00
Jeb Rosen 80e7339ebe Add 'Rocket::state()' for managed state retrieval. 2017-12-28 19:57:05 -08:00
Max Furman 4be75accf7 Respond to invalid requests with '400 Bad Request'.
Resolves #465.
2017-12-27 23:10:28 -08:00
Sergio Benitez 804d2b6603 Add a note to disambiguate '{content,contrib}::Json'. 2017-12-26 20:28:53 -08:00
Sergio Benitez 81bae5246b Rename 'state' to 'managed' in 'Request' for clarity. 2017-12-26 20:27:47 -08:00
Sergio Benitez 1ae1bfc101 Add 'success_or' methods to 'Outcome'. 2017-12-23 20:23:03 -08:00
Sergio Benitez 78b10f9bfa Clarify that 'Err' response is not a 'Responder'. 2017-12-21 21:53:13 -08:00
Sergio Benitez ed0ed2a396 Defer NamedFile's Responder impl to File. 2017-12-21 21:51:36 -08:00
Sergio Benitez a9c66c9426 Update codegen and pear_codegen for 2017-12-17 nightly. 2017-12-18 06:50:27 -08:00
Sergio Benitez 5922eb50b4 Use '#[repr(C)]' on 'str' wrappers to guarantee correct layout.
Closes #494.
2017-12-14 18:10:24 +07:00
Wilson Birney 4749b541a9 Emit sized body when file length is known in 'NamedFile'. 2017-11-29 23:47:53 -08:00
Sergio Benitez aad97e6be0 Use correct rustdoc 'html_root_url'.
Fixes #474.
2017-11-22 10:58:20 -08:00
Tobias Stolzmann 309ae6348c Fix typo in 'Outcome' docs: 'users' -> 'Users'. 2017-11-17 12:39:36 -08:00
Lukas Kalbertodt a8e9362b38 Remove incorrect statement in 'RawStr' docs. 2017-11-17 12:36:03 -08:00
Ian Létourneau 7ae9bb678c Add a 'status::BadRequest' responder. 2017-11-17 12:34:38 -08:00
Sergio Benitez 1d53fee0d3 Remove use of now unneeded 'AsciiExt' trait. 2017-11-09 10:10:14 +01:00
Sergio Benitez 07d4d23cc8 Update dependencies. 2017-10-09 20:15:18 -07:00
Sergio Benitez a90d625abe Set safer defaults for private cookies. 2017-10-05 21:58:27 -07:00
Sergio Benitez 8de1e32130 Add 'Config::get_string' to retrieve 'String' from extras. 2017-10-05 15:46:40 -07:00
Sergio Benitez a60c9e812e Move handler definitions to top of file. 2017-09-24 20:19:31 -07:00
Sergio Benitez 237c673be4 Rename '#[error]' to '#[catch]', 'errors!' to 'catchers!'. 2017-09-22 19:04:14 -07:00
Sergio Benitez 92ce006e2c Use the 'response::Result' alias in all 'Responder' impls. 2017-09-21 18:49:28 -07:00
Sergio Benitez c31ad28efc Add a 'Responder' impl for 'Vec<u8>'. 2017-09-21 18:48:39 -07:00
Sergio Benitez 96a2f1e4c4 Add a 'Binary' media type for 'application/octet-stream'. 2017-09-21 18:46:48 -07:00
Sergio Benitez 4d9e6afa11 Document case-insensitivity of 'from_ext'. 2017-09-21 18:36:11 -07:00
Sergio Benitez c36701671b Use a 'BufReader' for file-based bodies. 2017-09-21 18:35:33 -07:00
Sergio Benitez 32eeae1733 Use 'Uri' instead of 'String' in 'Redirect'. 2017-09-15 04:00:50 -07:00
Sergio Benitez cced491ec9 Implement 'From<Cow<str>>' for 'Uri'. 2017-09-15 03:22:59 -07:00
Sergio Benitez 23093a33b8 Document 'FromParam' impl for 'Cow<str>'. 2017-09-15 02:47:29 -07:00
Sergio Benitez 16feedd563 Remove 'drop_types_in_const' feature: stabilized. 2017-09-14 22:39:19 -07:00
Sergio Benitez 245f815657 Document 'FromUriParam'. 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 d8acd04789 Fix mountpoint in 'mount_point' test. 2017-09-14 22:12:47 -07:00
Sergio Benitez a9dd52a4fb Ensure mount points are absolute. 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 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
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 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 7ce250b82f Update dependencies for ring 0.12. 2017-08-31 16:58:24 -07:00
Linus Heckemann c63bb67fb9 Avoid sorting routes on every add. 2017-08-29 17:24:09 -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
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
Daiki Mizukami 667a057e39 Add 'Box' conversion methods to 'UncasedStr'. 2017-08-13 02:17:53 -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 0b7d9f4602 Remove unused doc comments. 2017-08-02 17:48:00 -07:00
Ian Létourneau 84fe23a9fb Fix spelling of "corresponding" in 'status' docs. 2017-07-27 01:58:25 -04:00
Sergio Benitez b276e1d51f Enable ASCII escape sequences in Windows consoles. 2017-07-26 22:54:45 -04:00
Sergio Benitez 3abc813605 Use 'AtomicIsize', not 'Cell', in URI. 2017-07-21 17:00:38 -04:00
Christian Legnitto 362afdc445 Fix spelling of "instantiated" in rustdocs. 2017-07-18 09:35:37 -04:00
Flarp 69afb5c4a3 Fix typo in 'NotFound' docs: 404, not 400. 2017-07-17 14:10:52 -04:00
Tommy Ip ae406cf0ca Fix 'clusure' typo in fairings guide and ad_hoc.rs.
Fixes #348.
2017-07-15 00:36:41 -07:00
Stuart Hinson b3f41f248c Update 'Fairing' example to reflect doc's content. 2017-07-15 00:35:25 -07:00
Sergio Benitez cdacda0896 New version: 0.3.0. 2017-07-14 11:30:48 -07:00
Sergio Benitez 51a465f2cc Add regression test for issue #345. 2017-07-14 09:54:11 -07:00
Yong Wen Chua 10efcb1af9 Always implement 'Responder' with 'r instead of 'static. 2017-07-14 09:43:22 -07:00
Sergio Benitez 722959ee29 Use a parametric lifetime in 'Responder' example. 2017-07-14 09:42:33 -07:00
Sergio Benitez 897313730d Use TitleCase for all 'content::' struct names. 2017-07-12 15:21:45 -07:00
Sergio Benitez 65886c8c4e Rename 'contrib::JSON' to 'contrib::Json'. 2017-07-12 15:11:41 -07:00
Sergio Benitez 70bc97c322 Rename 'APIKey' in example docs to 'ApiKey'. 2017-07-12 14:53:08 -07:00
Sergio Benitez 0bbfa5e21a Update 'version_check' to 0.1.3. 2017-07-12 04:15:30 -07:00
Sergio Benitez 85846c2af1 Use 'hyper_sync_rustls' for hyper/rustls interop. 2017-07-12 04:13:46 -07:00
Sergio Benitez 4609413828 Update 'pear' and 'pear_codegen' to 0.0.10. 2017-07-12 04:07:55 -07:00
Sergio Benitez 5a632a4d27 Always log a request's 'format' when available. 2017-07-11 04:35:05 -07:00
Sergio Benitez 7e0cbe4842 Restrict compilation to rustc >= 2017-07-09. 2017-07-09 22:34:29 -07:00
Sergio Benitez 6050eb5169 Update for 2017-07-09. 'associated_consts' is stable. 2017-07-09 22:00:01 -07:00