All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- The size of several structs has been slightly decreased, reducing memory usage
- The SIMD algorithms have been improved and support for them is now detected at runtime. The
simd
feature flag is deprecated getrandom
was updated to 0.3
- Fixed an issue where a pending
poll_flush
call by a writer would stall infinitely ifpoll_next
was called at the same time (see #92)
- The SIMD masking code now supports AltiVec on PowerPC targets (nightly only)
WebSocketStream::{get_ref, get_mut}
allow access to the underlying I/Oclient::DISALLOWED_HEADERS
is a list of headers that may not be added viaClientBuilder::add_header
CloseCode::is_reserved
returns whether the close code is reserved (i.e. may not be sent over the wire)
- [breaking]
ServerBuilder::accept
now returns the client's HTTP request alongside the websocket stream in a tuple - [breaking]
ClientBuilder::add_header
now returns aResult
and errors when adding a disallowed header - [breaking]
Message::close
will now panic when the close code is reserved or the reason exceeds 123 bytes - [breaking]
Message::{ping, pong}
will now panic when the payload exceeds 125 bytes rustls-platform-verifier
was updated to 0.5- The SIMD masking code is now more efficient
- Fixed compilation with SIMD on 32-bit x86 targets
- 32-bit ARM NEON is unstable in rustc and now correctly gated behind the
nightly
feature
- The new
rustls-bring-your-own-connector
feature allows for creating aConnector::Rustls
instance without pulling in any other certificate roots - The sink flush threshold is now configurable via
Config::flush_threshold
Config::frame_size
now panics when the frame size is set to 0- Reduced the number of allocations which was caused by a misunderstanding of
BytesMut::reserve
internals, improving throughput by up to 30% - The number of pending bytes to be written is no longer calculated in a potentially expensive loop in
poll_ready
, but rather tracked as messages are queued
- Fixed a case of possible UB in the UTF-8 validator discovered by the new fuzzer (@finnbear)
- The UTF-8 validator now uses the faster validation for partial codepoints as intended, earlier this was only the case if the number of bytes available matched the number expected
Error::NoNativeRootCertificatesFound
was added and is returned inTlsConnector::new
if no native root certificates were found and the rustls-webpki-roots feature is not enabled
- If no crypto provider is specified via crate features, tokio-websockets will now try to use the installed default provider in rustls
TlsConnector::new
is now always available- [breaking]
Error::NoTlsConnectorConfigured
was removed and replaced byError::NoCryptoProviderConfigured
rustls-native-certs
was updated to 0.8
- Fixed an issue where connecting to an IPv6 address would fail
- Specify the actual minimum version required of rustls-platform-verifier
Payload
now implementsFrom<Vec<u8>>
Payload
now also implementsInto<BytesMut>
, which is a cheap conversion unless multiple references to the backing buffer exist
- [breaking] The MSRV is now 1.79, allowing use of
split_at_mut_unchecked
to make some unsafe code less error prone - [breaking] The minimum required version of bytes is now 1.7
- [breaking] The
Resolver
trait now uses async fn syntax - The
From<String>
implementation onPayload
now usesBytesMut
internally, improving performance in some cases - The
From<Bytes>
implementation onPayload
now usesBytesMut
internally if cheaply possible, improving performance in some cases
- Fixed an unsafe precondition violation triggered upon receiving close messages with empty reason
- Yet another docs.rs build fix
- Added support for
rustls-platform-verifier
via a feature with the same name
- Fixed the docs.rs build
- Support for
aws_lc_rs
as a SHA1 and crypto provider was added via theaws_lc_rs
feature, optionally also FIPS-compliant via thefips
feature - The new
rustls-tls12
feature will enable TLS1.2 support in rustls
- [breaking] The rustls dependency was updated to 0.23 and tokio-rustls to 0.26
- [breaking] The minimum required version of tokio-util is now 0.7.3
- A bunch of leftover unused
Encoder
implementations and the associated write buffers were removed - The
client
feature no longer depends ontokio/rt
- The
nightly
feature now enables thestdarch_x86_avx512
nightly feature only on x86_64 instead of all architectures - The documentation for
Config::frame_size
was ambiguous about whether it affected the payload size or the entire frame size, this has been clarified to be the payload size
- The
http-integration
feature and associatedupgrade_request
method were removed, it offered little to no value over manually crafting a request and bloated the dev-dependency stack unnecessarily
- [breaking] The future returned from
Resolver::resolve
is now required to beSend
. This restores backwards compatibility with 0.5.x
Payload
now implementsFrom<&'static [u8]>
andFrom<&'static str>
- The
ClientBuilder
now allows specifying a DNS resolver that implements theResolver
trait viaClientBuilder::resolver
, stored as a generic on the builder. It defaults toresolver::Gai
, which matches behavior on previous versions
- [breaking]
ClientBuilder::connect
now returns anError::UnsupportedScheme
if the URI does not set the scheme tows
orwss
- [breaking]
ClientBuilder::connect
will no longer unconditionally use the specified custom connector, instead it will always use a plain connector for thews
scheme - [breaking] The
nightly
feature now uses the newstdsimd
feature instead ofstdarch_x86_avx512
, which was removed in recent nightly compiler versions
- The
Debug
implementation ofConnector
now prints the correct name of theRustls
variant - The header buffer size in the built-in server was increased to 64, which allows clients sending larger amounts of headers to connect
- Fixed a case of UB when a message was constructed via
Message::text
with invalid UTF-8 and then converted to a&str
viaMessage::as_text
. This will now cause a panic
Message::text
now takesInto<Payload>
instead ofString
, which now implementsInto<Payload>
- Updated
http
to 1.0 andrustls
-related dependencies to those compatible withrustls
0.22 - [breaking]
ring
is now an optional dependency withrustls
and different crypto providers can be used - Optimized
simdutf8
feature flags for aarch64
- [breaking]
upgrade_request
no longer uses an explicit body type, now it only requires the body to implementDefault
- [breaking]
WebsocketStream
has been renamed toWebSocketStream
- [breaking]
Message
payloads are now exposed asPayload
and it is possible to create messages fromBytes
-backed payloads - Removed a few excess allocations in hot paths
- Fixed issues with the close sequence handling
- Fixed invalid opcode errors when intermediate control frames were received
- Update
webpki
to 0.24,webpki-roots
to 0.25 andrust-webpki
to 0.101
- Added support for NEON-accelerated frame (un)masking
- Added support for AVX512-accelerated frame (un)masking, gated behind the
nightly
feature flag and requires a nightly compiler - Limits for payload length can be applied via
{ClientBuilder, ServerBuilder}::limits
to protect against malicious peers - The websocket stream can now be configured via
{ClientBuilder, ServerBuilder}::config
. This currently only supports changing the frame payload size that outgoing messages are chunked into
- The crate now specifies and validates a MSRV of Rust 1.64
- The library now validates UTF-8 in partial continuation frames to a text message
- Several types now implement
Debug
- The performance of the decoder has been improved
- The encoder is now usually zero-copy and operates in-place when possible
- Reduced the amount of calls to
fastrand
upgrade::Error
is now publicly accessible and can thus be matched on- [breaking]
ClientBuilder
methods which perform a handshake now return a tuple of(WebsocketStream, Response)
to retrieve e.g. response headers - [breaking]
WebsocketStream
is now fully cancellation safe and implementsStream
, therefore usingWebsocketStream::next
now requires havingStreamExt
in scope - [breaking]
CloseCode
is now a wrapper around aNonZeroU16
instead of an enum. Enum variants have been moved to associated constants. This fixes possible creation of disallowed close codes by the user - [breaking] All error types are now marked as
non_exhaustive
to prevent consumer build breakage when new variants are added - [breaking] Emptied default features
- [breaking]
{ClientBuilder, ServerBuilder}::fail_fast_on_invalid_utf8
has been removed and is now always enabled because our implementation for streaming UTF-8 validation is already efficient enough, benchmarks show no gains anymore - [breaking] Some error variants have been removed and coalesced into other variants (mostly into
InvalidOpcode
).ConnectionClosed
has been entirely removed in favor of returningNone
frompoll_next
because it is more idiomatic - [breaking]
WebsocketStream::close
has been removed. TheSinkExt::close
implementation will send a default close message and properly shut down the sink. Custom close messages can be sent viaSinkExt::send
followed bySinkExt::close
- The
futures-util
dependency has been removed
- A few inconsistencies with the websocket RFC have been fixed