Commit Graph

2426 Commits

Author SHA1 Message Date
Sergio Benitez 38dbab8dd3 Bump MSRV to 1.75 for `async fn` in traits. 2024-01-30 09:18:43 -08:00
Sergio Benitez fd294049c7 Update to hyper 1. Enable custom + unix listeners.
This commit completely rewrites Rocket's HTTP serving. In addition to
significant internal cleanup, this commit introduces the following major
features:

  * Support for custom, external listeners in the `listener` module.

    The new `listener` module contains new `Bindable`, `Listener`, and
    `Connection` traits which enable composable, external
    implementations of connection listeners. Rocket can launch on any
    `Listener`, or anything that can be used to create a listener
    (`Bindable`), via a new `launch_on()` method.

  * Support for Unix domain socket listeners out of the box.

    The default listener backwards compatibly supports listening on Unix
    domain sockets. To do so, configure an `address` of
    `unix:path/to/socket` and optional set `reuse` to `true` (the
    default) or `false` which controls whether Rocket will handle
    creating and deleting the unix domain socket.

In addition to these new features, this commit makes the following major
improvements:

  * Rocket now depends on hyper 1.

  * Rocket no longer depends on hyper to handle connections. This allows
    us to handle more connection failure conditions which results in an
    overall more robust server with fewer dependencies.

  * Logic to work around hyper's inability to reference incoming request
    data in the response results in a 15% performance improvement.

  * `Client`s can be marked secure with `Client::{un}tracked_secure()`,
    allowing Rocket to treat local connections as running under TLS.

  * The `macros` feature of `tokio` is no longer used by Rocket itself.
    Dependencies can take advantage of this reduction in compile-time
    cost by disabling the new default feature `tokio-macros`.

  * A new `TlsConfig::validate()` method allows checking a TLS config.

  * New `TlsConfig::{certs,key}_reader()`,
    `MtlsConfig::ca_certs_reader()` methods return `BufReader`s, which
    allow reading the configured certs and key directly.

  * A new `NamedFile::open_with()` constructor allows specifying
    `OpenOptions`.

These improvements resulted in the following breaking changes:

  * The MSRV is now 1.74.
  * `hyper` is no longer exported from `rocket::http`.
  * `IoHandler::io` takes `Box<Self>` instead of `Pin<Box<Self>>`.
    - Use `Box::into_pin(self)` to recover the previous type.
  * `Response::upgrade()` now returns an `&mut dyn IoHandler`, not
    `Pin<& mut _>`.
  * `Config::{address,port,tls,mtls}` methods have been removed.
    - Use methods on `Rocket::endpoint()` instead.
  * `TlsConfig` was moved to `tls::TlsConfig`.
  * `MutualTls` was renamed and moved to `mtls::MtlsConfig`.
  * `ErrorKind::TlsBind` was removed.
  * The second field of `ErrorKind::Shutdown` was removed.
  * `{Local}Request::{set_}remote()` methods take/return an `Endpoint`.
  * `Client::new()` was removed; it was previously deprecated.

Internally, the following major changes were made:

  * A new `async_bound` attribute macro was introduced to allow setting
    bounds on futures returned by `async fn`s in traits while
    maintaining good docs.

  * All utility functionality was moved to a new `util` module.

Resolves #2671.
Resolves #1070.
2024-01-29 22:38:55 -08:00
Sergio Benitez e9b568d9b2 Fixup docs for 'proxy_proto_header'. 2024-01-22 18:41:20 -08:00
Arjen 5c85ea3db5 Support configurable 'X-Forwarded-Proto'.
Co-authored-by: Sergio Benitez <sb@sergio.bz>
2024-01-22 18:41:20 -08:00
Sergio Benitez 5034ff0d1a Update handlebars version in dyn_templates docs. 2024-01-17 21:41:25 -08:00
Alessandro Campeis dca3afcd77 Update 'handlebars' to v5.1. 2024-01-17 21:41:25 -08:00
Sergio Benitez 105f058e9d Update project sponsors. 2024-01-17 21:41:25 -08:00
Sergio Benitez 915c1181da Forward whole-form errors in 'FromForm' derive.
Resolves #2672.
2024-01-17 12:15:01 -08:00
Sergio Benitez de6a4c50ec Clarify route ranking in requests guide.
Closes #2687.
2024-01-17 10:52:00 -08:00
Sergio Benitez b3abc760ae Introduce chainable data transformers.
Resolves #775.
2023-12-27 20:02:14 -08:00
Sergio Benitez a285625f80 Upgrade 'smallvec' to simplify 'Accept' impl. 2023-12-23 23:34:23 -08:00
Sergio Benitez 3e33cfe37c Remove custom 'docify!' macro: use '#[doc]`. 2023-12-22 23:42:55 -08:00
Paul Lietar 67ad8316dc Ensure 'TempFile' flushes when persisted.
Tokio's `File::write_all()` method has an unexpected quirk: it doesn't
actually write all the requested content to the file when the returned
future resolves. Instead, the write is attempted and queued. This means
that the `persist()` method can resolve without the data being persisted
to the file system. Subsequent reads of the ostensibly written-to file
can thus fail to contain the expected data.

An call to `flush()` following `write_all()` would circumvent the issue.
Alternatively, calling `fs::write()` actually writes to the file system
before returning and requires fewer lines of code. This commit thus
swaps the call to `write_all()` with `fs::write()`.
2023-12-19 16:01:00 -08:00
Martyn ae7e0040e8 Document "reconnect ad-infinitum" SSE pitfall. 2023-12-19 14:41:28 -08:00
Failpark 3690412aba Fix fairing naming in database MySQL example. 2023-12-19 14:33:40 -08:00
Sergio Benitez 7cf8b1368f Doc, fix, and test 'cli_colors' deserialization. 2023-12-18 16:37:56 -08:00
Lev Kokotov f4e8987a46 Make 'cli_colors' an enum, add "always" option.
Resolves #2649.
2023-12-18 16:34:13 -08:00
Mathew Horner 1b089bdb63 Fix git repository URLs in contrib crates. 2023-12-18 15:44:00 -08:00
cui fliter 485c490b1f Fix typos: 'preceeding', 'occured'. 2023-12-18 15:39:09 -08:00
Sergio Benitez b5278de795 Update 'deadpool' to 0.10.
Also updates:

  * 'deadpool-postgres'  to 0.12
  * 'deadpool-redis'  to 0.14
2023-12-15 17:23:24 -08:00
Sergio Benitez 634ba40d38 Update 'tungstenite' to '0.21'. 2023-12-15 16:58:00 -08:00
Sergio Benitez 9c2b74b23c Upgrade 'rustls' to '0.22'.
In the process, the following improvements were also made:

  * Error messages related to TLS were improved.
  * 'Redirector' in 'tls' example was improved.
2023-12-15 16:50:08 -08:00
Sergio Benitez a59f3c4c1f Fix min dependency versions. Update MSRV to 1.64.
Also includes a work-around for a buggy `format_args!` macro found in
rustc 1.67 and 1.68.

Resolves #2670.
2023-12-13 17:49:05 -08:00
Sergio Benitez 92a2559a9a Set 'img' width, height to decrease layout jitter. 2023-12-08 13:59:21 -08:00
Sergio Benitez bae8216cd4 Enable templateless issue creation. 2023-12-06 16:49:39 -08:00
Sergio Benitez 93591a87a3 Upgrade to GitHub issue forms. 2023-12-06 16:48:02 -08:00
Sergio Benitez 8d9dfcecad Silence more warnings in generated code.
Resolves #2655.
2023-12-05 17:55:56 -08:00
Sergio Benitez 7f7d352e45 Add '.rustfmt.toml' disabling formatting. 2023-11-28 10:22:22 +01:00
Sergio Benitez 2b8d6d3f06 Update data for site refresh. 2023-11-27 15:01:44 +01:00
Sergio Benitez e526fa04d4 Update 'SergioBenitez/Rocket' to 'rwf2/Rocket'.
Resolves rwf2/rwf2#5.
2023-11-21 16:32:25 +01:00
Sergio Benitez e81f6c8323 Set prelease config setting to true. 2023-11-21 16:27:04 +01:00
Sergio Benitez 9a04cff9c0
Add GitHub FUNDING file. 2023-11-21 07:21:19 -08:00
Sergio Benitez 89a2af179b Use versioned URIs in news articles. 2023-11-18 11:45:35 +01:00
Sergio Benitez 99849bd563 Add placeholder v0.5 to v0.6 upgrade guide. 2023-11-18 11:45:23 +01:00
Sergio Benitez 44ac3f1eb6 Move to 0.6.0-dev on master. 2023-11-18 11:30:50 +01:00
Sergio Benitez aabf856de4 Fix various typos in v0.5 news and guide. 2023-11-18 11:03:44 +01:00
Sergio Benitez c6d7016146 New version: 0.5.0. 2023-11-18 11:03:40 +01:00
Sergio Benitez b70c237461 Polish news for v0.5. Add RWF2 announcement. 2023-11-17 17:05:05 +01:00
Sergio Benitez f7a6c8610e Update FAQ for 0.5.0. 2023-11-17 17:05:02 +01:00
Sergio Benitez 6d467564d6 Update version numbers for 0.5.0. 2023-11-17 17:04:59 +01:00
Sergio Benitez 6bcab27101 Initial news article for v0.5 release. 2023-11-17 17:04:56 +01:00
Sergio Benitez f25954fef0 Add WebSocket section to upgrading guide. 2023-11-17 17:04:54 +01:00
Sergio Benitez e6985c50e8 Add 0.5.0 CHANGELOG entry. 2023-11-17 17:04:52 +01:00
Sergio Benitez 124ec94b46 Fix typos.
Co-authored-by: cui fliter <imcusg@gmail.com>
2023-11-17 17:04:49 +01:00
Sergio Benitez 0d48743bd8 Fix broken site links. 2023-11-17 17:04:47 +01:00
Sergio Benitez a1c29c735c New version: 0.5.0-rc.4.
New contrib versions: 0.1.0-rc.4.
2023-11-17 17:04:44 +01:00
Sergio Benitez 3a935c2c22 Add CHANGELOG for 0.5.0-rc.4. 2023-11-17 17:04:42 +01:00
Juhasz Sandor 1c3342d5af Update 'diesel-async' to '0.4.1'. 2023-11-17 16:15:54 +01:00
Sergio Benitez 15637186ba Document '&[u8]' form/data guard, limits. 2023-11-01 18:51:26 -05:00
Benjamin B f14f93afa7 Fix typo in pastebin tutorial: 'route' -> 'wrote'. 2023-11-01 17:41:48 -05:00