diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-11-02 23:17:01 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-11-03 16:08:42 +0100 |
commit | 7385610d0c74c6a254fea5e4cd6e1d559d848c8c (patch) | |
tree | 3b572bcf972062b7cc1315ac23fdb547e7216463 /lib/easy.c | |
parent | 9f43b28f783cc8f7464492a0b5b9dd35c1625fde (diff) | |
download | curl-7385610d0c74c6a254fea5e4cd6e1d559d848c8c.tar.gz |
hsts: add support for Strict-Transport-Security
- enable in the build (configure)
- header parsing
- host name lookup
- unit tests for the above
- CI build
- CURL_VERSION_HSTS bit
- curl_version_info support
- curl -V output
- curl-config --features
- CURLOPT_HSTS_CTRL
- man page for CURLOPT_HSTS_CTRL
- curl --hsts (sets CURLOPT_HSTS_CTRL and works with --libcurl)
- man page for --hsts
- save cache to disk
- load cache from disk
- CURLOPT_HSTS
- man page for CURLOPT_HSTS
- added docs/HSTS.md
- fixed --version docs
- adjusted curl_easy_duphandle
Closes #5896
Diffstat (limited to 'lib/easy.c')
-rw-r--r-- | lib/easy.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/easy.c b/lib/easy.c index 60e2befd7..ca1117a46 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -79,6 +79,7 @@ #include "http2.h" #include "dynbuf.h" #include "altsvc.h" +#include "hsts.h" /* The last 3 #include files should be in this order */ #include "curl_printf.h" @@ -881,6 +882,15 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data) (void)Curl_altsvc_load(outcurl->asi, outcurl->set.str[STRING_ALTSVC]); } #endif +#ifdef USE_HSTS + if(data->hsts) { + outcurl->hsts = Curl_hsts_init(); + if(!outcurl->hsts) + goto fail; + if(outcurl->set.str[STRING_HSTS]) + (void)Curl_hsts_load(outcurl->hsts, outcurl->set.str[STRING_HSTS]); + } +#endif /* Clone the resolver handle, if present, for the new handle */ if(Curl_resolver_duphandle(outcurl, &outcurl->state.resolver, @@ -929,6 +939,7 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data) Curl_safefree(outcurl->change.url); Curl_safefree(outcurl->change.referer); Curl_altsvc_cleanup(&outcurl->asi); + Curl_hsts_cleanup(&outcurl->hsts); Curl_freeset(outcurl); free(outcurl); } |