http-rs / http-rs/http-types

[tracking] typed headers

Open
#99 20 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
209
Forks
91
PR merge metrics
No merged PRs in 30d

Description

This is a tracking issue for typed headers. I looked over the
[HTTP headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers) page and categorized which headers would need to be ported.

There are probably some nuances in *how* we want to implement them, but this provides an overview of how far along we are in constructing typed constructors for all header types.

__edit__: I realize now that this might read a bit dated. I drafted this text back in December but forgot to post it. Some things may seem a bit outdated or different; the most important part is that we can track whether we can construct headers .

## Authentication (`auth`)

- [x] `WWW-Authenticate` (`auth::Authenticate`)
- [x] `Authorization` (`auth::Authorization`)
- [x] `Proxy-Authenticate` (`auth::ProxyAuthenticate`)
- [x] `Proxy-Authorization` (`auth::ProxyAuthorization`)

## Caching (`cache`)

- [x] `Age` (`cache::Age`)
- [x] `Cache-Control` (`cache::Control`)
- [x] `Clear-Site-Data` (`cache::ClearSite`)
- [x] `Expires` (`cache::Expires`)
- [x] ~~`Pragma` (`cache::Pragma`)~~ (HTTP/1.0 only)
- [x] ~~`Warning` (`cache::Warning`)~~ (soon to be deprecated)

## Client Hints (`client_hints`)

- [x] ~~`Accept-CH` (`ch::Accept`)~~ (experimental, implementation postponed)
- [x] ~~`Accept-CH-Lifetime` (`ch::Lifetime`)~~ (experimental, implementation postponed)
- [x] ~~`Early-Data` (`ch::EarlyData`)~~ (experimental, implementation postponed)
- [x] ~~`Content-DPR` (`ch::ContentDpr`)~~ (experimental, implementation postponed)
- [x] ~~`DPR` (`ch::Dpr`)~~ (experimental, implementation postponed)
- [x] ~~`Device-Memory` (`ch::DeviceMemory`)~~ (experimental, implementation postponed)
- [x] ~~`Save-Data` (`ch::SaveData`)~~ (experimental, implementation postponed)
- [x] ~~`Viewport-Width` (`ch::ViewportWidth`)~~ (experimental, implementation postponed)
- [x] ~~`Width` (`ch::Width`)~~ (experimental, implementation postponed)

## Conditionals (`conditionals`)

- [x] `Last-Modified` (`conditionals::LastModified`)
- [x] `Etag` (`conditionals::Etag`)
- [x] `If-Match` (`conditionals::IfMatch`)
- [x] `If-Modified-Since` (`conditionals::IfModifiedSince`)
- [x] `If-Unmodified-Since` (`conditionals::IfUnmodifiedSince`)
- [x] `Vary` (`conditionals::Vary`)

## Content Negotiation (`content`)

- [x] `Accept` (`content::Accept`)
- [x] ~~`Accept-Charset` (`content::Charset`)~~ (no longer supported by any browser)
- [x] `Accept-Encoding` (`content::Encoding`)
- [ ] `Accept-Language` (`content::Language`)

## Controls (`controls`)

- [x] `Expect` (`controls::Expect`)

## Cookies

I think this one is special, and we should re-export the
[`cookie`](https://docs.rs/cookie/0.12.0/cookie/) crate, and just expose get /
set cookies as methods on the `Request` and `Response` types. Let's just treat
them as built-ins to evade the name collision.

## CORS (`cors`)

- [x] `Access-Control-Allow-Origin` (`cors::AllowOrigin`)
- [x] `Access-Control-Allow-Credentials` (`cors::AllowCredentials`)
- [x] `Access-Control-Allow-Headers` (`cors::AllowHeaders`)
- [x] `Access-Control-Allow-Methods` (`cors::AllowMethods`)
- [x] `Access-Control-Expose-Headers` (`cors::ExposeHeaders`)
- [x] `Access-Control-Max-Age` (`cors::MaxAge`)
- [x] `Access-Control-Request-Headers` (`cors::RequestHeaders`)
- [x] `Access-Control-Request-Method` (`cors::RequestMethod`)
- [x] `Access-Control-Origin` (`cors::Origin`)
- [x] `Access-Control-Timing-Allow-Origin` (`cors::TimingAllowOrigin`)

## Do Not Track (`privacy`)

- [ ] `DNT` (`privacy::DoNotTrack`)
- [ ] `Tk` (`privacy::TrackingStatus`)

## Content Information (`content`)

- [ ] `Content-Disposition` (`downloads::Disposition`)
- [x] `Content-Length` (`content::Length`)
- [x] `Content-Type` (`content::Type`)
- [x] `Content-Encoding` (`content::Encoding`)
- [ ] `Content-Language` (`content::Language`)
- [x] `Content-Location` (`content::Location`)

## Proxies (`proxies`)

- [x] `Forwarded` (`proxies::Forwarded`)
- [ ] `Via` (`proxies::Via`)

## Response (`response`)

- [x] `Allow` (`response::Allow`)

## Range (`content`)

- [ ] `Accept-Ranges` (`range::Accept`)
- [ ] `Range` (`range::Range`)
- [ ] `If-Range` (`range::If`)
- [ ] `Content-Range` (`range::Content`)

## Security (`security`)

- [ ] `Cross-Origin-Opener-Policy` (`security::Coop`)
- [ ] `Cross-Origin-Resource-Policy` (`security::Cors`)
- [ ] `Content-Security-Policy` (`security::Csp`)
- [ ] `Content-Security-Policy-Report-Only` (`security::Cspro`)
- [ ] `Expect-CT` (`security::Cspro`)
- [ ] `Feature-Policy` (`security::FeaturePolicy`)
- [x] ~~`Public-Key-Pins` (`security::HPKP`)~~ (deprecated)

## Other

- [ ] Alt-Svc
- [x] Date
- [x] ~~Large-Allocation~~ (unspecced; firefox only)
- [ ] Link
- [x] Referer
- [x] Retry-After
- [x] SourceMap
- [ ] Upgrade
- [ ] User-Agent
- [ ] Keep-Alive

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.