1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

update all IETF RFC links to new URL format

This commit is contained in:
Rob Ede
2021-12-01 19:42:02 +00:00
parent 697238fadc
commit 0df275c478
27 changed files with 163 additions and 184 deletions

View File

@ -1,9 +1,8 @@
use std::fmt::{self, Display};
use std::str::FromStr;
use std::{fmt, str};
use self::Charset::*;
/// A Mime charset.
/// A MIME character set.
///
/// The string representation is normalized to upper case.
///
@ -95,13 +94,13 @@ impl Charset {
}
}
impl Display for Charset {
impl fmt::Display for Charset {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.label())
}
}
impl FromStr for Charset {
impl str::FromStr for Charset {
type Err = crate::Error;
fn from_str(s: &str) -> Result<Charset, crate::Error> {

View File

@ -24,8 +24,8 @@ pub struct ExtendedValue {
pub value: Vec<u8>,
}
/// Parses extended header parameter values (`ext-value`), as defined in
/// [RFC 5987](https://tools.ietf.org/html/rfc5987#section-3.2).
/// Parses extended header parameter values (`ext-value`), as defined
/// in [RFC 5987 §3.2](https://datatracker.ietf.org/doc/html/rfc5987#section-3.2).
///
/// Extended values are denoted by parameter names that end with `*`.
///
@ -34,7 +34,7 @@ pub struct ExtendedValue {
/// ```text
/// ext-value = charset "'" [ language ] "'" value-chars
/// ; like RFC 2231's <extended-initial-value>
/// ; (see [RFC2231], Section 7)
/// ; (see [RFC 2231 §7])
///
/// charset = "UTF-8" / "ISO-8859-1" / mime-charset
///
@ -43,22 +43,26 @@ pub struct ExtendedValue {
/// / "!" / "#" / "$" / "%" / "&"
/// / "+" / "-" / "^" / "_" / "`"
/// / "{" / "}" / "~"
/// ; as <mime-charset> in Section 2.3 of [RFC2978]
/// ; as <mime-charset> in [RFC 2978 §2.3]
/// ; except that the single quote is not included
/// ; SHOULD be registered in the IANA charset registry
///
/// language = <Language-Tag, defined in [RFC5646], Section 2.1>
/// language = <Language-Tag, defined in [RFC 5646 §2.1]>
///
/// value-chars = *( pct-encoded / attr-char )
///
/// pct-encoded = "%" HEXDIG HEXDIG
/// ; see [RFC3986], Section 2.1
/// ; see [RFC 3986 §2.1]
///
/// attr-char = ALPHA / DIGIT
/// / "!" / "#" / "$" / "&" / "+" / "-" / "."
/// / "^" / "_" / "`" / "|" / "~"
/// ; token except ( "*" / "'" / "%" )
/// ```
///
/// [RFC 2231 §7]: https://datatracker.ietf.org/doc/html/rfc2231#section-7
/// [RFC 2978 §2.3]: https://datatracker.ietf.org/doc/html/rfc2978#section-2.3
/// [RFC 3986 §2.1]: https://datatracker.ietf.org/doc/html/rfc5646#section-2.1
pub fn parse_extended_value(
val: &str,
) -> Result<ExtendedValue, crate::error::ParseError> {

View File

@ -224,7 +224,7 @@ mod tests {
}
}
impl FromStr for Encoding {
impl str::FromStr for Encoding {
type Err = crate::error::ParseError;
fn from_str(s: &str) -> Result<Encoding, crate::error::ParseError> {
use Encoding::*;

View File

@ -13,8 +13,10 @@ where
T: FromStr,
{
let mut result = Vec::new();
for h in all {
let s = h.to_str().map_err(|_| ParseError::Header)?;
result.extend(
s.split(',')
.filter_map(|x| match x.trim() {