NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #1220 most downloaded on crates.io
Common types for HTTP operations.
Last release 5 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 3 months
Some releases are documented
notes for 10 of 22 stable releases
1 version withdrawn
withdrawn after publishing
7 years old
23 releases · first in 2019
AsRef<anyhow::Error> for http_types::Error
AsRef<anyhow::Error> for http_types::ErrorFrom<Vec<HeaderValue>> for HeaderValuesTryFrom<> conversions for the "hyperium_http" feature.http-types provides shared types for HTTP operations. It combines a performant, streaming interface with convenient methods for creating headers, urls
http-types provides shared types for HTTP operations. It combines a performant, streaming interface with convenient methods for creating headers, urls, and other standard HTTP types. This is part of the http-rs project and powers the tide framework and surf client. Check out the docs or join us on Zulip.
This release fixes an unconditional panic in the hyperium_http compatibility feature.
The http-types 3.0 merge window remains open, and you can see the nominated items for the next major version as part of the Semver-Major issue on GitHub.
hyperium_http: Avoids unconditional panic when translating headers from hyperium. #359One column per quarter.
This is a looser restriction and is not a breaking change. See serde's documentation on the subject .
http-types provides shared types for HTTP operations. It combines a performant, streaming interface with convenient methods for creating headers, urls, and other standard HTTP types. This is part of the http-rs project and powers the tide framework and surf client. Check out the docs or join us on Zulip.
This release represents continued support of the http-types 2.x release line due to delays in the development of http-types 3.0.0. This release comes with several convenience features, listed below.
The http-types 3.0 merge window remains open, and you can see the nominated items for the next major version as part of the Semver-Major issue on GitHub.
Request.query() to deserialize into a borrowed Deserialize<'de> rather than just DeserializeOwned. #333
Body::chain() for merge multiple Body instances. #342, #346AsRef<str> for Version, returning 'static str. #351Error::from_debug(), a helper for converting from std::error::Errors. #345Error::from_display, a helper for converting from std::error::Errors. #345Content-Encoding and Transfer-Encoding. #354http-types provides shared types for HTTP operations. It combines a performant, streaming interface with convenient methods for creating headers, urls
http-types provides shared types for HTTP operations. It combines a performant, streaming interface with convenient methods for creating headers, urls, and other standard HTTP types. This is part of the http-rs project and powers the tide and surf frameworks. Check out the docs or join us on Zulip.
This release introduces several new typed headers:
transfer::TransferEncoding: The form of encoding used to safely transfer the payload body to the user.transfer::TE: Client header advertising the transfer encodings the user agent is willing to accept.other::RetryAfter: Indicate how long the user agent should wait before making a follow-up request.other::Referer: Contains the address of the page making the request.content::Accept: Client header advertising which media types the client is able to understand.content::ContentType: Indicate the media type of a resource's content.Most notably is probably the RetryAfter header, which can be used to enable load-shedding on the client. An example of such a middleware has been authored for Tide.
This marks the final release of the 2.x release line of http-types. It's been almost a year since our last major release, and we've decided to open up the merge window for http-types 3.0 now that 2.10.0 has shipped. You can see the nominated items for the next major version as part of the Semver-Major issue on GitHub.
Because this is the first major release of http-types we're doing since we moved to our monthly release cadence, we're not entirely sure yet how we'll manage this. Perhaps next month's release may be a beta release. Or we may delay doing a release at all until all items have been merged. We'll have to see, but once 3.0 is out we'll resume the monthly release cadence.
Retry-After type header #314"cookies" feature #306Transfer-Encoding and TE headers #301other::SourceMap header #278other::Referer header #277content::{Accept, ContentType} headers #270TryFrom<str> for Url implementation #294Stabilize support for protocol upgrades on Response #291
This patch adds support for cache::ClearSiteData , content::ContentLocation and implements ToHeaderValues for more string types. This continues our pr
This patch adds support for cache::ClearSiteData, content::ContentLocation and implements ToHeaderValues for more string types. This continues our progress on implementing typed headers. We're currently at 50/70 implemented, and expect to be finishing up in the near future. At which point we can start to integrate these into higher-level crates such as tide and surf.
ToHeaderValues for more string types #279cache::ClearSiteData header #265content::ContentLocation header #256, #276This patch adds support for auth typed headers, enables our enums to be serialized and deserialized through serde , and fixes a bug in our Method stri
This patch adds support for auth typed headers, enables our enums to be serialized and deserialized through serde, and fixes a bug in our Method string parser.
This patch introduces type-safe headers for authentication. The core headers are auth::{Authorization, AuthenticationScheme, WwwAuthenticate} which enable a server to request a client to authenticate, and for the client to construct authentication. However for convenience we've added support for the BasicAuth authentication scheme, making it straight forward to add some authentication to your application.
The plan for typed headers is to enable higher-level middleware to be written for them. As you can see in the example below, while application authors no longer need to deal with correctly parsing and encoding headers it's not exactly convenient yet. We're currently about halfway through implementing encoders and parsers for all known typed headers. And once that's complete it'll enable us to iterate on convenient features and middleware in the tide and surf frameworks.
However for now, here's a simplified example of how to use the new BasicAuth typed headers with the tide server:
use tide::http::auth::{AuthenticationScheme, BasicAuth, WwwAuthenticate};
use tide::http::ensure_eq;
use tide::sessions::{MemoryStore, SessionMiddleware};
use tide::{Request, Response};
// Global variables for the example; don't do this in a production setting
const SECRET: &[u8] = b"shhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh";
const USERNAME: &str = "nori";
const PASSWORD: &str = "ilovefish";
const USER_ID: &str = "12";
// Setup a Tide app with a single endpoint that requires authentication
#[async_std::main]
async fn main() -> Result<(), std::io::Error> {
tide::log::start();
let mut app = tide::new();
app.with(SessionMiddleware::new(MemoryStore::new(), SECRET));
app.at("/").get(login);
app.listen("127.0.0.1:8080").await?;
Ok(())
}
// An endpoint that validates the credentials on a request
// and marks a session as authenticated if they pass
async fn login(mut req: Request<()>) -> tide::Result {
let session = req.session();
// Check if we're already logged in
if let Some(_) = session.get::<String>("user_id") {
return Ok("Already logged in!".into());
}
// Check if credentials are passed; if not request them.
let auth = match BasicAuth::from_headers(&req)? {
Some(auth) => auth,
None => {
let schema = AuthenticationScheme::Basic;
let realm = "access the tuna mainframe";
let auth = WwwAuthenticate::new(schema, realm.into());
return Ok(Response::builder(401)
.header(auth.name(), auth.value())
.build());
}
};
// Validate the username and password. In a real application we'd
// validate the hashed password from a database. This is an example only.
ensure_eq!(auth.username(), USERNAME, "unknown username");
ensure_eq!(auth.password(), PASSWORD, "incorrect password");
// If validation succeeded, mark the session as validated.
let session = req.session_mut();
session.insert("user_id", USER_ID)?;
// Print a success message
Ok("Login successful!".into())
}serde::Deserialize and serde::Serialize impls for Version, StatusCode and Method #262auth::Authorization #252auth::AuthenticationScheme #252auth::BasicAuth #252auth::WwwAuthenticate #252auth::ProxyAuthorization #252auth::ProxyAuthenticate #252Method::parse case insensitive #261This patch introduces various new typed headers, and a feature flag to disable the async-std dependency.
This patch introduces various typed headers for content-negotiation, proxying, and makes it easier to work with statuscodes in errors.
This patch introduces various typed headers for content-negotiation, proxying, and makes it easier to work with statuscodes in errors.
contains to HeaderValues. #240content::AcceptEncoding. #232conditional::Vary #225conditional::{IfMatch, IfNoneMatch} #224conditional::{IfModifiedSince, IfUnmodifiedSince, LastModified} #222proxies::Forwarded header #221cache::Expires #220cache::Age header #219Error::type_name #213Error::set_status to take TryInto<StatusCode> #249Error::new to take TryInto<StatusCode> #216main #226TimingAllowOrigin to security submodule #217This patch introduces various unstable trace typed headers, adds a From<&str> impl for Mime , and includes a minor performance improvement.
This patch introduces various unstable trace typed headers, adds a From<&str> impl for Mime, and includes a minor performance improvement.
trace::ServerTiming as "unstable" #203From<&str> for Mime #179trace::AllowOrigin as "unstable" #209Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →