MCPcopy Create free account
hub / github.com/HFQR/xitca-web / update_header

Method update_header

http-encoding/src/coding.rs:155–168  ·  view source on GitHub ↗
(self, headers: &mut HeaderMap, version: http::Version)

Source from the content-addressed store, hash-verified

153 }
154
155 fn update_header(self, headers: &mut HeaderMap, version: http::Version) {
156 if matches!(self, ContentEncoding::Identity) {
157 return;
158 }
159
160 headers.insert(header::CONTENT_ENCODING, self.as_header_value());
161 headers.remove(header::CONTENT_LENGTH);
162
163 // Connection specific headers are not allowed in HTTP/2 and later versions.
164 // see https://datatracker.ietf.org/doc/html/rfc9113#section-8.2.2
165 if version == http::Version::HTTP_11 {
166 headers.append(header::TRANSFER_ENCODING, header::HeaderValue::from_static("chunked"));
167 }
168 }
169
170 fn _from_headers(headers: &HeaderMap, needle: &HeaderName) -> impl Iterator<Item = ContentEncodingWithQValue> {
171 headers

Callers 1

try_encodeMethod · 0.80

Calls 4

as_header_valueMethod · 0.80
insertMethod · 0.45
removeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected