Commit Graph

105 Commits

Author SHA1 Message Date
Sergio Benitez a9c66c9426 Update codegen and pear_codegen for 2017-12-17 nightly. 2017-12-18 06:50:27 -08: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 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 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 7ce250b82f Update dependencies for ring 0.12. 2017-08-31 16:58:24 -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 b276e1d51f Enable ASCII escape sequences in Windows consoles. 2017-07-26 22:54:45 -04:00
Sergio Benitez cdacda0896 New version: 0.3.0. 2017-07-14 11:30:48 -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 6050eb5169 Update for 2017-07-09. 'associated_consts' is stable. 2017-07-09 22:00:01 -07:00
Sergio Benitez b0612d7346 Enable features on docs.rs. 2017-06-30 02:41:00 -07:00
Sergio Benitez 06ad52157d Use Into<Value> from 'toml' instead of 'IntoValue'. 2017-06-29 14:04:54 -07:00
Sergio Benitez 3c4cb27d55 Upgrade 'state' to 0.3 to prevent memory leaks.
Fixes #323.
2017-06-20 16:46:07 -07:00
Sergio Benitez ce363810c5 Disable coloring when output isn't a tty. 2017-06-19 18:29:26 -07:00
Sergio Benitez 43a4028085 Use a less confusing version number during dev. 2017-06-18 02:25:26 -07:00
Sergio Benitez 8536e39d10 Update 'cookie' for cookie path deletion fix. 2017-06-17 13:31:24 -07:00
Sergio Benitez 2aad1d876b Update ring-based dependencies. 2017-06-16 20:32:20 -07:00
Sergio Benitez 8badc73c4b Update toml to 0.4. Add Config::get_datetime. 2017-06-11 02:20:57 -07:00
Sergio Benitez 2bfb41d968 Update 'handlebars' and 'base64' dependencies. 2017-06-11 01:07:18 -07:00
Sergio Benitez b8ba7b855f Remove Session in favor of private cookies. New testing API.
Sessions
--------

This commit removes the `Session` type in favor of methods on the
`Cookies` types that allow for adding, removing, and getting private
(signed and encrypted) cookies. These methods provide a superset of
the functionality of `Session` while also being a minimal addition to
the existing API. They can be used to implement the previous `Session`
type as well as other forms of session storage. The new methods are:

  * Cookie::add_private(&mut self, Cookie)
  * Cookie::remove_private(&mut self, Cookie)
  * Cookie::get_private(&self, &str)

Resolves #20

Testing
-------

This commit removes the `rocket::testing` module. It adds the
`rocket::local` module which provides a `Client` type for local
dispatching of requests against a `Rocket` instance. This `local`
package subsumes the previous `testing` package.

Rocket Examples
---------------

The `forms`, `optional_result`, and `hello_alt_methods` examples have
been removed. The following example have been renamed:

  * extended_validation -> form_validation
  * hello_ranks -> ranking
  * from_request -> request_guard
  * hello_tls -> tls

Other Changes
-------------

This commit also includes the following smaller changes:

  * Config::{development, staging, production} constructors have been
    added for easier creation of default `Config` structures.
  * The `Config` type is exported from the root.
  * `Request` implements `Clone` and `Debug`.
  * `Request::new` is no longer exported.
  * A `Response::body_bytes` method was added to easily retrieve a
    response's body as a `Vec<u8>`.
2017-06-08 17:34:50 -07:00
Sergio Benitez 504a7fe583 Update to yansi 0.3 for proper Debug formatting.
This commit also improves the format of TOML parsing error messages.

Fixes #310.
2017-06-06 13:56:13 -07:00
Sergio Benitez fa31b6ae42 Support the 'dev' channel during build.
Resolves #306.
2017-06-02 17:41:15 -07:00
Sergio Benitez a6c4d053ad Switch to 'yansi' for all terminal coloring.
Resolves #299.
2017-06-01 22:10:05 -07:00
Sergio Benitez 73fed03ef4 New version: 0.2.8. 2017-06-01 22:10:05 -07:00
Sergio Benitez e42fe78e41 Update 'smallvec' dependency to 0.4. 2017-05-31 17:28:12 -07:00
Sergio Benitez 5f2b2ee3df New version: 0.2.7. 2017-05-26 20:37:54 -07:00
Sergio Benitez 6a5d8ab58a Update rustls and hyper-rustls dependencies. 2017-05-24 16:02:16 -07:00
Sergio Benitez 6c00d362c0 Add ResponseBuilder::raw_body. Use OrderMap for HeaderMap. 2017-05-20 11:41:44 -07:00
Sergio Benitez a9d9ef3867 Update rustls, cookie, and hyper-rustls dependencies. 2017-05-12 14:36:32 -07:00
Sergio Benitez 6907fd432c Update base64 to secure version. 2017-05-08 15:28:46 -07:00
Sergio Benitez 84255af4f9 Update base64 dependency to 0.5. 2017-05-05 12:40:57 -07:00
Sergio Benitez 1e5a1b8940 Remove 'testing' feature. Close stream on network error.
This is a breaking change.

The `testing` feature no longer exists. Testing structures can now be
accessed without any features enabled.

Prior to this change, Rocket would panic when draining from a network
stream failed. With this change, Rocket force closes the stream on any
error.

This change also ensures that the `Fairings` launch output only prints
if at least one fairing has been attached.
2017-04-20 20:36:12 -07:00
Sergio Benitez ac0c78a0cd Initial implementation of fairings: structured middleware for Rocket.
Closes #55.
2017-04-20 13:44:19 -07:00
Sergio Benitez f2d054c4a2 Use upstream hyper. 2017-04-19 23:42:12 -07:00
Sergio Benitez 41386cfb78 Display the port that was resolved, not configured. 2017-04-19 02:51:44 -07:00
Sergio Benitez e6bbeacb1c New version: 0.2.6. 2017-04-17 16:21:56 -07:00
Sergio Benitez 9b7f58448a New version: 0.2.5. 2017-04-16 14:29:04 -07:00
Sergio Benitez 586d46ae9c Use upstream smallvec. 2017-04-15 19:03:40 -07:00
Sergio Benitez 2e54a1f74d Don't use &str where RawStr is now preferred. 2017-04-14 00:43:57 -07:00
Sergio Benitez a25a3c69c6 Cache parsed ContentType and Accept headers.
This is a breaking change. `Request::content_type` now returns a borrow
to `ContentType`. `FromRequest` for `ContentType` is no longer
implemented. Instead, `FromRequest` for `&ContentType` is implemented.
2017-04-13 02:44:47 -07:00
Sergio Benitez 1516ca4fb6 Initial TLS support.
This commit introduces TLS support, provided by `rustls` and a fork of
`hyper-rustls`. TLS support is enabled via the `tls` feature and
activated when the `tls` configuration parameter is set. A new
`hello_tls` example illustrates its usage.

This commit also introduces more robust and complete configuration
settings via environment variables. In particular, quoted string,
array, and table (dictionaries) based configuration parameters can now
be set via environment variables.

Resolves #28.
2017-04-13 00:18:31 -07:00
Sergio Benitez a2a0aab541 Depend on cookie >= 0.7.4 for ring bugfix. 2017-04-11 16:56:10 -07:00
Sergio Benitez f57d984e2e New version: 0.2.4. 2017-03-30 19:56:12 -07:00
Sergio Benitez c58ca894b7 Initial implementation of content negotiation via `Accept`.
This is a breaking change.

This commit changes the meaning of the `format` route attribute when
used on non-payload carrying requests (GET, HEAD, CONNECT, TRACE, and
OPTIONS) so that it matches against the preferred media type in the
`Accept` header of the request. The preferred media type is computed
according to the HTTP 1.1 RFC, barring a few specificty rules to come.
2017-03-29 04:08:53 -07:00
Sergio Benitez fb29b37f30 Reorganize extra request state. Add 'accept' and 'accept_first' methods to Request. 2017-03-28 03:10:18 -07:00