Changelog History
Page 2
-
v0.4.2 Changes
June 28, 2019Core
- Replaced use of
FnBox
withBox<dyn FnOnce>
. - Removed the stablized feature gates
try_from
andtranspose_result
. - Derive macros are reexported alongside their respective traits.
- Minimum required
rustc
is1.35.0-nightly (2019-04-05)
.
Codegen
JsonValue
now implementsFromIterator
.non_snake_case
errors are silenced in generated code.- Minimum required
rustc
is1.33.0-nightly (2019-01-03)
.
Contrib
- Allow setting custom ranks on
StaticFiles
viaStaticFiles::rank()
. MsgPack
correctly sets a MessagePack Content-Type on responses.
📄 Docs
- Fixed typos across rustdocs and guide.
- Documented library versions in contrib database documentation.
Infrastructure
- Updated internal dependencies to their latest versions.
- Replaced use of
-
v0.4.1 Changes
May 11, 2019Core
- Rocket's default
Server
HTTP header no longer overrides a user-set header. - Fixed encoding and decoding of certain URI characters.
Codegen
- Compiler diagnostic information is more reliably produced.
Contrib
- Database pool types now implement
DerefMut
. - Added support for memcache connection pools.
- Stopped depending on default features from core.
📄 Docs
- Fixed many typos across the rustdocs and guide.
- Added guide documentation on mounting more than one route at once.
Infrastructure
- Testing no longer requires "bootstrapping".
- Removed deprecated
isatty
dependency in favor ofatty
.
- Rocket's default
-
v0.4.0 Changes
December 06, 2018🆕 New Features
🚀 This release includes the following new features:
- Introduced Typed URIs.
- Introduced [ORM agnostic database support].
- Introduced Request-Local State.
- Introduced mountable static-file serving via
StaticFiles
. - Introduced automatic live template reloading.
- Introduced custom stateful handlers via
Handler
. - Introduced transforming data guards via
FromData::transform()
. - Introduced revamped query string handling.
- Introduced the
SpaceHelmet
security and privacy headers fairing. - Private cookies are gated behind a
private-cookies
default feature. - Added derive for
FromFormValue
. - Added derive for
Responder
. - Added
Template::custom()
for customizing templating engines including registering filters and helpers. - Cookies are automatically tracked and propagated by
Client
. - Private cookies can be added to local requests with
LocalRequest::private_cookie()
. - Release builds default to the
production
environment. - Keep-alive can be configured via the
keep_alive
configuration parameter. - Allow CLI colors and emoji to be disabled with
ROCKET_CLI_COLORS=off
. - Route
format
accepts [shorthands] such asjson
andhtml
. - Implemented
Responder
forStatus
. - Added
Response::cookies()
for retrieving response cookies. - All logging is disabled when
log
is set tooff
. - Added [
Metadata
] guard for retrieving templating information. - The
Uri
type parses URIs according to RFC 7230 into one ofOrigin
,Absolute
, orAuthority
. - Added
Outcome::and_then()
,Outcome::failure_then()
, andOutcome::forward_then()
. - Implemented
Responder
for&[u8]
. - Any
T: Into<Vec<Route>>
can bemount()
ed. - [Default rankings] range from -6 to -1, differentiating on static query strings.
- Added
Request::get_query_value()
for retrieving a query value by key. - Applications can launch without a working directory.
- Added
State::from()
for constructingState
values.
👍 [ORM agnostic database support]: https://rocket.rs/v0.4/guide/state/#databases
📜 [shorthands]: https://api.rocket.rs/v0.4/rocket/http/struct.ContentType.html#method.parse_flexible
📇 [
Metadata
]: https://api.rocket.rs/v0.4/rocket_contrib/templates/struct.Metadata.html0️⃣ [Default rankings]: https://rocket.rs/v0.4/guide/requests/#default-ranking
Codegen Rewrite
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 yourCargo.toml
:[dependencies] - rocket = "0.3" + rocket = "0.4" - rocket_codegen = "0.3"
💥 Breaking Changes
🚀 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
orcrate
.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 anderrors!
macro were removed.Use
#[catch]
andcatchers!
instead.Rocket::catch()
was renamed toRocket::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 aJsonValue
, no longer needs wrapping.Change instances of
Json(json!(..))
tojson!
and change the corresponding type toJsonValue
.All environments default to port 8000.
Manually configure a port of
80
for thestage
andproduction
environments for the previous behavior.Release builds default to the production environment.
Manually set the environment to
debug
withROCKET_ENV=debug
for the previous behavior.Form
andLenientForm
lost a lifetime parameter,get()
method.Change a type of
Form<'a, T<'a>>
toForm<T>
orForm<T<'a>>
.Form<T>
andLenientForm<T>
now implementDeref<Target = T>
, allowing for calls to.get()
to be removed.ring
was updated to 0.13.Ensure all transitive dependencies to
ring
refer to version0.13
.Uri
was largely replaced byOrigin
.In general, replace the type
Uri
withOrigin
. Thebase
anduri
fields ofRoute
are now of typeOrigin
. The&Uri
guard is now&Origin
.Request::uri()
now returns anOrigin
.All items in
rocket_contrib
are namespaced behind modules.Json
is nowjson::Json
MsgPack
is nowmsgpack::MsgPack
MsgPackError
is nowmsgpack::Error
Template
is nowtemplates::Template
UUID
is nowuuid::Uuid
Value
is replaced byjson::JsonValue
TLS 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 aroot
.Use
client.rocket()
to get a reference to an instance ofRocket
when testing. UseTemplate::render()
in routes.Request::remote()
returns the actual remote IP, doesn't rewrite.Use
Request::real_ip()
orRequest::client_ip()
to retrieve the IP address from the "X-Real-IP" header if it is present.Bind
variant was added toLaunchErrorKind
.Ensure matches on
LaunchErrorKind
include or ignore theBind
variant.Cookies are automatically tracked and propagated by
Client
.For the previous behavior, construct a
Client
withClient::untracked()
.UUID
was renamed toUuid
.Use
Uuid
instead ofUUID
.LocalRequest::cloned_dispatch()
was removed.Chain calls to
.clone().dispatch()
for the previous behavior.Redirect
constructors take a generic type ofT: TryInto<Uri<'static>>
.A call to a
Redirect
constructor with a non-'static
&str
of the formRedirect::to(string)
should becomeRedirect::to(string.to_string())
, heap-allocating the string before being passed to the constructor.The
FromData
impl forForm
andLenientForm
now return an error of typeFormDataError
.On non-I/O errors, the form string is stored in the variant as an
&'f str
.Missing
variant was added toConfigError
.Ensure matches on
ConfigError
include or ignore theMissing
variant.The
FromData
impl forJson
now returns an error of typeJsonError
.The previous
SerdeError
is now the.1
member of theJsonError
enum
. Match and destruct the variant for the previous behavior.FromData
is now emulated byFromDataSimple
.Change implementations, not uses, of
FromData
toFromDataSimple
. Consider whether your implementation could benefit from transformations.FormItems
iterates over values of typeFormItem
.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()
andRequest::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
andMsgPack
data guards no longer reject requests with an unexpected Content-TypeTo approximate the previous behavior, add a
format = "json"
route parameter when usingJson
orformat = "msgpack"
when usingMsgPack
.Implemented
Responder
forStatus
. RemovedFailure
,status::NoContent
, andstatus::Reset
responders.Replace uses of
Failure(status)
withstatus
directly. Replacestatus::NoContent
withStatus::NoContent
. Replacestatus::Reset
withStatus::ResetContent
.Config::root()
returns anOption<&Path>
instead of an&Path
.For the previous behavior, use
config.root().unwrap()
.Status::new()
is no longerconst
.Construct a
Status
directly.Config
constructors return aConfig
instead of aResult<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 ofForm
andLenientForm
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.
General Improvements
In addition to new features, Rocket saw the following improvements:
- Log messages now refer to routes by name.
- Collision errors on launch name the colliding routes.
- Launch fairing failures refer to the failing fairing by name.
- The default
403
catcher now references authorization, not authentication. - Private cookies are set to
HttpOnly
and are given an expiration date of 1 week by default. - A Tera templates example was added.
- All macros, derives, and attributes are individually documented in
rocket_codegen
. - Invalid client requests receive a response of
400
instead of500
. - Response bodies are reliably stripped on
HEAD
requests. - Added a default catcher for
504: Gateway Timeout
. - Configuration information is logged in all environments.
- Use of
unsafe
was reduced from 9 to 2 in core library. FormItems
now parses empty keys and values as well as keys without values.- Added
Config::active()
as a shorthand forConfig::new(Environment::active()?)
. - Address/port binding errors at launch are detected and explicitly emitted.
Flash
cookies are cleared only after they are inspected.Sync
bound onAdHoc::on_attach()
,AdHoc::on_launch()
was removed.AdHoc::on_attach()
,AdHoc::on_launch()
accept anFnOnce
.- Added
Config::root_relative()
for retrieving paths relative to the configuration file. - Added
Config::tls_enabled()
for determining whether TLS is actively enabled. - ASCII color codes are not emitted on versions of Windows that do not support them.
- Added FLAC (
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. - Added
.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. - Interaction between route attributes and declarative macros has been improved.
- Generated code now logs through logging infrastructures as opposed to using
println!
. - Routing has been optimized by caching routing metadata.
Form
andLenientForm
can be publicly constructed.- Console coloring uses default terminal colors instead of white.
- Console coloring is consistent across all messages.
i128
andu128
now implementFromParam
,FromFormValue
.- The
base64
dependency was updated to0.10
. - The
log
dependency was updated to0.4
. - The
handlebars
dependency was updated to1.0
. - The
tera
dependency was updated to0.11
. - The
uuid
dependency was updated to0.7
. - The
rustls
dependency was updated to0.14
. - The
cookie
dependency was updated to0.11
.
Infrastructure
- All documentation is versioned.
- Previous, current, and development versions of all documentation are hosted.
- The repository was reorganized with top-level directories of
core
andcontrib
. - The
http
module was split into its ownrocket_http
crate. This is an internal change only. - All uses of
unsafe
are documented with informal proofs of correctness.
-
v0.3.16 Changes
August 24, 2018Codegen
- Codegen was updated for
2018-08-23
nightly. - Minimum required
rustc
is1.30.0-nightly 2018-08-23
.
Core
- Force close only the read end of connections. This allows responses to be sent even when the client transmits more data than expected.
📄 Docs
- Add details on retrieving configuration extras to guide.
- Codegen was updated for
-
v0.3.15 Changes
July 16, 2018Codegen
- The
#[catch]
decorator andcatchers!
macro were introduced, replacing#[error]
anderrors!
. - The
#[error]
decorator anderrors!
macro were deprecated. - Codegen was updated for
2018-07-15
nightly. - Minimum required
rustc
is1.29.0-nightly 2018-07-15
.
- The
-
v0.3.14 Changes
June 22, 2018Codegen
- Codegen was updated for
2018-06-22
nightly. - Minimum required
rustc
is1.28.0-nightly 2018-06-22
.
- Codegen was updated for
-
v0.3.13 Changes
June 16, 2018Codegen
- Codegen was updated for
2018-06-12
nightly. - Minimum required
rustc
is1.28.0-nightly 2018-06-12
.
- Codegen was updated for
-
v0.3.12 Changes
May 31, 2018Codegen
- Codegen was updated for
2018-05-30
nightly. - Minimum required
rustc
is1.28.0-nightly 2018-05-30
.
- Codegen was updated for
-
v0.3.11 Changes
May 19, 2018Core
- Core was updated for
2018-05-18
nightly.
Infrastructure
- Fixed injection of dependencies for codegen compile-fail tests.
- Core was updated for
-
v0.3.10 Changes
May 05, 2018Core
- Fixed parsing of nested TOML structures in config environment variables.
Codegen
- Codegen was updated for
2018-05-03
nightly. - Minimum required
rustc
is1.27.0-nightly 2018-05-04
.
Contrib
- Contrib was updated for
2018-05-03
nightly.
📄 Docs
- Fixed database pool type in state guide.