summaryrefslogtreecommitdiff
path: root/src/hsts.c
diff options
context:
space:
mode:
authorcorvid <devnull@localhost>2015-06-29 16:29:28 +0000
committercorvid <devnull@localhost>2015-06-29 16:29:28 +0000
commit476caeec459ecdee0b4e56f77ce46f76dfbfc817 (patch)
tree85e965abe35b8e3c4b96fe3dfe1c69635cf695eb /src/hsts.c
parent41f2b84001bb63d705c7981492a9637d4d48f5f7 (diff)
prefs.http_strict_transport_security
Diffstat (limited to 'src/hsts.c')
-rw-r--r--src/hsts.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/hsts.c b/src/hsts.c
index 5874e44f..ecbd9765 100644
--- a/src/hsts.c
+++ b/src/hsts.c
@@ -49,14 +49,16 @@ static void Hsts_free_policy(HstsData_t *p)
void a_Hsts_freeall()
{
- HstsData_t *policy;
- int i, n = dList_length(domains);
+ if (prefs.http_strict_transport_security) {
+ HstsData_t *policy;
+ int i, n = dList_length(domains);
- for (i = 0; i < n; i++) {
- policy = dList_nth_data(domains, i);
- Hsts_free_policy(policy);
+ for (i = 0; i < n; i++) {
+ policy = dList_nth_data(domains, i);
+ Hsts_free_policy(policy);
+ }
+ dList_free(domains);
}
- dList_free(domains);
}
/*
@@ -349,12 +351,14 @@ static void Hsts_preload(FILE *stream)
void a_Hsts_init(FILE *preload_file)
{
- struct tm future_tm = {7, 14, 3, 19, 0, 138, 0, 0, 0, 0, 0};
+ if (prefs.http_strict_transport_security) {
+ struct tm future_tm = {7, 14, 3, 19, 0, 138, 0, 0, 0, 0, 0};
- hsts_latest_representable_time = mktime(&future_tm);
- domains = dList_new(32);
+ hsts_latest_representable_time = mktime(&future_tm);
+ domains = dList_new(32);
- if (preload_file)
- Hsts_preload(preload_file);
+ if (preload_file)
+ Hsts_preload(preload_file);
+ }
}