Flashcookie deletion functions as expected regardless of the path.configproperly accepts IPv6 addresses.- Multiple
Set-Cookieheaders are properly set.
DisplayandErrorwere implemented forConfigError.webp,ttf,otf,woff, andwoff2were added as known content types.- Routes are presorted for faster routing.
into_bytesandinto_innermethods were added toBody.
- Fixed
unmanaged_statelint so that it works with prefilled type aliases.
- Better errors are emitted on Tera template parse errors.
- Fixed typos in
manageandJSONdocs.
- Updated doctests for latest Cargo nightly.
Detailed release notes for v0.2 can also be found on rocket.rs.
This release includes the following new features:
- Introduced managed state.
- Added lints that warn on unmanaged state and unmounted routes.
- Added the ability to set configuration parameters via environment variables.
Configstructures can be built viaConfigBuilder, which follows the builder pattern.- Logging can be enabled or disabled on custom configuration via a second
parameter to the
Rocket::custommethod. nameandvaluemethods were added toHeaderto retrieve the name and value of a header.- A new configuration parameter,
workers, can be used to set the number of threads Rocket uses. - The address of the remote connection is available via
Request.remote(). Request preprocessing overrides remote IP with value from theX-Real-IPheader, if present. - During testing, the remote address can be set via
MockRequest.remote(). - The
SocketAddrrequest guard retrieves the remote address. - A
UUIDtype has been added tocontrib. rocketandrocket_codegenwill refuse to build with an incompatible nightly version and emit nice error messages.- Major performance and usability improvements were upstreamed to the
cookiecrate, including the addition of aCookieBuilder. - When a checkbox isn't present in a form,
booltypes in aFromFormstructure will parse asfalse. - The
FormItemsiterator can be queried for a complete parse viacompletedandexhausted. - Routes for
OPTIONSrequests can be declared via theoptionsdecorator. - Strings can be percent-encoded via
URI::percent_encode().
This release includes several breaking changes. These changes are listed below along with a short note about how to handle the breaking change in existing applications.
-
Rocket::customtakes two parameters, the first beingConfigby value.A call in v0.1 of the form
Rocket::custom(&config)is nowRocket::custom(config, false). -
Tera templates are named without their extension.
A templated named
name.html.terais now simplyname. -
JSONunwrapmethod has been renamed tointo_inner.A call to
.unwrap()should be changed to.into_inner(). -
The
map!macro was removed in favor of thejson!macro.A call of the form
map!{ "a" => b }can be written as:json!({ "a": b }). -
The
hyper::SetCookieheader is no longer exported.Use the
Cookietype as anInto<Header>type directly. -
The
Content-TypeforStringis nowtext/plain.Use
content::HTML<String>for HTML-basedStringresponses. -
Request.content_type()returns anOption<ContentType>.Use
.unwrap_or(ContentType::Any)to get the old behavior. -
The
ContentTyperequest guard forwards when the request has noContent-Typeheader.Use an
Option<ContentType>and.unwrap_or(ContentType::Any)for the old behavior. -
A
Rocketinstance must be declared before aMockRequest.Change the order of the
rocket::ignite()andMockRequest::new()calls. -
A route with
formatspecified only matches requests with the same format.Previously, a route with a
formatwould match requests without a format specified. There is no workaround to this change; simply specify formats when required. -
FormItemscan no longer be constructed directly.Instead of constructing as
FormItems(string), construct asFormItems::from(string). -
from_from_string(&str)inFromFormremoved in favor offrom_form_items(&mut FormItems).Most implementation should be using
FormItemsinternally; simply use the passed inFormItems. In other cases, the form string can be retrieved via theinner_strmethod ofFormItems. -
Config::{set, default_for}are deprecated.Use the
set_{param}methods instead ofset, andneworbuildin place ofdefault_for. -
Route paths must be absolute.
Prepend a
/to convert a relative path into an absolute one. -
Route paths cannot contain empty segments.
Remove any empty segments, including trailing ones, from a route path.
A couple of bugs were fixed in this release:
- Handlebars partials were not properly registered (#122).
Rocket::customdid not set the custom configuration as theactiveconfiguration.- Route path segments containing more than one dynamic parameter were allowed.
In addition to new features, Rocket saw the following smaller improvements:
- Rocket no longer overwrites a catcher's response status.
- The
portConfigtype is now a properu16. - Clippy issues injected by codegen are resolved.
- Handlebars was updated to
0.25. - The
PartialEqimplementation ofConfigdoesn't consider the path or session key. - Hyper dependency updated to
0.10. - The
Errortype forJSON as FromDatahas been exposed asSerdeError. - SVG was added as a known Content-Type.
- Serde was updated to
0.9. - Form parse failure now results in a 422 error code.
- Tera has been updated to
0.7. pub(crate)is used throughout to enforce visibility rules.- Query parameters in routes (
/path?<param>) are now logged. - Routes with and without query parameters no longer collide.
- Testing was parallelized, resulting in 3x faster Travis builds.
- Hyper version pinned to 0.9.14 due to upstream non-semver breaking change.
- Fixed security checks in
FromSegmentsimplementation forPathBuf.
proc_macrofeature removed from examples due to stability.
- Header names are treated as case-preserving.
- Minimum supported nightly is
2017-01-03.
- Typo in
Outcomeformatting fixed (Succcess -> Success). - Added
ContentType::CSV. - Dynamic segments parameters are properly resolved, even when mounted.
- Request methods are only overridden via
_methodfield on POST. - Form value
Strings are properly decoded.
- The
_methodfield is now properly ignored inFromFormderivation. - Unknown Content-Types in
formatno longer result in an error. - Deriving
FromFormno longer results in a deprecation warning. - Codegen will refuse to build with incompatible rustc, presenting error message and suggestion.
- Added
headas a valid decorator forHEADrequests. - Added
route(OPTIONS)as a valid decorator forOPTIONSrequests.
- Templates with the
.teraextension are properly autoescaped. - Nested template names are properly resolved on Windows.
- Template implements
Display. - Tera dependency updated to version 0.6.
- Todo example requirements clarified in its
README.
- Tests added for
config,optional_result,optional_redirect, andquery_paramsexamples. - Testing script checks for and disallows tab characters.
- New script (
bump_version.sh) automates version bumps. - Config script emits error when readlink/readpath support is bad.
- Travis badge points to public builds.
- Fix
get_raw_segmentsindex argument in route codegen (#41). - Segments params (
<param..>) respect prefixes.
- Fix nested template name resolution (#42).
- New script (
publish.sh) automates publishing to crates.io. - New script (
bump_version.sh) automates version bumps.
NamedFileResponderlost its body in the shuffle; it's back!
This is the first public release of Rocket!
All of the mentions to hyper types in core Rocket types are no more. Rocket
now implements its own Request and Response types.
ContentTypeuses associated constants instead of static methods.StatusCoderemoved in favor of newStatustype.Responsetype alias superceded byResponsetype.Responder::respondno longer takes in hyper type.Responder::respondreturnsResponse, takesselfby move.HandlerreturnsOutcomeinstead ofResponsetype alias.ErrorHandlerreturnsResult.- All
Hyper*types were moved to unprefixed versions inhyper::. MockRequest::dispatchnow returns aResponsetype.URIBufremoved in favor of unifiedURI.- Rocket panics when an illegal, dynamic mount point is used.
- Rocket handles
HEADrequests automatically. - New
ResponseandResponseBuildertypes. - New
Request,Header,Status, andContentTypetypes.
MockRequestallows any type of header.MockRequestallows cookies.
- Debug output disabled by default.
- The
ROCKET_CODEGEN_DEBUGenvironment variables enables codegen logging.
All incoming request data is now streamed. This resulted in a major change to the Rocket APIs. They are summarized through the following API changes:
- The
formroute parameter has been removed. - The
dataroute parameter has been introduced. - Forms are now handled via the
dataparameter andFormtype. - Removed the
dataparameter fromRequest. - Added
FromDataconversion trait and default implementation. FromDatais used to automatically derive thedataparameter.Responders are now final: they cannot forward to other requests.Responsers may only forward to catchers.
- Request
uriparameter is private. Useuri()method instead. formmodule moved underrequestmodule.response::datawas renamed toresponse::content.- Introduced
OutcomewithSuccess,Failure, andForwardvariants. outcomemodule moved to top-level.Responseis now a type alias toOutcome.EmptyResponderwas removed.StatusResponderremoved in favor ofresponse::statusmodule.
- Error handlers can now take 0, 1, or 2 parameters.
FromFormderive now works on empty structs.- Lifetimes are now properly stripped in code generation.
- Any valid ident is now allowed in single-parameter route parameters.
- Route is now cloneable.
Requestno longer has any lifetime parameters.Handlertype now includes aDataparameter.httpmodule is public.Responderimplemented for()type as an empty response.- Add
config::get()for global config access. - Introduced
testingmodule. Rocket.tomlallows global configuration via[global]table.
- Added a
raw_uploadexample. - Added a
pastebinexample. - Documented all public APIs.
- Now building and running tests with
--all-featuresflag. - Added appveyor config for Windows CI testing.
- Remove
Rocket::newin favor ofignitemethod. - Remove
Rocket::mount_and_launchin favor of chainingmount(..).launch(). mountandcatchtakeRockettype by value.- All types related to HTTP have been moved into
httpmodule. Template::renderincontribnow takes context by reference.
- Rocket now parses option
Rocket.tomlfor configuration, defaulting to sane values. ROCKET_ENVenvironment variable can be used to specify running environment.
- Document
ContentType. - Document
Request. - Add script that builds docs.
- Scripts can now be run from any directory.
- Cache Cargo directories in Travis for faster testing.
- Check that library version numbers match in testing script.
- Rename
response::data_typetoresponse::data.
- Rocket interprets
_methodfield in forms as the incoming request's method. - Add
Outcome::Badto signify responses that failed internally. - Add a
NamedFileRespondertype that uses a file's extension for the response's content type. - Add a
StreamResponderfor streaming responses.
- Introduce the
contribcrate. - Add JSON support via
JSON, which implementsFromRequestandResponder. - Add templating support via
Templatewhich implementsResponder.
- Initial guide-like documentation.
- Add documentation, testing, and contributing sections to README.
- Add a significant number of codegen tests.