cloudflare/pingora
pingora-http
Active contributors: ewang, yuchen, andrew
Purpose
HTTP request and response header types that preserve case. Standard http crate types lowercase header names; Pingora needs to forward headers to upstreams that may care about original casing (notably some legacy origin servers and HTTP/1 clients sniffing for Set-Cookie exactly).
Directory layout
pingora-http/src/
├── lib.rs RequestHeader, ResponseHeader, prelude
└── case_header_name.rs Case-preserving header name storageKey abstractions
| Type | File | What it is |
|---|---|---|
RequestHeader |
pingora-http/src/lib.rs |
HTTP request header (method, uri, headers, version) with case preservation |
ResponseHeader |
pingora-http/src/lib.rs |
Counterpart for responses (added to prelude in 0.7.0) |
CaseHeaderName |
pingora-http/src/case_header_name.rs |
Header name that remembers original case |
IntoCaseHeaderName |
pingora-http/src/lib.rs |
Conversion trait for various string-y inputs |
RequestHeader::insert_header_value etc. |
pingora-http/src/lib.rs |
Mutators that maintain case |
How it works
The http crate's HeaderMap lowercases names. pingora-http builds on top of it by tracking original case in a side table keyed by header name. When you serialize a RequestHeader to the wire, the original casing is restored.
Otherwise the API mirrors http::request::Parts and http::response::Parts closely. RequestHeader is what ProxyHttp callbacks see for the downstream and upstream request; ResponseHeader is what they see for responses.
Integration points
- Re-exported as
pingora::http::*. - Used by every protocol implementation (
pingora-core/src/protocols/http/) and the proxy.
Entry points for modification
- Adding a new convenience method →
lib.rs. The file is ~1,100 lines; most of it is mutators and accessors that need to update both the lowercase map and the case side table. - Header serialization changes →
case_header_name.rsplus the writer code inpingora-core/src/protocols/http/v1/.
Key source files
| File | Purpose |
|---|---|
pingora-http/src/lib.rs |
RequestHeader, ResponseHeader, prelude |
pingora-http/src/case_header_name.rs |
CaseHeaderName storage |
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.