diff --git a/site/news.toml b/site/news.toml index abb37851..128de4cb 100644 --- a/site/news.toml +++ b/site/news.toml @@ -1,5 +1,23 @@ +[[articles]] +title = "Rocket 0.3: Fairings, TLS, Private Cookies" +slug = "2017-07-14-version-0.3" +author = "Sergio Benitez" +author_url = "https://sergio.bz" +date = "July 14, 2017" +snippet = """ +I'm excited to announce that the next major release of Rocket is available +today! Rocket 0.3 is packed with new features and improvements that increase +developer productivity, improve application security, and provide new +opportunities for extensibility. Rocket 0.3 was developed over the course of 6 +months. During this time, more than 225 changes were committed, over 100 issues +(primarily questions and feature requests) were closed, and over 40 pull +requests were submitted. The Rocket community has proven steadfast in their +support: a sincere thank you to everyone involved! +""" + [[articles]] title = "Rocket v0.2: Managed State & More" +slug = "2017-02-06-version-0.2" author = "Sergio Benitez" author_url = "https://sergio.bz" date = "February 06, 2017" @@ -13,5 +31,3 @@ to Rocket's codebase since Rocket's initial introduction! Community feedback has been incredible. As a special thank you, we include the names of these contributors at the end of this article. """ -slug = "2017-02-06-version-0.2" - diff --git a/site/news/2017-07-14-version-0.3.md b/site/news/2017-07-14-version-0.3.md new file mode 100644 index 00000000..5f2e27fa --- /dev/null +++ b/site/news/2017-07-14-version-0.3.md @@ -0,0 +1,269 @@ +# Rocket 0.3: Fairings, TLS, Private Cookies + +
+ +I'm excited to announce that the next major release of Rocket is available +today! Rocket 0.3 is packed with new features and improvements that increase +developer productivity, improve application security, and provide new +opportunities for extensibility. Rocket 0.3 was developed over the course of 6 +months. During this time, more than 225 changes were committed, over 100 issues +(primarily questions and feature requests) were closed, and over 40 pull +requests were submitted. The Rocket community has proven steadfast in their +support: a sincere thank you to everyone involved! + +## About Rocket + +Rocket is a web framework for Rust with a focus on ease of use, expressibility, +and speed. Rocket makes it simple to write fast web applications without +sacrificing flexibility or type safety. All with minimal code. + +Not already using Rocket? Join the thousands of users and dozens of companies +happily using Rocket today! Rocket's extensive documentation makes it easy. Get +started now by [reading through the guide](/guide) or learning more from [the +overview](/overview). + +## What's New? + +Rocket 0.3 is _big_ release, packed with over 100 changes. We highlight the +biggest new features here. For a complete description of everything new and +different in 0.3, please see the [CHANGELOG]. + +[CHANGELOG]: https://github.com/SergiioBenitez/Rocket/blob/v0.3/CHANGELOG.md + +### Fairings + +Fairings bring structured middleware to Rocket. With fairings, Rocket +applications can hook into the application lifecycle to record or rewrite +information about incoming requests, outgoing responses, and the Rocket +application itself. + +Rocket's fairings are a lot like middleware from other frameworks, but they bear +a few key distinctions: + + * Fairings cannot directly terminate or respond to an incoming request. + * Fairings cannot inject arbitrary, non-request data into a request. + * Fairings _can_ prevent an application from launching. + * Fairings _can_ inspect and modify the application's configuration. + +Fairings are implemented through Rocket's [`Fairing`] trait. The trait consists +of callback methods that Rocket invokes as needed. A fairing can subscribe to +receive callbacks for the following four events: + + * **Attach**: called when a fairing is first registered. + * **Launch**: called immediately before the Rocket application launches. + * **Request**: called just after a request is received. + * **Response**: called when a response is ready to be returned. + +The new [fairings guide] describes fairings in detail, expands on their +limitations and abilities, and includes implementation examples. I encourage you +to experiment with fairings and report your experiences. As always, feedback is +instrumental in solidifying a robust design. + +[`Fairing`]: https://api.rocket.rs/rocket/fairing/trait.Fairing.html +[fairings guide]: /guide/fairings + +### Native TLS Support + +Rocket 0.3 includes built-in, experimental support for TLS, powered by +[`rustls`]. To enable TLS support, compile Rocket with the `tls` feature +enabled. Then, configure file paths to an RSA certificate chain and +corresponding private key in the `Rocket.toml` file or via environment +variables: + +```toml +[global.tls] +certs = "/path/to/certs.pem" +key = "/path/to/key.pem" +``` + +TLS support in Rocket is experimental and not yet recommended for general use +over the internet. Instead, prefer to place Rocket behind a mature reverse-proxy +such as NGINX. That being said, use of Rocket's TLS support is encouraged for +local networking (such as local-only IoT devices) or as required during +development. + +For more details on Rocket's TLS support, see the [configuring TLS] section of +the guide. + +[`rustls`]: https://github.com/ctz/rustls +[configuring TLS]: /guide/configuration/#configuring-tls + +### Private Cookies + +In Rocket 0.3, cookies can be _private_. Private cookies are encrypted using +authenticated encryption, a form of encryption which simultaneously provides +confidentiality, integrity, and authenticity. This means that private cookies +cannot be inspected, tampered with, or manufactured by clients. + +Retrieving, adding, and removing private cookies is done via the new +[`get_private`], [`add_private`], and [`remove_private`] methods on the +[`Cookies`] type. As an example, consider the code below which sets and +retrieves a `user_id` private cookie in two routes: + +```rust +/// Retrieve the user's ID, if any. +#[get("/user_id")] +fn user_id(cookies: Cookies) -> Option