Commit Graph

238 Commits

Author SHA1 Message Date
Sergio Benitez 3ee6e5c758 New version: 0.5.0-rc.4.
New contrib versions: 0.1.0-rc.4.
2023-11-17 16:38:14 +01:00
Sergio Benitez df3a4e0dca Qualm various emerging unused warnings. 2023-11-01 18:50:58 -05:00
Sergio Benitez b6430e9970 Rename 'Outcome::Failure' to 'Outcome::Error'.
The primary motivation is to deconflate the leading `F`s in `Failure` and
`Forward`. In particular, when using a generics, we used `F` for forward, which
could easily be confused for `F` for `Failure`. This resolves the conflation.
2023-11-01 18:50:55 -05:00
Sergio Benitez f38103da60 Update dependencies.
* notify: 5 -> 6
  * indexmap: 1 -> 2
  * cookie: 0.18.0-rc.0 -> 0.18
2023-10-26 20:01:06 -05:00
Sergio Benitez ed56056d0e Update 'cookie' to 0.18. 2023-10-26 20:01:06 -05:00
Sergio Benitez 09cbf2f371 Fix broken links between codegen and http crates.
Also resolves link warnings emitted by rustdoc.

Closes #2594
2023-10-26 20:01:06 -05:00
Sergio Benitez f5c7be24d6 Clarify when 'UriDisplay' can be derived.
Resolves #2595.
2023-10-26 19:54:40 -05:00
Sergio Benitez 35c62ff74a Remove use of 'unsafe' in 'RawStr' doctests. 2023-10-26 19:46:07 -05:00
Sergio Benitez 40410e4365 Add 'mtls::Certificate::as_bytes()' method. 2023-10-26 19:45:44 -05:00
Sergio Benitez b89a0039a7 Update 'state' to 0.6. 2023-10-26 19:41:28 -05:00
Sergio Benitez 4f5a83ba9c Fix missing port parsing in 'Authority'.
If a port part was missing, the 'Authority' parser previously set the
port to `0`. This is incorrect. As in RFC#3986 3.2.3:

> URI producers and normalizers should omit the port component and its
  ":" delimiter if port is empty [..]

This commit fixes the parser's behavior to align with the RFC.
2023-05-05 18:21:17 -07:00
Sergio Benitez 284852db19 Mark '.exe', '.iso', '.dmg' as known extensions.
'EXE' is IANA registered, and the registered media type is used here for
the '.exe' extension.

The '.iso' and '.dmg' extensions do not appear to correspond to any IANA
registered media type, but they have a de facto media type of
"application/octet-stream", and that media type is used by this commit.

Closes #2530.
2023-05-05 18:21:17 -07:00
Sergio Benitez 403604c402 Tidy custom forward status changes, update docs. 2023-05-05 18:21:17 -07:00
Sergio Benitez 03433c10ea Allow specifying 'Status' in custom form errors.
Resolves #1694.
2023-04-05 09:56:49 -07:00
Sergio Benitez fbb0ace529 Update 'rustls' to 0.21, 'tokio-rustls' to 0.24. 2023-03-31 12:08:45 -07:00
Sergio Benitez aa6ad7030a Allow setting mTLS certificates on local 'Client'.
This allows testing with client certificates.

Co-authored-by: Brett Buford <blbuford@gmail.com>
2023-03-31 11:13:40 -07:00
Mai-Lapyst 19e7e82fd6 Initial connection upgrade API implementation. 2023-03-29 17:06:04 -07:00
Sergio Benitez a474fde85b Implement 'De(Serialize)' for 'Status'.
Resolves #2366.
2023-03-26 19:18:04 -07:00
Sergio Benitez 0d8cb1457f Recognize the '.mjs' extension as JavaScript.
Resolves #2479.
2023-03-25 08:58:43 -07:00
Sergio Benitez 999787e3bb Update JavaScript media type to 'text/javascript'.
This reflects RFC9239 and the IANA registry updates.
2023-03-25 08:56:58 -07:00
Sergio Benitez 91f6288ea4 New version: 0.5.0-rc.3.
New contrib versions: 0.1.0-rc.3.
2023-03-23 16:56:17 -07:00
Sergio Benitez 219a8a5468 Fix a bunch of typos. 2023-03-23 16:27:08 -07:00
Sergio Benitez 0a0f540988 Support TLS keys in SEC1 format. 2023-03-23 14:57:54 -07:00
Sergio Benitez daa157f872 Ignore data before TLS key encapsulation boundary.
Resolves #2281.

Co-authored-by: Julian Büttner <me@julianbuettner.dev>
2023-03-23 14:57:54 -07:00
Kian-Meng Ang 06d255b52b Fix a whole bunch of typos.
Found via `codespell -L crate,ser,fo,noo,nd,cappable,pard,te,ans`.
2023-03-23 14:57:54 -07:00
Alexander van Ratingen 2191369b37 Fix typos in docs. 2023-03-23 14:57:54 -07:00
Sergio Benitez bbbb927ac2 Update dependencies without observable breakages.
The following dependencies were updated:
  * `criterion` from 0.3 to 0.4
  * `deadpool-redis` from 0.10 to 0.11
  * `normpath` from 0.3 to 1
  * `cookie` from 0.16 to 0.17
2023-03-22 13:44:16 -07:00
Sergio Benitez 9377af5978 Make real IP header configurable via 'ip_header'.
Adds an `ip_header` configuration parameter that allows modifying the
header Rocket attempts to use to retrieve the "real IP" address of the
client via `Request` methods like `client_ip()`. Additionally allows
disabling the use of any such header.
2023-03-20 12:57:21 -07:00
Aaron Leopold c8b8b2b022 Add several new known media types:
* CBZ: application/vnd.comicbook+zip, .cbz
  * CBR: application/vnd.comicbook-rar, .cbr
  * RAR: application/vnd.rar, .rar
  * EPUB: application/epub+zip, .epub
  * OPF: application/oebps-package+xml, .opf
  * XHTML: application/xhtml+xml, .xhtml
2022-06-13 15:29:32 -07:00
James Tai 2fc4b156eb Add MP3 (audio/mpeg) as a known media type. 2022-06-03 07:30:22 -07:00
Konrad Borowski e390423083 Enable 'cookie' 'secure' feature conditionally.
This was incorrectly enabled unconditionally in 442b668.
2022-05-18 17:29:52 -07:00
Sergio Benitez 68185ce0e2 Update comment in 'Listener' sleep code. 2022-05-18 17:29:21 -07:00
Sergio Benitez 4dcd92837f New version: 0.5.0-rc.2.
New contrib versions: 0.1.0-rc.2.
2022-05-09 06:32:46 -05:00
Sergio Benitez 4c8bd61c4f Unhide 'http' exports that shouldn't be hidden. 2022-05-08 01:08:22 -05:00
Sergio Benitez 0ba56ccbb3 Revamp shutdown to recover shutdown 'Rocket'.
The core improvement is that `Rocket::launch()` now resolves to
`Ok(Rocket<Ignite>)` on nominal shutdown. Furthermore, shutdown never
terminates the running process.

Other changes directly related to shutdown:

  * Runtime worker thread names are now irrelevant to graceful shutdown.
  * `ErrorKind::Runtime` was removed; `ErrorKind::Shutdown` was added.
  * The `force` config value is only read from the default provider.
  * If `force`, Rocket's constructed async runtime is terminated.

Other related changes:

  * The exported `hyper` module docs properly reflect public re-exports.
2022-05-07 06:12:24 -05:00
Arthur Woimbée 4df97f0e25 Improve unrecognized TLS key header error message.
Resolves #2128.
2022-05-05 08:00:24 -05:00
Sergio Benitez 54224618b2 Switch to upstream 'tokio-rustls'. 2022-05-04 09:44:26 -07:00
Sergio Benitez ee4aa81847 Allow '[' and ']' in URI paths.
This is strictly noncompliant and they should be encoded, but browsers
routinely send them unencoded, so we allow them to avoid trouble.
2022-05-04 09:44:24 -07:00
Sergio Benitez 07460df279 Rework TLS listener/connection implementations.
The previous implementation allowed a trivial DoS attack in which the
client need simply maintain open connections with incomplete handshakes.
This commit resolves that by allowing a server worker to progress as
soon as a TCP connection has been established. This comes at the expense
of a more complex implementation necessitated by deficiencies in Hyper.

Potentially resolves #2118.
2022-05-03 13:56:25 -07:00
Sergio Benitez e9d46b917e Fully 'drop()' I/O struct in 'CancellableIo'.
This should improve the reliability of graceful shutdown.
2022-05-03 13:55:43 -07:00
Sergio Benitez bf84b1cdb5 Enable TCP_NODELAY on TCP-based connections.
We may want a more fine-grained approach to immediately transmitting
application data, but Hyper does not yet expose a suitable API.

Resolves #2062.
2022-04-28 13:22:06 -07:00
Sergio Benitez b117210ca6 Update 'rustls-pemfile' to 1.0. 2022-04-26 22:09:10 -07:00
Sergio Benitez 810f472524 Update 'uuid' to 1.0. 2022-04-26 22:04:47 -07:00
Konrad Borowski 7bbe0457a5 Use new 2021 edition functionality.
* Remove `TryInto` and `TryFrom` imports.
  * Replace `IntoIter::new()` with `.into_iter()`.
2022-04-19 18:35:55 -07:00
Konrad Borowski 4d258739f5 Migrate Rocket to Rust 2021 edition. 2022-04-19 18:35:38 -07:00
Sergio Benitez 4d83f73f86 Implement 'Eq' for 'MediaType', 'ContentType'.
This also fixes the 'Hash' implementation to match the docs.

Resolves #2132.
2022-04-19 13:58:30 -07:00
Sergio Benitez 2a7eac01bb Fix 'Segments::to_path_buf()' on Windows. 2022-04-19 13:06:02 -07:00
Sergio Benitez ccf0b802bc Disallow ':' in `PathBuf` guard on Windows.
Fixes #1949.
2022-04-18 18:27:41 -07:00
Edgar Onghena ff7cf68461 Make HTTP/2 optional via 'http2' feature.
Closes #2030.
2022-03-08 15:13:24 -08:00
=?UTF-8?q?R=C3=A9mi=20Lauzier?= f82d760b52 Use 'matches!' macro where possible. 2022-02-23 14:11:44 -08:00