summaryrefslogtreecommitdiff
path: root/src/cache.c
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2015-07-06 22:37:37 +0200
committerSebastian Geerken <devnull@localhost>2015-07-06 22:37:37 +0200
commit9610fb52086c39ab10c2979c79a98079745137da (patch)
tree5df4319a20b63cbb7e0872318532087475ebb221 /src/cache.c
parent9500f94781023d15783f4c8158c17c112135a221 (diff)
parent78c910dc93d8772a0b1af7fc6ae3865e2efdfb3c (diff)
Merge with main repo.
Diffstat (limited to 'src/cache.c')
-rw-r--r--src/cache.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cache.c b/src/cache.c
index d8f1a123..b082ef89 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -26,6 +26,7 @@
#include "dicache.h"
#include "nav.h"
#include "cookies.h"
+#include "hsts.h"
#include "misc.h"
#include "capi.h"
#include "decode.h"
@@ -653,7 +654,7 @@ static void Cache_parse_header(CacheEntry_t *entry)
{
char *header = entry->Header->str;
bool_t server1point0 = !strncmp(entry->Header->str, "HTTP/1.0", 8);
- char *Length, *Type, *location_str, *encoding, *connection;
+ char *Length, *Type, *location_str, *encoding, *connection, *hsts;
#ifndef DISABLE_COOKIES
Dlist *Cookies;
#endif
@@ -721,6 +722,14 @@ static void Cache_parse_header(CacheEntry_t *entry)
dFree(connection);
}
+ if (prefs.http_strict_transport_security &&
+ !dStrAsciiCasecmp(URL_SCHEME(entry->Url), "https") &&
+ !a_Url_host_is_ip(URL_HOST(entry->Url)) &&
+ (hsts = Cache_parse_field(header, "Strict-Transport-Security"))) {
+ a_Hsts_set(hsts, entry->Url);
+ dFree(hsts);
+ }
+
/*
* Get Transfer-Encoding and initialize decoder
*/