Replace the hyperx ContentLocation header with our own implementation (#603)
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
//! Headers widely used in email messages
|
//! Headers widely used in email messages
|
||||||
|
|
||||||
pub use hyperx::header::{
|
pub use hyperx::header::{
|
||||||
Charset, ContentDisposition, ContentLocation, DispositionParam, DispositionType, Header,
|
Charset, ContentDisposition, DispositionParam, DispositionType, Header, Headers,
|
||||||
Headers,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use self::content_type::{ContentType, ContentTypeErr};
|
pub use self::content_type::{ContentType, ContentTypeErr};
|
||||||
|
|||||||
@@ -88,6 +88,11 @@ text_header! {
|
|||||||
/// defined in [RFC2045](https://tools.ietf.org/html/rfc2045#section-7)
|
/// defined in [RFC2045](https://tools.ietf.org/html/rfc2045#section-7)
|
||||||
Header(ContentId, "Content-ID")
|
Header(ContentId, "Content-ID")
|
||||||
}
|
}
|
||||||
|
text_header! {
|
||||||
|
/// `Content-Location` header,
|
||||||
|
/// defined in [RFC2110](https://tools.ietf.org/html/rfc2110#section-4.3)
|
||||||
|
Header(ContentLocation, "Content-Location")
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_text(raw: &[u8]) -> HyperResult<String> {
|
fn parse_text(raw: &[u8]) -> HyperResult<String> {
|
||||||
if let Ok(src) = from_utf8(raw) {
|
if let Ok(src) = from_utf8(raw) {
|
||||||
|
|||||||
@@ -669,7 +669,7 @@ mod test {
|
|||||||
.body(String::from("<p>Текст <em>письма</em> в <a href=\"https://ru.wikipedia.org/wiki/Юникод\">уникоде</a><p>")))
|
.body(String::from("<p>Текст <em>письма</em> в <a href=\"https://ru.wikipedia.org/wiki/Юникод\">уникоде</a><p>")))
|
||||||
.singlepart(SinglePart::builder()
|
.singlepart(SinglePart::builder()
|
||||||
.header(header::ContentType::parse("image/png").unwrap())
|
.header(header::ContentType::parse("image/png").unwrap())
|
||||||
.header(header::ContentLocation("/image.png".into()))
|
.header(header::ContentLocation::from(String::from("/image.png")))
|
||||||
.header(header::ContentTransferEncoding::Base64)
|
.header(header::ContentTransferEncoding::Base64)
|
||||||
.body(String::from("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"))))
|
.body(String::from("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"))))
|
||||||
.singlepart(SinglePart::builder()
|
.singlepart(SinglePart::builder()
|
||||||
|
|||||||
Reference in New Issue
Block a user