NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #2864 most downloaded on crates.io
Types, traits, and parsers for HTTP requests, responses, and headers.
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 11 months
Nearly every release is documented
notes for 14 of 14 stable releases
1 version withdrawn
withdrawn after publishing
8 years old
21 releases · first in 2018
This release contains the following crate updates:
This release contains the following crate updates:
rocket 0.5.1rocket_db_pools 0.2.0rocket_dyn_templates 0.2.0rocket_ws 0.1.1See the CHANGELOG for release details.
This release contains the following crate updates:
rocket 0.5.1rocket_db_pools 0.2.0rocket_dyn_templates 0.2.0rocket_ws 0.1.1rocket 0.5.1The following char and std::ops::Range types now implement FromForm:
charRange<T: FromForm> with start and end fieldsRangeFrom<T: FromForm> with start fieldRangeTo<T: FromForm> with end fieldRangeToInclusive<T: FromForm> with end field[T; N], Vec<T>, and [u8] can now be passed to uri!.
The guide now includes a deploying section.
The FromForm derive now properly records errors involving entire forms.
FromForm derive can now be used in code emitted by macro_rules! macros.
(fix #2668 via 52de9a) [TempFile] now ensures it flushes before
being persisted.
rocket_db_pools 0.2.0SQLite extensions are now supported in sqlx_sqlite.
Use a database configuration option of extensions to specify extensions:
[default.databases.db_name]
url = "db.sqlite"
# This option is only supported by the `sqlx_sqlite` driver.
extensions = ["memvfs", "rot13"]
(breaking) deadpool was updated to 0.13.
(breaking) The Config
structure has a new extensions field.
rocket_dyn_templates 0.2.0Support for minijinja 2.0 templates was introduced.
Templates with an extension of .j2 are recognized and rendered with
Minijinja.
(breaking) handlebars was updated to 5.1.
rocket_ws 0.1.1Introduced WebSocket::accept_key() method.
tungstenite was updated to 0.21.
The rust-version for all crates was updated to 1.64.
This reflects the correct MSRV required to build rocket 0.5.0.
License files are now present in all published crates.
One column per quarter.
See the CHANGELOG , release news article , RWF2 announcement , migration guide , and FAQ for more information.
See the CHANGELOG, release news article, RWF2 announcement, migration guide, and FAQ for more information.
This release introduces the following major features and improvements:
async/await.rocket_ws.rocket_db_pools.Certificates.h2 ALPN.json, msgpack, and uuid rocket_contrib features into core.Shield: security and privacy headers for all responses.uri! macro.serde for built-in guards and types.#[launch] and
#[rocket::main].#[catch(default)], which handle any status code.TempFile data and form guard for automatic uploading to a temporary file.Capped<T> data and form guard which enables detecting truncation due to data limits.uri!.References.<param..>) which match zero segments.local_cache! macro for request-local storage of non-uniquely typed values.CookieJar without "one-at-a-time" limitations.2.mebibytes().#[derive(Responder)].chat application.As a result of support for Rust stable (Rust 2021 Edition and beyond),
#![feature(..)] crate attributes are no longer required to use Rocket. The
complete canonical example with a single hello route becomes:
#[macro_use] extern crate rocket;
#[get("/<name>/<age>")]
fn hello(name: &str, age: u8) -> String {
format!("Hello, {} year old named {}!", age, name)
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/hello", routes![hello])
}
<details> <summary>See a <code>diff</code> of the changes from v0.4.</summary>
- #![feature(proc_macro_hygiene, decl_macro)]
-
#[macro_use] extern crate rocket;
#[get("/<name>/<age>")]
- fn hello(name: String, age: u8) -> String {
+ fn hello(name: &str, age: u8) -> String {
format!("Hello, {} year old named {}!", age, name)
}
- fn main() {
- rocket::ignite().mount("/hello", routes![hello]).launch();
- }
+ #[launch]
+ fn rocket() -> _ {
+ rocket::build().mount("/hello", routes![hello])
+ }
</details>
This release includes many breaking changes. For a walkthrough guide on handling these changes, see the v0.4 to v0.5 migration guide. The most significant changes are listed below.
These changes are invisible to the compiler and will not yield errors or warnings at compile-time. We strongly advise all application authors to review this list carefully.
sleep(), Mutex, RwLock, etc.) may prevent
the server from making progress and should be avoided, replaced with an async variant, or
performed in a worker thread. This is a consequence of Rust's cooperative async multitasking.
For details, see the new multitasking section of the guide.ROCKET_ENV is now ROCKET_PROFILE. A warning is emitted a launch time if the former is set.debug, not dev.release, not prod.ROCKET_LOG is now ROCKET_LOG_LEVEL. A warning is emitted a launch time if the former is set.ROCKET_ADDRESS accepts only IP addresses, no longer resolves hostnames like localhost.ROCKET_CLI_COLORS accepts booleans true, false in place of strings "on", "off".secrets is enabled in non-debug profiles without a configured
secret_key.template_dir is reported as an error at launch time.FileServer::new() fails immediately if the provided directory does not exist.-12 to -1. There is no breaking change if only code generated
routes are used. Manually configured routes with negative ranks may collide or be considered in
a different order than before.: are properly recognized as invalid and rejected.Segments iterator now returns percent-decoded &strs.Form guard. Use Strict for the previous behavior.Option<T> form guard defaults to None instead of the default value for T.413 Payload Too Large status is returned to the client.Accept
header.true: the query string ?f is the same as ?f=true.Created<R> does not automatically send an ETag header if R: Hash. Use
Created::tagged_body instead.FileServer now forwards when a file is not found instead of failing with 404 Not Found.Shield is enabled by default. You may need to disable or change policies if your application
depends on typically insecure browser features or if you wish to opt-in to different policies
than the defaults.CookieJar get()s do not return cookies added during request handling. See
CookieJar#pending.Hash impls for MediaType and ContentType no longer consider media type parameters.FromForm implementations of Vec and Maps are now properly lenient.[ and ] characters are now accepted in URI paths.[ and ] characters are no longer encoded by uri!.Secure cookie flag is set by default for all cookies when serving over TLS.SameSite set to Lax by default.MediaType::JavaScript is now text/javascript.The rocket_contrib crate is deprecated and the functionality moved to other rocket crates. The
contrib deprecation upgrade guide provides a walkthrough on migrating. The relevant changes are:
rocket_contrib were merged into rocket itself:
json, msgpack, and uuid are now features of rocket.rocket_contrib::json to rocket::serde::json.rocket_contrib::msgpack to rocket::serde::msgpack.rocket_contrib::uuid to rocket::serde::uuid.rocket_contrib::helmet to rocket::shield. Shield is enabled by default.rocket_contrib::serve to rocket::fs, StaticFiles to rocket::fs::FileServer.Uuid and JsonValue wrapper types.Shield that are no longer respected by browsers.rocket_contrib are now provided by separate crates:
rocket_contrib::templates with rocket_dyn_templates.rocket_contrib::databases with rocket_sync_db_pools and rocket_db_pools.rocket.rocket_contrib::databases::DbError is now rocket_sync_db_pools::Error.redis, mongodb, and mysql integrations which have upstream async drivers.#[database]
attribute generates an async run() method instead of Deref implementations.The following breaking changes apply broadly and are likely to cause compile-time errors.
Rocket is now generic over a phase marker:
Rocket<Build>, Rocket<Ignite>, Rocket<Orbit>, or Rocket<P: Phase> as
needed.Build, Ignite, Orbit order.rocket::ignite() is now rocket::build() and returns a Rocket<Build>.Rocket::ignite() transitions to the Ignite phase. This is run automatically on launch as
needed.ignite fairings, and verifies sentinels.Rocket::launch() transitions into the Orbit phase and starts the server.Request::rocket() that refer to a live Rocket instance return an
&Rocket<Orbit>.async:
attach fairings with ignite fairings. Unlike attach fairings, which ran
immediately at the time of attachment, ignite fairings are run when transitioning into the
Ignite phase.launch fairings with liftoff fairings. liftoff fairings are always run, even in
local clients, after the server begins listening and the concrete port is known.ROCKET_ENV is superseded by ROCKET_PROFILE.ROCKET_LOG is superseded by ROCKET_LOG_LEVEL.dev, stage, and prod profiles carry no
special meaning.debug and release profiles are the default profiles for the debug and release
compilation profiles.default profile specifies defaults for all profiles.global profile has highest precedence, followed by the selected profile, followed by
default.LoggingLevel to LogLevel.Error structure.workers to usize from u16.keep_alive: it is disabled with 0, not false or off.secrets feature (for private cookies) by default.Figment.ConfigBuilder: all fields of Config are public with constructors for each field
type.async:
FromRequest, Fairing, catcher::Handler, route::Handler, and FromData use
#[async_trait].NamedFile::open is now an async function.Request::local_cache_async() for use in async request guards.Response bodies must be AsyncRead instead of Read.Response bodies must be AsyncSeek instead of Seek.local module is split into two: rocket::local::asynchronous and
rocket::local::blocking.Try implementation on Outcome which allowed using ? with Outcomes. The
recommended replacement is the rocket::outcome::try_outcome! macro or the various
combinator functions on Outcome.Result<T, E> implements Responder only when both T and E implement Responder. The
new Debug wrapping responder replaces Result<T: Responder, E: Debug>.! type to now use std::convert::Infallible.IntoOutcome was overhauled to supplant methods now removed in Outcome.
IntoOutcome::into_outcome() is now or_error().IntoOutcome is implemented for all Outcome type aliases.Outcome::forward() requires specifying a status code.Outcome::from() and Outcome::from_or_forward() were removed.Rocket::register() now takes a base path to scope catchers under as its first argument.ErrorKind::Collision has been renamed to ErrorKind::Collisions.tls feature is enabled.MediaType::with_params() and ContentType::with_params() are now builder methods.content responder type names are now prefixed with Raw.content::Plain responder is now called content::RawText.content::Custom<T> responder was removed in favor of (ContentType, T).CookieJar::get_private_pending() in favor of CookieJar::get_pending().local_cache! macro accepts fewer types. Use local_cache_once! as appropriate.Rocket::launch() allows Rocket recovery by returning the instance after shutdown.ErrorKind::Runtime was removed; ErrorKind::Shutdown was added.Outcome::Failure was renamed to Outcome::Error.#[route(GET, path = "...")], path is now uri: #[route(GET, uri = "...")]./<p..>) now match zero or more segments./<a>/<p..>) now collides with (/<a>), requires a rank to resolve.rocket::catcher.rocket::route.rocket::http::uri::fmt.T no longer converts to Option<T> or Result<T, _> for uri! query parameters.uri! requires using a wrapped value or _.&RawStr no longer implements FromParam: use &str instead.FromParam implementations.RawStr::url_decode() and RawStr::url_decode_lossy() allocate as necessary, return Cow.RawStr::from_str() was replaced with RawStr::new().Origin::segments() was replaced with Origin.path().segments().Origin::path() and Origin::query() return &RawStr instead of &str.Route::name is now Option<Cow<'static, str>>.Route::set_uri was replaced with Route::map_base().Route::uri field is now of type RouteUri.Route::base was removed in favor of Route.uri().base().Forward outcomes are now associated with a Status.FromParam errors now forward as 422.&Host, &Accept, &ContentType, IpAddr, and SocketAddr all forward
with a 500.Data now has a lifetime generic: Data<'r>.Data::open() indelibly requires a data limit.FromDataSimple. Use FromData and local_cache! or local_cache_once!.DataStream APIs require limits and return Capped<T> types.rocket::request to rocket::form.FromQuery. Dynamic query parameters (#[get("/?<param>")]) use FromForm instead.FromFormValue with FromFormField. All T: FromFormField implement FromForm.FromFormField implementations.#[form(field = ...)] attribute to #[field(name = ...)].Status.Cookies to CookieJar. Its methods take &self.Flash.name to Flash.kind, Flash.msg to Flash.message.Request::get_param() with Request::param().Request::get_segments() to Request::segments().Request::get_query_value() with Request::query_value().Segments::into_path_buf() with Segments::to_path_buf().Segments and QuerySegments with Segments<Path> and Segments<Query>.Flash constructors now take Into<String> instead of AsRef<str>.State<'_, T> request guard is now &State<T>.FromRequest: FromRequest<'r>.FlashMessage: FlashMessage<'_>.State reexports except rocket::State.NamedFile to rocket::fs::NamedFileContent with content::Custom.Response::body and Response::body_mut are now infallible methods.ResponseBuilder to Builder.Response body reading methods. Use methods on r.body_mut() instead.Responder impl for Response. Prefer custom responders with #[derive(Responder)].Status.response::status were unified to all be of
the form Status<R>(R).In addition to new features and changes, Rocket saw the following improvements:
FromForm derive, #[route] macros, and uri!.#[field(name = uncased(...))].#[field(default = expr())].#[field] attributes on struct fields.Config::ident for configuring or removing the global Server header.Rocket::figment() and Rocket::catchers().LocalRequest::json() and LocalResponse::json().LocalRequest::msgpack() and LocalResponse::msgpack().use m::route; routes![route] instead of needing routes![m::route].a/b/c falls back to a/b then a.LocalRequest::inner_mut(). LocalRequest implements DerefMut to Request.Config for all config parameter names.ErrorKind::Config to represent errors in configuration at runtime.rocket::fairing::Result type alias, returned by Fairing::on_ignite().Rocket::mount() now accepts a base value of any type that implements TryInto<Origin<'_>>.500 error catcher.Error to not panic if a panic is already in progress.Reference and Asterisk URI types.UriDisplayQuery for C-like enums.UriDisplayQuery derive now recognizes the #[field] attribute for field renaming.Client method builders accept TryInto<Origin> allowing a uri!() to be used directly.Rocket is now #[must_use].http2 crate feature.rocket::execute() for executing Rocket's launch() future.context! macro to rocket_dyn_templates for ad-hoc template contexts.time crate is re-exported from the crate root.FromForm, Responder, and UriDisplay derives now fully support generics.serde submodules.Shield HSTS preload header now includes includeSubdomains.write! errors if stdout disappears, preventing panics.Client::terminate() to run graceful shutdown in testing.async runtime, never the process.local_cache_once! macro for request-local storage.Rocket<Build> are now #[must_use], not all Rocket<P>.FromForm derive.FromForm derive now collects all errors that occur.rocket_sync_db_pools.Metadata::render() in rocket_dyn_templates for direct template rendering.cookie secure feature is now properly conditionally enabled.rocket_sync_db_pools was fixed.max_blocking configuration parameter to control number of blocking threads.ip_header "real IP" header configuration parameter.pool() method is emitted by rocket_sync_db_pools for code-generated pools.&[u8] form guard.TempFile::open() to stream TempFile data.LocalRequest::identity().Error::pretty_print() for pretty-printing errors like Rocket.String is used as a route parameter.debug log level.Outcomes now includes the relevant status code.Span::mixed_site() is used in codegen to reduce errant clippy warnings.http2 crate feature.const constructor for MediaType.RawStrBuf, an owned RawStr.RawStr.RawStr::percent_encode() and RawStr::strip().Host and &Host request guards.RawStr::percent_encode_bytes().NODELAY is now enabled on all connections by default.image/avif.EventStream: text/event-stream.Markdown: text/markdown.MP3: audio/mpeg.CBZ: application/vnd.comicbook+zip, extension .cbz.CBR: application/vnd.comicbook-rar, extension .cbr.RAR: application/vnd.rar, extension .rar.EPUB: application/epub+zip, extension .epub.OPF: application/oebps-package+xml, extension .opf.XHTML: application/xhtml+xml, extension .xhtml.Text as an alias for the Plain media type.Bytes as an alias for the Binary media type..mjs as known JavaScript extension.: in socket or IP address values in [FromFormValue].Request::rocket() to access the active Rocket instance.Request::uri() now returns an &Origin<'r> instead of &Origin<'_>.Request::accept(), Request::content_type() reflect changes to Accept, Content-Type.Json<T>, MsgPack<T> accept T: Deserialize, not only T: DeserializeOwned.rocket_sync_db_pools use better defaults.workers * 4.Request::host() to retrieve the client-requested host.Template::try_custom() for fallible template engine customization.Template::render().X-DNS-Prefetch-Control header to Shield.expires values for private cookies.#[derive(Responder)].Server header is only set if one isn't already set.Content-Length headers are sent even for partially read Bodys.Redirect now accepts a TryFrom<Reference>, allowing fragment parts.Clone for State.Copy and Clone for fairing::Info.Debug for Rocket and Client.Default for Status (returns Status::Ok).PartialEq, Eq, Hash, PartialOrd, and Ord for Status.Eq, Hash, and PartialEq<&str> for Origin.PartialEq<Cow<'_, RawStr>>> for RawStr.std::error::Error for Error.Deref and DerefMut for LocalRequest (to Request).DerefMut for Form, LenientForm.From<T> for Json<T>, MsgPack<T>.TryFrom<String> and TryFrom<&str> for Origin.TryFrom<Uri> for each of the specific URI variants.FromRequest for &Config.FromRequest for IpAddr.FromParam for PathBufFromParam, FromData, and FromForm for &str.FromForm for Json<T>, MsgPack<T>.FromFormField for Cow and Capped<Cow>>Responder for tokio::fs::File.Responder for (ContentType, R) where R: Responder.Responder for (Status, R) where R: Responder which overrides R's status.Responder for std::io::Error (behaves as Debug<std::io::Error>).Responder for Either<T, E>, equivalently to Result<T, E>.Serialize for Flash.Serialize, Deserialize, UriDisplay and FromUriParam for uuid::UuidSerialize, Deserialize for RawStr.Serialize, Deserialize for all URI types.Responder for Arc<T>, Box<T> where T: Responder.Serialize and Deserialize for Method.Eq for MediaType and ContentType.Responder for Box<T: Responder + Sized>.FromForm for Arc<T>.Fairing for Arc<dyn Fairing>.Serialize and Deserialize for Status.serde was introduced (1.0).futures was introduced (0.3).binascii was introduced (0.1).ref-cast was introduced (1.0).atomic was introduced (0.5).parking_lot was introduced (0.11).ubtye was introduced (0.10).figment was introduced (0.10).rand was introduced (0.8).either was introduced (1.0).pin-project-lite was introduced (0.2).indexmap was introduced (2.0).tempfile was introduced (3.0).async-trait was introduced (0.1).async-stream was introduced (0.3).multer was introduced (2.0).tokio was introduced (1.6.1).tokio-util was introduced (0.6).tokio-stream was introduced (0.1.6).bytes was introduced (1.0).normpath was introduced (1).state was updated to 0.6.rmp-serde was updated to 0.15.uuid was updated to 0.8.tera was updated to 1.10.postgres was updated to 0.19.rusqlite was updated to 0.25.r2d2_sqlite was updated to 0.18.time was updated to 0.3.handlebars was updated to 4.0.memcache was updated to 0.16.rustls was updated to 0.21.tokio-rustls was updated to 0.24.syn was updated to 2.diesel was updated to 2.0.sqlx was updated to 0.7.notify was updated to 6.criterion was updated to 0.4.cookie was updated to 0.18.yansi was updated to 1.0.atty was removed.The following changes were made to the project's infrastructure:
use statements to examples in the guide.criterion and datasets extracted from real-world projects.Cargo.toml files.test.sh for a + flag (e.g. +stable) to pass to cargo.test.sh for extra flags to be passed on to cargo.resolver = 2.See the CHANGELOG , news article , migration guide , and FAQ for more information.
See the CHANGELOG, news article, migration guide, and FAQ for more information.
See the CHANGELOG , news article , migration guide , and FAQ for more information.
See the CHANGELOG, news article, migration guide, and FAQ for more information.
See the CHANGELOG , news article , migration guide , and FAQ for more information.
See the CHANGELOG, news article, migration guide, and FAQ for more information.
See the CHANGELOG and news article for more information.
See the CHANGELOG and news article for more information.
See the CHANGELOG for more information.
See the CHANGELOG for more information.
See the CHANGELOG for more information.
See the CHANGELOG for more information.
3276b8] Removed unsafe in Origin::parse_owned(), fixing a soundness
issue.See the CHANGELOG for more information.
See the CHANGELOG for more information.
See the CHANGELOG for more information.
#1548, 93e88b0] Fixed an issue that prevented compilation under
Windows Subsystem for Linux v1.Outcome Try implementation to v2 in latest nightly.rustc is 1.54.0-nightly (2021-05-18).base64 dependency to 0.13.[[#1534], [2059a6]] Fixed a low-severity, minimal impact soundness issue in uri::Formatter.
[[86bd7c]] Added default and configurable read/write timeouts: read_timeout and write_timeout.
86bd7c] Added default and configurable read/write timeouts:
read_timeout and write_timeout.c24a96] Added the sse feature, which enables flushing by returning
io::ErrorKind::WouldBlock.contrib.contrib docs.trybuild instead of compiletest-rs.[[#1312], [89150f]] Fixed a low-severity, minimal impact soundness issue in LocalRequest::clone().
89150f] Fixed a low-severity, minimal impact soundness issue in
LocalRequest::clone().376f74] Fixed a cookie serialization issue that led to
incorrect cookie deserialization in certain cases.ring for private cookies and thus Rocket, by
default.Origin::map_path() for manipulating Origin paths.handler::Outcome::from_or_forward().Options::NormalizeDirs option to StaticFiles.Removed use of unsupported cfg(debug_assertions) in Cargo.toml, allowing for builds on latest nightlies.
cfg(debug_assertions) in Cargo.toml, allowing
for builds on latest nightlies.Specialization on Result was deprecated. [Debug] can be used in place of non-Responder errors.
Debug 500 Responder that Debug-prints its contents on
response.Result was deprecated. Debug can be used in place of
non-Responder errors.Debug implementations on Rocket types now respect formatting
options.Responders for various HTTP status codes: NoContent,
Unauthorized, Forbidden, and Conflict.FromParam is implemented for NonZero core types.Some, Ok, and
Err are shadowed.core crate; rocket_codegen makes no
appearances.Replaced use of FnBox with Box .
FnBox with Box<dyn FnOnce>.try_from and transpose_result.rustc is 1.35.0-nightly (2019-04-05).JsonValue now implements FromIterator.non_snake_case errors are silenced in generated code.rustc is 1.33.0-nightly (2019-01-03).StaticFiles via StaticFiles::rank().MsgPack correctly sets a MessagePack Content-Type on responses.Removed deprecated isatty dependency in favor of atty.
Server HTTP header no longer overrides a user-set header.DerefMut.isatty dependency in favor of atty.This release includes many breaking changes. These changes are listed below along with a short note about how to handle the breaking change in existin…
This release includes the following new features:
StaticFiles.Handler.FromData::transform().SpaceHelmet security and privacy headers fairing.private-cookies default feature.FromFormValue.Responder.Template::custom() for customizing templating engines including
registering filters and helpers.Client.LocalRequest::private_cookie().production environment.keep_alive configuration parameter.ROCKET_CLI_COLORS=off.format accepts shorthands such as json and html.Responder for Status.Response::cookies() for retrieving response cookies.log is set to off.Metadata guard for retrieving templating information.Uri type parses URIs according to RFC 7230 into one of Origin,
Absolute, or Authority.Outcome::and_then(), Outcome::failure_then(), and
Outcome::forward_then().Responder for &[u8].T: Into<Vec<Route>> can be mount()ed.Request::get_query_value() for retrieving a query value by key.State::from() for constructing State values.The rocket_codegen crate has been entirely rewritten using to-be-stable
procedural macro APIs. We expect nightly breakages to drop dramatically, likely
to zero, as a result. The new prelude import for Rocket applications is:
- #![feature(plugin)]
- #![plugin(rocket_codegen)]
+ #![feature(proc_macro_hygiene, decl_macro)]
- extern crate rocket;
+ #[macro_use] extern crate rocket;
The rocket_codegen crate should not be a direct dependency. Remove it
from your Cargo.toml:
[dependencies]
- rocket = "0.3"
+ rocket = "0.4"
- rocket_codegen = "0.3"
This release includes many breaking changes. These changes are listed below along with a short note about how to handle the breaking change in existing applications when applicable.
Route and catcher attributes respect function privacy.
To mount a route or register a catcher outside of the module it is declared,
ensure that the handler function is marked pub or crate.
Query handling syntax has been completely revamped.
A query parameter of <param> is now <param..>. Consider whether your
application benefits from the revamped query string handling.
The #[error] attribute and errors! macro were removed.
Use #[catch] and catchers! instead.
Rocket::catch() was renamed to Rocket::register().
Change calls of the form .catch(errors![..]) to
.register(catchers![..]).
The #[catch] attribute only accepts functions with 0 or 1 argument.
Ensure the argument to the catcher, if any, is of type &Request.
json! returns a JsonValue, no longer needs wrapping.
Change instances of Json(json!(..)) to json! and change the
corresponding type to JsonValue.
All environments default to port 8000.
Manually configure a port of 80 for the stage and production
environments for the previous behavior.
Release builds default to the production environment.
Manually set the environment to debug with ROCKET_ENV=debug for the
previous behavior.
Form and LenientForm lost a lifetime parameter, get() method.
Change a type of Form<'a, T<'a>> to Form<T> or Form<T<'a>>. Form<T>
and LenientForm<T> now implement Deref<Target = T>, allowing for calls
to .get() to be removed.
ring was updated to 0.13.
Ensure all transitive dependencies to ring refer to version 0.13.
Uri was largely replaced by Origin.
In general, replace the type Uri with Origin. The base and uri
fields of Route are now of type Origin. The &Uri guard is now
&Origin. Request::uri() now returns an Origin.
All items in rocket_contrib are namespaced behind modules.
Json is now json::JsonMsgPack is now msgpack::MsgPackMsgPackError is now msgpack::ErrorTemplate is now templates::TemplateUUID is now uuid::UuidValue is replaced by json::JsonValueTLS certificates require the subjectAltName extension.
Ensure that your TLS certificates contain the subjectAltName extension
with a value set to your domain.
Route paths, mount points, and LocalRequest URIs are strictly
checked.
Ensure your mount points are absolute paths with no parameters, ensure your
route paths are absolute paths with proper parameter syntax, and ensure that
paths passed to LocalRequest are valid.
Template::show() takes an &Rocket, doesn't accept a root.
Use client.rocket() to get a reference to an instance of Rocket when
testing. Use Template::render() in routes.
Request::remote() returns the actual remote IP, doesn't rewrite.
Use Request::real_ip() or Request::client_ip() to retrieve the IP
address from the "X-Real-IP" header if it is present.
Bind variant was added to LaunchErrorKind.
Ensure matches on LaunchErrorKind include or ignore the Bind variant.
Cookies are automatically tracked and propagated by Client.
For the previous behavior, construct a Client with
Client::untracked().
UUID was renamed to Uuid.
Use Uuid instead of UUID.
LocalRequest::cloned_dispatch() was removed.
Chain calls to .clone().dispatch() for the previous behavior.
Redirect constructors take a generic type of T: TryInto<Uri<'static>>.
A call to a Redirect constructor with a non-'static &str of the form
Redirect::to(string) should become Redirect::to(string.to_string()),
heap-allocating the string before being passed to the constructor.
The FromData impl for Form and LenientForm now return an error
of type FormDataError.
On non-I/O errors, the form string is stored in the variant as an &'f str.
Missing variant was added to ConfigError.
Ensure matches on ConfigError include or ignore the Missing variant.
The FromData impl for Json now returns an error of type
JsonError.
The previous SerdeError is now the .1 member of the JsonError enum.
Match and destruct the variant for the previous behavior.
FromData is now emulated by FromDataSimple.
Change implementations, not uses, of FromData to FromDataSimple.
Consider whether your implementation could benefit from transformations.
FormItems iterates over values of type FormItem.
Map using .map(|item| item.key_value()) for the previous behavior.
LaunchErrorKind::Collision contains a vector of the colliding routes.
Destruct using LaunchErrorKind::Collision(..) to ignore the vector.
Request::get_param() and Request::get_segments() are indexed by
segment, not dynamic parameter.
Modify the n argument in calls to these functions appropriately.
Method-based route attributes no longer accept a keyed path parameter.
Change an attribute of the form #[get(path = "..")] to #[get("..")].
Json and MsgPack data guards no longer reject requests with an
unexpected Content-Type
To approximate the previous behavior, add a format = "json" route
parameter when using Json or format = "msgpack" when using MsgPack.
Implemented Responder for Status. Removed Failure,
status::NoContent, and status::Reset responders.
Replace uses of Failure(status) with status directly. Replace
status::NoContent with Status::NoContent. Replace status::Reset with
Status::ResetContent.
Config::root() returns an Option<&Path> instead of an &Path.
For the previous behavior, use config.root().unwrap().
Status::new() is no longer const.
Construct a Status directly.
Config constructors return a Config instead of a Result<Config>.
ConfigError::BadCWD, Config.config_path were removed.
Json no longer has a default value for its type parameter.
Using data on a non-payload method route is a warning instead of error.
The raw_form_string method of Form and LenientForm was
removed.
Various impossible Error associated types are now set to !.
All AdHoc constructors require a name as the first parameter.
The top-level Error type was removed.
In addition to new features, Rocket saw the following improvements:
403 catcher now references authorization, not authentication.HttpOnly and are given an expiration date of 1
week by default.rocket_codegen.400 instead of 500.HEAD requests.504: Gateway Timeout.unsafe was reduced from 9 to 2 in core library.FormItems now parses empty keys and values as well as keys without
values.Config::active() as a shorthand for
Config::new(Environment::active()?).Flash cookies are cleared only after they are inspected.Sync bound on AdHoc::on_attach(), AdHoc::on_launch() was removed.AdHoc::on_attach(), AdHoc::on_launch() accept an FnOnce.Config::root_relative() for retrieving paths relative to the
configuration file.Config::tls_enabled() for determining whether TLS is actively
enabled.audio/flac), Icon (image/x-icon), WEBA (audio/webm), TIFF
(image/tiff), AAC (audio/aac), Calendar (text/calendar), MPEG
(video/mpeg), TAR (application/x-tar), GZIP (application/gzip), MOV
(video/quicktime), MP4 (video/mp4), ZIP (application/zip) as known
media types..weba (WEBA), .ogv (OGG), .mp4 (MP4), .mpeg4 (MP4),
.aac (AAC), .ics (Calendar), .bin (Binary), .mpg (MPEG),
.mpeg (MPEG), .tar (TAR), .gz (GZIP), .tif (TIFF), .tiff
(TIFF), .mov (MOV) as known extensions.println!.Form and LenientForm can be publicly constructed.i128 and u128 now implement FromParam, FromFormValue.base64 dependency was updated to 0.10.log dependency was updated to 0.4.handlebars dependency was updated to 1.0.tera dependency was updated to 0.11.uuid dependency was updated to 0.7.rustls dependency was updated to 0.14.cookie dependency was updated to 0.11.core and
contrib.http module was split into its own rocket_http crate. This is an
internal change only.unsafe are documented with informal proofs of correctness.Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →