43 lines
1.1 KiB
Markdown
Raw Normal View History

2023-12-11 20:30:44 -05:00
# HSTS support
HTTP Strict-Transport-Security. Added as experimental in curl
7.74.0. Supported "for real" since 7.77.0.
## Standard
[HTTP Strict Transport Security](https://datatracker.ietf.org/doc/html/rfc6797)
## Behavior
libcurl features an in-memory cache for HSTS hosts, so that subsequent
2024-05-15 15:20:32 -04:00
HTTP-only requests to a hostname present in the cache gets internally
2023-12-11 20:30:44 -05:00
"redirected" to the HTTPS version.
## `curl_easy_setopt()` options:
- `CURLOPT_HSTS_CTRL` - enable HSTS for this easy handle
2024-05-15 15:20:32 -04:00
- `CURLOPT_HSTS` - specify filename where to store the HSTS cache on close
2023-12-11 20:30:44 -05:00
(and possibly read from at startup)
## curl command line options
- `--hsts [filename]` - enable HSTS, use the file as HSTS cache. If filename
2024-05-15 15:20:32 -04:00
is `""` (no length) then no file is used, only in-memory cache.
2023-12-11 20:30:44 -05:00
## HSTS cache file format
Lines starting with `#` are ignored.
For each hsts entry:
[host name] "YYYYMMDD HH:MM:SS"
The `[host name]` is dot-prefixed if it includes subdomains.
The time stamp is when the entry expires.
## Possible future additions
2024-05-15 15:20:32 -04:00
- `CURLOPT_HSTS_PRELOAD` - provide a set of HSTS hostnames to load first
2023-12-11 20:30:44 -05:00
- ability to save to something else than a file