### Iterate HeaderMap Values Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=u32+-%3E+bool Demonstrates how to iterate over the values of a HeaderMap. This example shows inserting multiple values for the same header and then printing all associated values. ```rust let mut map = HeaderMap::new(); map.insert(HOST, "hello".parse().unwrap()); map.append(HOST, "goodbye".parse().unwrap()); map.insert(CONTENT_LENGTH, "123".parse().unwrap()); for value in map.values() { println!("{:?}", value); } ``` -------------------------------- ### Constructing and Manipulating ResponseHeader Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.ResponseHeader.html?search=u32+-%3E+bool Examples of creating a ResponseHeader instance and modifying its contents using append and insert methods. These methods allow for flexible header management with or without case preservation. ```rust use pingora_http::ResponseHeader; // Create a new header with status 200 let mut resp = ResponseHeader::build(200, None).unwrap(); // Append a header (allows duplicates) resp.append_header("X-Custom-Header", "value1").unwrap(); // Insert a header (replaces existing headers of same name) resp.insert_header("Content-Type", "application/json").unwrap(); // Set status code resp.set_status(201).unwrap(); ``` -------------------------------- ### Insert entries into HeaderMap Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search= Provides examples for inserting key-value pairs using both the standard insert method and the fallible try_insert method, which handles capacity constraints. ```Rust let mut map = HeaderMap::new(); assert!(map.insert(HOST, "world".parse().unwrap()).is_none()); assert!(!map.is_empty()); let mut prev = map.insert(HOST, "earth".parse().unwrap()).unwrap(); assert_eq!("world", prev); let mut map = HeaderMap::new(); assert!(map.try_insert(HOST, "world".parse().unwrap()).unwrap().is_none()); assert!(!map.is_empty()); let mut prev = map.try_insert(HOST, "earth".parse().unwrap()).unwrap().unwrap(); assert_eq!("world", prev); ``` -------------------------------- ### Iterate Over HeaderMap (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search= Provides examples of iterating over a HeaderMap. It covers consuming iteration, which moves values out of the map, and iteration over references. ```rust use pingora_http::h1::HeaderMap; use pingora_http::h1::HeaderName; use pingora_http::h1::header; // Consuming iterator example let mut map = HeaderMap::new(); map.insert(header::CONTENT_LENGTH, "123".parse().unwrap()); map.insert(header::CONTENT_TYPE, "json".parse().unwrap()); let mut iter = map.into_iter(); assert_eq!(iter.next(), Some((Some(header::CONTENT_LENGTH), "123".parse().unwrap()))); assert_eq!(iter.next(), Some((Some(header::CONTENT_TYPE), "json".parse().unwrap()))); assert!(iter.next().is_none()); // Example with multiple values for the same header let mut map_multi = HeaderMap::new(); map_multi.append(header::CONTENT_LENGTH, "123".parse().unwrap()); map_multi.append(header::CONTENT_LENGTH, "456".parse().unwrap()); let mut iter_multi = map_multi.into_iter(); assert_eq!(iter_multi.next(), Some((Some(header::CONTENT_LENGTH), "123".parse().unwrap()))); assert_eq!(iter_multi.next(), Some((None, "456".parse().unwrap()))); assert!(iter_multi.next().is_none()); ``` -------------------------------- ### Get String Representation of HTTP Method in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html?search=std%3A%3Avec Demonstrates retrieving the string representation of an HTTP method using the `as_str` method. This is useful for logging or constructing HTTP headers. ```rust use http::Method; assert_eq!(Method::POST.as_str(), "POST"); assert_eq!(Method::DELETE.as_str(), "DELETE"); ``` -------------------------------- ### Manage Headers in RequestHeader Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Examples of appending or inserting headers into a RequestHeader instance, highlighting the difference between adding values and replacing existing ones. ```rust let mut header = RequestHeader::build(http::Method::GET, b"/", None)?; // Append a header (preserves existing values) header.append_header("X-Custom-Header", "value1")?; // Insert a header (replaces existing values for the same name) header.insert_header("Content-Type", "application/json")?; ``` -------------------------------- ### Inspect and Clear HeaderMap Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides examples for checking the state of the map, including counting total values, keys, and clearing the contents while retaining capacity. ```rust let mut map = HeaderMap::new(); map.insert(ACCEPT, "text/plain".parse().unwrap()); map.append(ACCEPT, "text/html".parse().unwrap()); assert_eq!(2, map.len()); assert_eq!(1, map.keys_len()); map.clear(); assert!(map.is_empty()); assert!(map.capacity() > 0); ``` -------------------------------- ### Use HeaderMap Entry API Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=u32+-%3E+bool Demonstrates using the `entry` API for in-place manipulation of HeaderMap entries. This example counts occurrences of headers, including case-insensitive ones, by using `or_insert` to initialize or access the counter. ```rust let mut map: HeaderMap = HeaderMap::default(); let headers = &[ "content-length", "x-hello", "Content-Length", "x-world", ]; for &header in headers { let counter = map.entry(header).or_insert(0); *counter += 1; } assert_eq!(map["content-length"], 2); assert_eq!(map["x-hello"], 1); ``` -------------------------------- ### pingora_http::Method Constants Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html?search=u32+-%3E+bool Provides constants for common HTTP methods such as GET, POST, PUT, DELETE, HEAD, OPTIONS, CONNECT, PATCH, and TRACE, as defined in RFC 7230 and extensions. ```rust pub const GET: Method pub const POST: Method pub const PUT: Method pub const DELETE: Method pub const HEAD: Method pub const OPTIONS: Method pub const CONNECT: Method pub const PATCH: Method pub const TRACE: Method ``` -------------------------------- ### Inspect and Clear HeaderMap State in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=std%3A%3Avec Provides examples for checking map size, key counts, and clearing contents while preserving allocated memory. ```rust let mut map = HeaderMap::new(); map.insert(ACCEPT, "text/plain".parse().unwrap()); map.insert(ACCEPT, "text/html".parse().unwrap()); assert_eq!(2, map.len()); assert_eq!(1, map.keys_len()); map.clear(); assert!(map.is_empty()); ``` -------------------------------- ### Get String Representation of HTTP Method in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates the `as_str` method, which returns a string slice (`&str`) representation of the HTTP method. This is useful for logging, debugging, and displaying method names. ```rust pub fn as_str(&self) -> &str ``` -------------------------------- ### Initialize ResponseHeader in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.ResponseHeader.html Demonstrates how to create a new ResponseHeader instance using standard and space-efficient builders. The standard build preserves header case, while build_no_case is optimized for HTTP/2 scenarios. ```rust use pingora_http::ResponseHeader; use http::StatusCode; // Create a new header with case preservation let header = ResponseHeader::build(StatusCode::OK, Some(1024)).unwrap(); // Create a space-efficient header for HTTP/2 let header_h2 = ResponseHeader::build_no_case(StatusCode::OK, None).unwrap(); ``` -------------------------------- ### Get String Representation of StatusCode (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.StatusCode.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Illustrates how to get a string representation of a `StatusCode`. The returned string contains only the numerical value of the status code, not the canonical reason phrase. ```rust pub fn as_str(&self) -> &str Returns a &str representation of the `StatusCode` ``` ```rust let status = http::StatusCode::OK; assert_eq!(status.as_str(), "200"); ``` -------------------------------- ### Initialize RequestHeader in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html?search=std%3A%3Avec Demonstrates how to instantiate a new RequestHeader using the build or build_no_case methods. These methods allow for defining the HTTP method and path, with the latter being optimized for HTTP/2 scenarios. ```rust use pingora_http::RequestHeader; // Create a standard RequestHeader preserving case let header = RequestHeader::build("GET", b"/index.html", None)?; // Create an optimized RequestHeader for HTTP/2 let h2_header = RequestHeader::build_no_case("GET", b"/api/data", None)?; ``` -------------------------------- ### Get Mutable Header Value from HeaderMap (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html Demonstrates how to get a mutable reference to a header value in a HeaderMap. This allows in-place modification of the header's value. Returns `None` if the key is not present. ```Rust let mut map = HeaderMap::default(); map.insert(HOST, "hello".to_string()); map.get_mut("host").unwrap().push_str("-world"); assert_eq!(map.get(HOST).unwrap(), &"hello-world"); ``` -------------------------------- ### Get String Representation of StatusCode (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.StatusCode.html Shows how to get a string slice (`&str`) representation of a `StatusCode`. The returned string contains only the numerical value of the status code and does not include the canonical reason phrase. ```Rust pub fn as_str(&self) -> &str // Example: let status = http::StatusCode::OK; assert_eq!(status.as_str(), "200"); ``` -------------------------------- ### HeaderMap initialization and capacity management Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html Shows how to create empty maps, pre-allocate capacity to optimize performance, and handle potential errors during allocation. ```rust let map = HeaderMap::new(); assert!(map.is_empty()); let map: HeaderMap = HeaderMap::with_capacity(10); assert_eq!(12, map.capacity()); let map: HeaderMap = HeaderMap::try_with_capacity(10).unwrap(); assert_eq!(12, map.capacity()); ``` -------------------------------- ### Implement CloneToUninit for Memory Initialization Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.ResponseHeader.html An experimental nightly API for performing copy-assignment from an existing instance to uninitialized memory. This is useful for low-level memory management and custom allocation strategies. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) { // Implementation logic for copying into uninitialized memory } ``` -------------------------------- ### Get HeaderMap Length Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=u32+-%3E+bool Explains how to get the total number of header values stored in the map using the `len()` method. This count includes all values, even if multiple values are associated with the same header name. ```rust use pingora_http::hmap::HeaderMap; use pingora_http::headers::{ACCEPT, HOST}; let mut map = HeaderMap::new(); assert_eq!(0, map.len()); map.insert(ACCEPT, "text/plain".parse().unwrap()); map.insert(HOST, "localhost".parse().unwrap()); assert_eq!(2, map.len()); map.append(ACCEPT, "text/html".parse().unwrap()); assert_eq!(3, map.len()); ``` -------------------------------- ### Initialize RequestHeader in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html?search=u32+-%3E+bool Demonstrates how to instantiate a new RequestHeader using the standard build method, which preserves header case, or the build_no_case method for memory-efficient HTTP/2 scenarios. ```rust pub fn build(method: impl TryInto, path: &[u8], size_hint: Option) -> Result pub fn build_no_case(method: impl TryInto, path: &[u8], size_hint: Option) -> Result ``` -------------------------------- ### GET /header_map/drain Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Clears the HeaderMap and returns all entries as an iterator. ```APIDOC ## GET /header_map/drain ### Description Clears the map, returning all entries as an iterator. The internal memory is kept for reuse. ### Method GET ### Response #### Success Response (200) - **entries** (Array) - A list of tuples containing (Option, Value). #### Response Example [ ["HOST", "hello"], [null, "goodbye"], ["CONTENT-LENGTH", "123"] ] ``` -------------------------------- ### GET /header_map/entry Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=u32+-%3E+bool Retrieves an entry for in-place manipulation of a header key. ```APIDOC ## GET /header_map/entry ### Description Gets the given key’s corresponding entry in the map for in-place manipulation, allowing for efficient updates or insertions. ### Method GET ### Parameters #### Query Parameters - **key** (IntoHeaderName) - Required - The header name to retrieve. ### Response #### Success Response (200) - **entry** (Entry) - The entry object for the specified key. #### Response Example { "status": "success", "entry_type": "Occupied" } ``` -------------------------------- ### pingora_http::Method PartialEq Implementations Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html?search=u32+-%3E+bool Provides various `PartialEq` implementations for comparing `Method` instances with other `Method` instances, string slices, and references. These enable equality checks using `==` and inequality checks using `!=`. ```rust fn eq(&self, other: &&'a Method) -> bool fn ne(&self, other: &Rhs) -> bool fn eq(&self, other: &&'a str) -> bool fn ne(&self, other: &Rhs) -> bool fn eq(&self, other: &Method) -> bool fn ne(&self, other: &Rhs) -> bool fn eq(&self, other: &Method) -> bool fn ne(&self, other: &Rhs) -> bool fn eq(&self, other: &Method) -> bool ``` -------------------------------- ### Define and Use HTTP Methods in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates how to define and use the `Method` struct in Rust. It shows creating methods from byte slices and checking their properties like idempotency and string representation. This is useful for constructing and validating HTTP requests. ```rust use http::Method; assert_eq!(Method::GET, Method::from_bytes(b"GET").unwrap()); assert!(Method::GET.is_idempotent()); assert_eq!(Method::POST.as_str(), "POST"); ``` -------------------------------- ### GET /header_map/index Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search= Retrieves a header value by its key using index notation. ```APIDOC ## GET /header_map/index ### Description Retrieves the value associated with a specific header name. Note: This operation will panic if the requested header is not present in the map. ### Method GET ### Endpoint /header_map/{key} ### Parameters #### Path Parameters - **key** (AsHeaderName) - Required - The header name to look up. ### Response #### Success Response (200) - **value** (T) - The value associated with the header. #### Error Handling - **404/Panic** - Occurs if the header key does not exist in the map. ``` -------------------------------- ### GET /internal/header-map/index Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves a header value by its key using the index operator. ```APIDOC ## GET /internal/header-map/index ### Description Retrieves the value associated with a specific header name. Note: This operation will panic if the requested header is not present in the map. ### Method GET ### Endpoint /internal/header-map/index ### Parameters #### Query Parameters - **key** (AsHeaderName) - Required - The header name to look up. ### Response #### Success Response (200) - **value** (T) - The value associated with the header key. ### Response Example { "value": "header_value" } ``` -------------------------------- ### Create and Use HeaderMap Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=u32+-%3E+bool Demonstrates the basic usage of HeaderMap for storing and retrieving HTTP headers. It shows how to insert, check for the presence of keys, access values, and remove headers. ```rust use pingora_http::hmap::HeaderMap; use pingora_http::headers::{HOST, CONTENT_LENGTH, LOCATION}; let mut headers = HeaderMap::new(); headers.insert(HOST, "example.com".parse().unwrap()); headers.insert(CONTENT_LENGTH, "123".parse().unwrap()); assert!(headers.contains_key(HOST)); assert!(!headers.contains_key(LOCATION)); assert_eq!(headers[HOST], "example.com"); headers.remove(HOST); assert!(!headers.contains_key(HOST)); ``` -------------------------------- ### HMap Initialization with Capacity Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html Shows how to create an HMap with a specified initial capacity, either directly or with error handling for maximum size. ```APIDOC ## HMap Initialization with Capacity ### Description Creates an empty `HeaderMap` with the specified capacity. The map will allocate internal storage to hold about `capacity` elements without reallocating. More capacity than requested may be allocated. ### Method `with_capacity(capacity: usize) -> HeaderMap` `try_with_capacity(capacity: usize) -> Result, MaxSizeReached>` ### Endpoint N/A (Struct methods) ### Parameters - **capacity** (usize) - Required - The desired initial capacity for the HeaderMap. ### Request Example ```rust use pingora_http::hmap::HeaderMap; // Using with_capacity let map: HeaderMap = HeaderMap::with_capacity(10); assert!(map.is_empty()); assert_eq!(12, map.capacity()); // Using try_with_capacity let map_res: Result, _> = HeaderMap::try_with_capacity(10); match map_res { Ok(map) => { assert!(map.is_empty()); assert_eq!(12, map.capacity()); } Err(_) => { // Handle error if max size is reached } } ``` ### Response #### Success Response (200) N/A (Struct methods) #### Response Example N/A ### Errors - `try_with_capacity` may return `MaxSizeReached` if the requested capacity exceeds the maximum allowed size for a `HeaderMap`. ``` -------------------------------- ### GET /header_map/entry Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=std%3A%3Avec Retrieves an entry for in-place manipulation of a specific header key. ```APIDOC ## GET /header_map/entry ### Description Gets the given key’s corresponding entry in the map for in-place manipulation. ### Method GET ### Parameters #### Query Parameters - **key** (String) - Required - The header name to retrieve an entry for. ### Response #### Success Response (200) - **entry** (Entry) - The entry object for the specified key. ``` -------------------------------- ### Initialize and Configure HeaderMap Capacity in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=std%3A%3Avec Shows how to create empty HeaderMaps with specific capacity requirements, including safe and fallible allocation methods. ```rust let map: HeaderMap = HeaderMap::with_capacity(10); assert!(map.is_empty()); let map_res: HeaderMap = HeaderMap::try_with_capacity(10).unwrap(); assert_eq!(12, map_res.capacity()); ``` -------------------------------- ### Get HeaderMap Capacity Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=u32+-%3E+bool Explains how to retrieve the current capacity of the HeaderMap, which indicates the number of headers it can hold before needing to reallocate memory. This is an approximation. ```rust use pingora_http::hmap::HeaderMap; use pingora_http::headers::HOST; let mut map = HeaderMap::new(); assert_eq!(0, map.capacity()); map.insert(HOST, "hello.world".parse().unwrap()); assert_eq!(6, map.capacity()); ``` -------------------------------- ### Initialize and Configure HeaderMap Capacity Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to create HeaderMap instances with specific capacities to optimize memory allocation, including fallible initialization. ```rust let map = HeaderMap::new(); assert!(map.is_empty()); let map_with_cap: HeaderMap = HeaderMap::with_capacity(10); assert_eq!(12, map_with_cap.capacity()); let safe_map = HeaderMap::try_with_capacity(10).unwrap(); assert!(safe_map.is_empty()); ``` -------------------------------- ### HMap Creation and Basic Operations Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html Demonstrates how to create and manipulate HMap instances, including insertion, checking for keys, and removal. ```APIDOC ## HMap ### Description A set of HTTP headers. `HeaderMap` is a multimap of `HeaderName` to values. ### Method `new()` ### Endpoint N/A (Struct method) ### Parameters None ### Request Example ```rust use pingora_http::hmap::HeaderMap; use pingora_http::headers::{HOST, CONTENT_LENGTH, LOCATION}; let mut headers = HeaderMap::new(); headers.insert(HOST, "example.com".parse().unwrap()); headers.insert(CONTENT_LENGTH, "123".parse().unwrap()); assert!(headers.contains_key(HOST)); assert!(!headers.contains_key(LOCATION)); assert_eq!(headers[HOST], "example.com"); headers.remove(HOST); assert!(!headers.contains_key(HOST)); ``` ### Response #### Success Response (200) N/A (Struct method) #### Response Example N/A ``` -------------------------------- ### HeaderMap Initialization Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides documentation for methods used to create new HeaderMap instances, with and without pre-defined capacity. ```APIDOC ### impl HeaderMap #### pub fn new() -> HeaderMap Create an empty `HeaderMap`. The map will be created without any capacity. This function will not allocate. ##### Examples ```rust let map = HeaderMap::new(); assert!(map.is_empty()); assert_eq!(0, map.capacity()); ``` ### impl HeaderMap #### pub fn with_capacity(capacity: usize) -> HeaderMap Create an empty `HeaderMap` with the specified capacity. The returned map will allocate internal storage in order to hold about `capacity` elements without reallocating. However, this is a “best effort” as there are usage patterns that could cause additional allocations before `capacity` headers are stored in the map. More capacity than requested may be allocated. ##### Panics This method panics if capacity exceeds max `HeaderMap` capacity. ##### Examples ```rust let map: HeaderMap = HeaderMap::with_capacity(10); assert!(map.is_empty()); assert_eq!(12, map.capacity()); ``` #### pub fn try_with_capacity( capacity: usize, ) -> Result, MaxSizeReached> Create an empty `HeaderMap` with the specified capacity. The returned map will allocate internal storage in order to hold about `capacity` elements without reallocating. However, this is a “best effort” as there are usage patterns that could cause additional allocations before `capacity` headers are stored in the map. More capacity than requested may be allocated. ##### Errors This function may return an error if `HeaderMap` exceeds max capacity ##### Examples ```rust let map: HeaderMap = HeaderMap::try_with_capacity(10).unwrap(); assert!(map.is_empty()); assert_eq!(12, map.capacity()); ``` ``` -------------------------------- ### Create HeaderMap with Capacity Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=u32+-%3E+bool Demonstrates creating a HeaderMap with a specified initial capacity. This can help optimize performance by pre-allocating memory, reducing the need for reallocations as headers are added. ```rust use pingora_http::hmap::HeaderMap; let map: HeaderMap = HeaderMap::with_capacity(10); assert!(map.is_empty()); assert_eq!(12, map.capacity()); ``` -------------------------------- ### Implement PartialEq and TryFrom for Method Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html?search=u32+-%3E+bool Defines equality comparison logic for Method against strings and other Methods, and provides conversion logic from byte slices and strings to Method types. ```rust impl PartialEq for Method { fn eq(&self, other: &str) -> bool { /* ... */ } } impl<'a> TryFrom<&'a [u8]> for Method { type Error = InvalidMethod; fn try_from(t: &'a [u8]) -> Result { /* ... */ } } ``` -------------------------------- ### HeaderMap Creation and Basic Operations Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates how to create and perform basic operations on a HeaderMap, including insertion, checking for keys, and retrieval. ```APIDOC ## Struct HMap A set of HTTP headers `HeaderMap` is a multimap of `HeaderName` to values. ### Examples ```rust let mut headers = HeaderMap::new(); headers.insert(HOST, "example.com".parse().unwrap()); headers.insert(CONTENT_LENGTH, "123".parse().unwrap()); assert!(headers.contains_key(HOST)); assert!(!headers.contains_key(LOCATION)); assert_eq!(headers[HOST], "example.com"); headers.remove(HOST); assert!(!headers.contains_key(HOST)); ``` ``` -------------------------------- ### Drain HeaderMap Entries Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=u32+-%3E+bool Illustrates draining all entries from a HeaderMap, returning them as an iterator. The map is cleared, and its contents can be consumed. This example verifies the order and content of drained entries. ```rust let mut map = HeaderMap::new(); map.insert(HOST, "hello".parse().unwrap()); map.append(HOST, "goodbye".parse().unwrap()); map.insert(CONTENT_LENGTH, "123".parse().unwrap()); let mut drain = map.drain(); assert_eq!(drain.next(), Some((Some(HOST), "hello".parse().unwrap()))); assert_eq!(drain.next(), Some((None, "goodbye".parse().unwrap()))); assert_eq!(drain.next(), Some((Some(CONTENT_LENGTH), "123".parse().unwrap()))); assert_eq!(drain.next(), None); ``` -------------------------------- ### Initialize RequestHeader in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates how to instantiate a new RequestHeader using the standard build method or the space-efficient build_no_case method. ```rust use pingora_http::RequestHeader; // Standard build preserving header case let header = RequestHeader::build(http::Method::GET, b"/path", None)?; // Space-efficient build for HTTP/2 where case doesn't matter let header_h2 = RequestHeader::build_no_case(http::Method::GET, b"/path", None)?; ``` -------------------------------- ### RequestHeader Initialization Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html?search=u32+-%3E+bool Methods for creating and configuring a new RequestHeader instance. ```APIDOC ## [METHOD] RequestHeader::build ### Description Creates a new RequestHeader with the given method and path. This implementation preserves header name case. ### Parameters - **method** (impl TryInto) - Required - The HTTP method for the request. - **path** (&[u8]) - Required - The request path, which can be non-UTF-8. - **size_hint** (Option) - Optional - An optional size hint for memory allocation. ### Response - **Result** - Returns the initialized RequestHeader or an error if the method is invalid. ``` -------------------------------- ### Get u16 Representation of StatusCode (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.StatusCode.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides a method to retrieve the `u16` numerical value of a `StatusCode`. This is useful for serialization or when interacting with systems that expect numerical status codes. ```rust pub const fn as_u16(&self) -> u16 Returns the `u16` corresponding to this `StatusCode`. ``` ```rust let status = http::StatusCode::OK; assert_eq!(status.as_u16(), 200); ``` -------------------------------- ### Get HeaderMap Keys Length Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=u32+-%3E+bool Demonstrates how to retrieve the number of unique header keys present in the map using `keys_len()`. This count is less than or equal to the total number of values. ```rust use pingora_http::hmap::HeaderMap; use pingora_http::headers::{ACCEPT, HOST}; let mut map = HeaderMap::new(); assert_eq!(0, map.keys_len()); map.insert(ACCEPT, "text/plain".parse().unwrap()); map.insert(HOST, "localhost".parse().unwrap()); assert_eq!(2, map.keys_len()); map.insert(ACCEPT, "text/html".parse().unwrap()); assert_eq!(2, map.keys_len()); ``` -------------------------------- ### Create and Manipulate RequestHeader Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html Demonstrates how to instantiate a new RequestHeader using build or build_no_case, and how to modify headers using append_header or insert_header. ```rust use pingora_http::RequestHeader; use http::Method; // Create a new header with case preservation let mut header = RequestHeader::build(Method::GET, b"/index.html", None).unwrap(); // Append a header without removing existing ones header.append_header("X-Custom-Header", "value1").unwrap(); // Insert a header, replacing existing ones with the same name header.insert_header("X-Custom-Header", "value2").unwrap(); ``` -------------------------------- ### pingora-http Method Equality Comparisons Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html Details the various `PartialEq` implementations for the `Method` struct, allowing comparisons with other `Method` instances, string slices, and references. These traits facilitate straightforward checks for method equality. ```rust impl<'a> PartialEq<&'a Method> for Method impl<'a> PartialEq<&'a str> for Method impl<'a> PartialEq for &'a Method impl<'a> PartialEq for &'a str impl PartialEq for str ``` -------------------------------- ### Get Reason Phrase from ResponseHeader Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.ResponseHeader.html?search=std%3A%3Avec Retrieves the HTTP reason phrase from the ResponseHeader. Returns None if set_reason_phrase was never called or explicitly set to None, in which case a default will be used. ```rust pub fn get_reason_phrase(&self) -> Option<&str> ``` -------------------------------- ### HeaderMap Conversion from HashMap Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html Demonstrates how to convert a `HashMap` into a `HeaderMap` using `try_from`. ```APIDOC ### `impl<'a, K, V, S, T> TryFrom<&'a HashMap> for HeaderMap` Attempts to convert a `HashMap` into a `HeaderMap`. #### §Examples ```rust use std::collections::HashMap; use std::convert::TryInto; use http::HeaderMap; let mut map = HashMap::new(); map.insert("X-Custom-Header".to_string(), "my value".to_string()); let headers: HeaderMap = (&map).try_into().expect("valid headers"); assert_eq!(headers["X-Custom-Header"], "my value"); ``` #### `type Error = Error` The error type returned if the conversion fails. #### `fn try_from( c: &'a HashMap, ) -> Result, as TryFrom<&'a HashMap>>::Error>` Performs the conversion from a `HashMap` reference to a `HeaderMap`. ``` -------------------------------- ### Try Create HeaderMap with Capacity Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search= Demonstrates creating a HeaderMap with a specified capacity, returning a Result to handle potential errors if the capacity exceeds the maximum allowed size. This provides a safer way to initialize maps with large capacities. ```rust use pingora_http::hmap::HeaderMap; use pingora_http::hmap::MaxSizeReached; let map: HeaderMap = HeaderMap::try_with_capacity(10).unwrap(); assert!(map.is_empty()); assert_eq!(12, map.capacity()); ``` -------------------------------- ### Get All Header Values from HeaderMap (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html Shows how to retrieve all values associated with a specific header key from a HeaderMap. It returns an iterator that allows accessing each value without extra allocations. ```Rust let mut map = HeaderMap::new(); map.insert(HOST, "hello".parse().unwrap()); map.append(HOST, "goodbye".parse().unwrap()); let view = map.get_all("host"); let mut iter = view.iter(); assert_eq!(&"hello", iter.next().unwrap()); assert_eq!(&"goodbye", iter.next().unwrap()); assert!(iter.next().is_none()); ``` -------------------------------- ### Get Canonical Reason Phrase for StatusCode (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.StatusCode.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Explains how to retrieve the standardized reason phrase associated with a `StatusCode`. This is primarily for server-side response generation and should not be relied upon for application logic. ```rust pub fn canonical_reason(&self) -> Option<&'static str> Get the standardised `reason-phrase` for this status code. ``` ```rust let status = http::StatusCode::OK; assert_eq!(status.canonical_reason(), Some("OK")); ``` -------------------------------- ### Retrieve Header Values Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search= Methods to access header values by key. get() and get_mut() return the first associated value, while get_all() provides a view to iterate over all values for a given key. ```rust let mut map = HeaderMap::new(); map.insert(HOST, "hello".parse().unwrap()); assert_eq!(map.get(HOST).unwrap(), &"hello"); map.get_mut("host").unwrap().push_str("-world"); let view = map.get_all("host"); for val in view.iter() { println!("{:?}", val); } ``` -------------------------------- ### Generic Implementations for T (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates common generic trait implementations in Rust that apply to various types, including `Method`. These include `Any` for type identification, `Borrow` and `BorrowMut` for accessing data, `CloneToUninit` for uninitialized memory operations (nightly-only), `From` and `Into` for conversions, `ToOwned` for creating owned copies, `ToString` for string representation, and `TryFrom`/`TryInto` for fallible conversions. ```rust impl Any for T where T: 'static + ?Sized { fn type_id(&self) -> TypeId; } impl Borrow for T where T: ?Sized { fn borrow(&self) -> &T; } impl BorrowMut for T where T: ?Sized { fn borrow_mut(&mut self) -> &mut T; } impl CloneToUninit for T where T: Clone { unsafe fn clone_to_uninit(&self, dest: *mut u8); } impl From for T { fn from(t: T) -> T; } impl Into for T where U: From { fn into(self) -> U; } impl ToOwned for T where T: Clone { type Owned = T; fn to_owned(&self) -> T; fn clone_into(&self, target: &mut T); } impl ToString for T where T: Display + ?Sized { fn to_string(&self) -> String; } impl TryFrom for T where U: Into { type Error = Infallible; fn try_from(value: U) -> Result; } impl TryInto for T where U: TryFrom { type Error = >::Error; fn try_into(self) -> Result; } ``` -------------------------------- ### Implement PartialEq for Method (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides implementations for the `PartialEq` trait for the `Method` type, allowing for equality (`==`) and inequality (`!=`) comparisons with other `Method` instances and string slices. ```rust impl PartialEq for Method { fn eq(&self, other: &str) -> bool; } impl PartialEq for Method { fn eq(&self, other: &Method) -> bool; fn ne(&self, other: &Rhs) -> bool; } ``` -------------------------------- ### Get u16 Value from StatusCode (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.StatusCode.html Demonstrates how to retrieve the `u16` numerical representation of a `StatusCode`. This method is useful for obtaining the raw integer value associated with an HTTP status code. ```Rust pub const fn as_u16(&self) -> u16 // Example: let status = http::StatusCode::OK; assert_eq!(status.as_u16(), 200); ``` -------------------------------- ### CloneToUninit Trait Implementation Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html An experimental, nightly-only feature for performing copy-assignment to uninitialized memory. ```APIDOC ## CloneToUninit Trait (Experimental, Nightly-Only) ### Description An experimental, nightly-only feature for performing copy-assignment to uninitialized memory. ### Method `clone_to_uninit` ### Endpoint N/A (Trait implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **dest** (*mut u8) - A mutable pointer to the destination memory address. ### Request Example None ### Response #### Success Response (200) None (This is an unsafe operation that modifies memory directly). #### Response Example None ``` -------------------------------- ### Working with StatusCode in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.StatusCode.html?search=u32+-%3E+bool Demonstrates how to instantiate a StatusCode from a u16, convert it back to a numeric value, and perform semantic checks on the status. ```rust use http::StatusCode; // Create from u16 let status = StatusCode::from_u16(200).unwrap(); assert_eq!(status, StatusCode::OK); // Convert to u16 and string assert_eq!(status.as_u16(), 200); assert_eq!(status.as_str(), "200"); // Semantic checks assert!(status.is_success()); // Get canonical reason assert_eq!(status.canonical_reason(), Some("OK")); ``` -------------------------------- ### Method Type Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html?search=std%3A%3Avec The Request Method (VERB). This type contains constants for common HTTP methods like GET, POST, etc., and supports methods defined in RFC 7230, PATCH, and extensions. ```APIDOC ## Struct Method ### Description The Request Method (VERB). This type also contains constants for a number of common HTTP methods such as GET, POST, etc. Currently includes 8 variants representing the 8 methods defined in RFC 7230, plus PATCH, and an Extension variant for all extensions. ### Constants - **GET**: Represents the GET HTTP method. - **POST**: Represents the POST HTTP method. - **PUT**: Represents the PUT HTTP method. - **DELETE**: Represents the DELETE HTTP method. - **HEAD**: Represents the HEAD HTTP method. - **OPTIONS**: Represents the OPTIONS HTTP method. - **CONNECT**: Represents the CONNECT HTTP method. - **PATCH**: Represents the PATCH HTTP method. - **TRACE**: Represents the TRACE HTTP method. ### Methods - **from_bytes(src: &[u8]) -> Result** Converts a slice of bytes to an HTTP method. - **is_safe(&self) -> bool** Checks if a method is considered “safe”, meaning the request is essentially read-only. - **is_idempotent(&self) -> bool** Checks if a method is considered “idempotent”, meaning the request has the same result if executed multiple times. - **as_str(&self) -> &str** Returns a &str representation of the HTTP method. ### Examples ```rust use http::Method; assert_eq!(Method::GET, Method::from_bytes(b"GET").unwrap()); assert!(Method::GET.is_idempotent()); assert_eq!(Method::POST.as_str(), "POST"); ``` ``` -------------------------------- ### Manage HTTP Headers with HeaderMap Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates basic operations for the HeaderMap including insertion, retrieval, and removal of HTTP header fields. ```rust let mut headers = HeaderMap::new(); headers.insert(HOST, "example.com".parse().unwrap()); headers.insert(CONTENT_LENGTH, "123".parse().unwrap()); assert!(headers.contains_key(HOST)); assert!(!headers.contains_key(LOCATION)); assert_eq!(headers[HOST], "example.com"); headers.remove(HOST); assert!(!headers.contains_key(HOST)); ``` -------------------------------- ### Implement PartialEq for Method in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html?search= Provides implementations for the `PartialEq` trait for the `Method` type, enabling equality comparisons using `==` and `!=`. These implementations are crucial for comparing HTTP methods. ```rust impl PartialEq for Method { fn eq(&self, other: &str) -> bool; fn ne(&self, other: &Rhs) -> bool; } impl PartialEq for Method { fn eq(&self, other: &Method) -> bool; fn ne(&self, other: &Rhs) -> bool; } ``` -------------------------------- ### HTTP Status Code Constants in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.StatusCode.html?search= Provides examples of using predefined HTTP status code constants available in the pingora_http crate. This includes informational, success, redirection, and client/server error codes. ```rust use http::StatusCode; // Accessing predefined status code constants let continue_code = StatusCode::CONTINUE; assert_eq!(continue_code.as_u16(), 100); assert!(continue_code.is_informational()); let created_code = StatusCode::CREATED; assert_eq!(created_code.as_u16(), 201); assert!(created_code.is_success()); let moved_permanently_code = StatusCode::MOVED_PERMANENTLY; assert_eq!(moved_permanently_code.as_u16(), 301); assert!(moved_permanently_code.is_redirection()); let internal_server_error_code = StatusCode::INTERNAL_SERVER_ERROR; assert_eq!(internal_server_error_code.as_u16(), 500); assert!(internal_server_error_code.is_server_error()); ``` -------------------------------- ### Method Conversion Traits Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.Method.html This section covers the `TryFrom` trait implementations for converting byte slices and string slices into `Method` instances. ```APIDOC ## TryFrom<&'a [u8]> for Method ### Description Allows conversion from a byte slice to a `Method`. ### Associated Type `Error = InvalidMethod` The type returned in the event of a conversion error. ### Method `try_from(t: &'a [u8]) -> Result>::Error>` Performs the conversion from a byte slice to a `Method`. ## TryFrom<&'a str> for Method ### Description Allows conversion from a string slice to a `Method`. ### Associated Type `Error = InvalidMethod` The type returned in the event of a conversion error. ### Method `try_from(t: &'a str) -> Result>::Error>` Performs the conversion from a string slice to a `Method`. ``` -------------------------------- ### Get Header Value from HeaderMap (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html Illustrates how to retrieve a header value associated with a given key from a HeaderMap. If multiple values exist for the key, the first one is returned. Returns `None` if the key is not found. ```Rust let mut map = HeaderMap::new(); assert!(map.get("host").is_none()); map.insert(HOST, "hello".parse().unwrap()); assert_eq!(map.get(HOST).unwrap(), &"hello"); assert_eq!(map.get("host").unwrap(), &"hello"); map.append(HOST, "world".parse().unwrap()); assert_eq!(map.get("host").unwrap(), &"hello"); ``` -------------------------------- ### Implement From and From for ResponseHeader Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.ResponseHeader.html?search= Provides conversion implementations between `ResponseHeader` and `http::response::Parts`. This allows easy conversion from `Parts` into `ResponseHeader` and vice versa, facilitating data exchange. ```rust impl From for ResponseHeader { fn from(parts: Parts) -> ResponseHeader; } ``` ```rust impl From for Parts { fn from(resp: ResponseHeader) -> Parts; } ``` -------------------------------- ### RequestHeader Conversion and Traits Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html?search= Demonstrates conversions between RequestHeader and http::request::Parts, along with trait implementations like Clone, Debug, Deref, and From. `as_owned_parts` clones the header into `http::request::Parts`. ```rust pub fn as_owned_parts(&self) -> ReqParts ``` ```rust impl AsRef for RequestHeader ``` ```rust impl Clone for RequestHeader ``` ```rust impl Debug for RequestHeader ``` ```rust impl Deref for RequestHeader ``` ```rust impl DerefMut for RequestHeader ``` ```rust impl From for RequestHeader ``` ```rust impl From for Parts ``` -------------------------------- ### Get Canonical Reason Phrase for HTTP Status Code in Rust Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.StatusCode.html?search= Illustrates how to retrieve the canonical reason phrase for a given HTTP status code using the `canonical_reason` method in Rust. This is useful for generating human-readable responses. ```rust use http::StatusCode; let status = StatusCode::OK; assert_eq!(status.canonical_reason(), Some("OK")); let status_not_found = StatusCode::NOT_FOUND; assert_eq!(status_not_found.canonical_reason(), Some("Not Found")); // Example with a less common status code let status_processing = StatusCode::PROCESSING; assert_eq!(status_processing.canonical_reason(), Some("Processing")); ``` -------------------------------- ### Standard Library Blanket Implementations Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html?search=std%3A%3Avec Demonstrates common Rust blanket implementations applied to types, including conversion traits like From, Into, and memory management traits like Borrow and ToOwned. ```rust impl From for T { fn from(t: T) -> T { t } } impl Into for T where U: From { fn into(self) -> U { U::from(self) } } impl ToOwned for T where T: Clone { type Owned = T; fn to_owned(&self) -> T { self.clone() } } ``` -------------------------------- ### Implement ToOwned for RequestHeader Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E This trait allows creating an owned version of a borrowed RequestHeader. It's commonly used when you need to take ownership of request data, for example, to modify it or pass it to another function that requires ownership. ```rust impl ToOwned for T where T: Clone, { type Owned = T; fn to_owned(&self) -> T // ... implementation details ... fn clone_into(&self, target: &mut T) // ... implementation details ... } ``` -------------------------------- ### Build RequestHeader Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html?search= Provides methods to construct a new RequestHeader. `build` preserves header case, while `build_no_case` is more space-efficient for HTTP/2 where case is not preserved. ```rust pub fn build( method: impl TryInto, path: &[u8], size_hint: Option, ) -> Result ``` ```rust pub fn build_no_case( method: impl TryInto, path: &[u8], size_hint: Option, ) -> Result ``` -------------------------------- ### Implement CloneToUninit for Generic Types Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.HMap.html?search=std%3A%3Avec An experimental nightly-only API that performs copy-assignment from self to an uninitialized destination pointer. Requires the type to implement Clone. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) where T: Clone { // Implementation logic for copying to uninitialized memory } ``` -------------------------------- ### Get Canonical Reason Phrase for StatusCode (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.StatusCode.html Illustrates how to retrieve the standardized `reason-phrase` for a given `StatusCode`. This is primarily intended for server-side response generation and should not be relied upon for application logic as it's mainly for human readability and is being abolished in newer HTTP versions. ```Rust pub fn canonical_reason(&self) -> Option<&'static str> // Example: let status = http::StatusCode::OK; assert_eq!(status.canonical_reason(), Some("OK")); ``` -------------------------------- ### StatusCode Struct Definition and Usage Examples (Rust) Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.StatusCode.html Defines the `StatusCode` struct for HTTP status codes and demonstrates its basic usage, including conversion from u16, retrieving the u16 value, and checking success status. It supports status codes in the range 100-999. ```Rust pub struct StatusCode(/* private fields */); use http::StatusCode; assert_eq!(StatusCode::from_u16(200).unwrap(), StatusCode::OK); assert_eq!(StatusCode::NOT_FOUND.as_u16(), 404); assert!(StatusCode::OK.is_success()); ``` -------------------------------- ### Path and Version Management Source: https://docs.rs/pingora-http/0.8.0/pingora_http/struct.RequestHeader.html?search=u32+-%3E+bool Methods for setting and retrieving request metadata like URI, path, and HTTP version. ```APIDOC ## [METHOD] RequestHeader::set_raw_path ### Description Sets the request URI directly via raw bytes. This is useful for supporting non-UTF-8 paths. ### Parameters - **path** (&[u8]) - Required - The raw byte representation of the path. ## [METHOD] RequestHeader::set_version ### Description Sets the HTTP version for the request. ### Parameters - **version** (Version) - Required - The HTTP version (e.g., HTTP/1.1, HTTP/2). ```