summaryrefslogtreecommitdiffstats
path: root/third_party/rust/headers-core
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /third_party/rust/headers-core
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/headers-core')
-rw-r--r--third_party/rust/headers-core/.cargo-checksum.json1
-rw-r--r--third_party/rust/headers-core/Cargo.toml24
-rw-r--r--third_party/rust/headers-core/LICENSE20
-rw-r--r--third_party/rust/headers-core/README.md3
-rw-r--r--third_party/rust/headers-core/src/lib.rs68
5 files changed, 116 insertions, 0 deletions
diff --git a/third_party/rust/headers-core/.cargo-checksum.json b/third_party/rust/headers-core/.cargo-checksum.json
new file mode 100644
index 0000000000..6f620b6936
--- /dev/null
+++ b/third_party/rust/headers-core/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.toml":"867882ab200e7a013c0fa158823bca309652112b4d1666aab4e2c89cb88676bb","LICENSE":"ee0f7b3693a4878ac89b5c34674a3f1208dc6dd96e201e8c1f65f55873ec38d8","README.md":"957e16f30d33c262cdbc2eb7d13e6c11314f36ae0351935621a9ff0df078f005","src/lib.rs":"27846161575183b5de0b12d511003e55d97d16fc3882666104d50fa046608777"},"package":"e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429"} \ No newline at end of file
diff --git a/third_party/rust/headers-core/Cargo.toml b/third_party/rust/headers-core/Cargo.toml
new file mode 100644
index 0000000000..9c8ea8be8f
--- /dev/null
+++ b/third_party/rust/headers-core/Cargo.toml
@@ -0,0 +1,24 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+name = "headers-core"
+version = "0.2.0"
+authors = ["Sean McArthur <sean@seanmonstar.com>"]
+description = "typed HTTP headers core trait"
+homepage = "https://hyper.rs"
+readme = "README.md"
+keywords = ["http", "headers", "hyper", "hyperium"]
+license = "MIT"
+repository = "https://github.com/hyperium/headers"
+[dependencies.http]
+version = "0.2.0"
diff --git a/third_party/rust/headers-core/LICENSE b/third_party/rust/headers-core/LICENSE
new file mode 100644
index 0000000000..aa33b8e736
--- /dev/null
+++ b/third_party/rust/headers-core/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2014-2019 Sean McArthur
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
diff --git a/third_party/rust/headers-core/README.md b/third_party/rust/headers-core/README.md
new file mode 100644
index 0000000000..a57c7ff3ec
--- /dev/null
+++ b/third_party/rust/headers-core/README.md
@@ -0,0 +1,3 @@
+# Typed HTTP Headers: core `Header` trait
+
+WIP
diff --git a/third_party/rust/headers-core/src/lib.rs b/third_party/rust/headers-core/src/lib.rs
new file mode 100644
index 0000000000..92e3d15ea0
--- /dev/null
+++ b/third_party/rust/headers-core/src/lib.rs
@@ -0,0 +1,68 @@
+#![deny(missing_docs)]
+#![deny(missing_debug_implementations)]
+#![cfg_attr(test, deny(warnings))]
+#![doc(html_root_url = "https://docs.rs/headers-core/0.2.0")]
+
+//! # headers-core
+//!
+//! This is the core crate of the typed HTTP headers system, providing only
+//! the relevant traits. All actual header implementations are in other crates.
+
+extern crate http;
+
+pub use http::header::{self, HeaderName, HeaderValue};
+
+use std::error;
+use std::fmt::{self, Display, Formatter};
+
+/// A trait for any object that will represent a header field and value.
+///
+/// This trait represents the construction and identification of headers,
+/// and contains trait-object unsafe methods.
+pub trait Header {
+ /// The name of this header.
+ fn name() -> &'static HeaderName;
+
+ /// Decode this type from an iterator of `HeaderValue`s.
+ fn decode<'i, I>(values: &mut I) -> Result<Self, Error>
+ where
+ Self: Sized,
+ I: Iterator<Item = &'i HeaderValue>;
+
+ /// Encode this type to a `HeaderMap`.
+ ///
+ /// This function should be infallible. Any errors converting to a
+ /// `HeaderValue` should have been caught when parsing or constructing
+ /// this value.
+ fn encode<E: Extend<HeaderValue>>(&self, values: &mut E);
+}
+
+/// Errors trying to decode a header.
+#[derive(Debug)]
+pub struct Error {
+ kind: Kind,
+}
+
+#[derive(Debug)]
+enum Kind {
+ Invalid,
+}
+
+impl Error {
+ /// Create an 'invalid' Error.
+ pub fn invalid() -> Error {
+ Error {
+ kind: Kind::Invalid,
+ }
+ }
+}
+
+impl Display for Error {
+ fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ match &self.kind {
+ Kind::Invalid => f.write_str("invalid HTTP header"),
+ }
+ }
+}
+
+impl error::Error for Error {}