Dillo v3.1.1-119-g140d9ebd
|
HTTP Strict Transport Security. More...
#include <time.h>
#include <errno.h>
#include <limits.h>
#include <ctype.h>
#include <stdlib.h>
#include "hsts.h"
#include "msg.h"
#include "../dlib/dlib.h"
#include "IO/tls.h"
Go to the source code of this file.
Functions | |
static void | Hsts_free_policy (HstsData_t *p) |
void | a_Hsts_freeall (void) |
static int | Domain_node_domain_str_cmp (const void *v1, const void *v2) |
Compare function for searching a domain node by domain string. | |
static HstsData_t * | Hsts_get_policy (const char *host) |
static void | Hsts_remove_policy (HstsData_t *policy) |
static time_t | Hsts_future_time (long seconds_from_now) |
Return the time_t for a future time. | |
static int | Domain_node_cmp (const void *v1, const void *v2) |
Compare function for searching domains. | |
static void | Hsts_set_policy (const char *host, long max_age, bool_t subdomains) |
static char * | Hsts_parse_attr (const char **header_str) |
Read the next attribute. | |
static char * | Hsts_parse_value (const char **header_str) |
Get the value in *header_str. | |
static void | Hsts_eat_value (const char **str) |
Advance past any value. | |
void | a_Hsts_set (const char *header, const DilloUrl *url) |
The reponse for this url had an HSTS header, so let's take action. | |
static bool_t | Hsts_expired (HstsData_t *policy) |
bool_t | a_Hsts_require_https (const char *host) |
static void | Hsts_preload (FILE *stream) |
void | a_Hsts_init (FILE *preload_file) |
Variables | |
static time_t | hsts_latest_representable_time |
static Dlist * | domains |
HTTP Strict Transport Security.
Definition in file hsts.c.
void a_Hsts_freeall | ( | void | ) |
Definition at line 55 of file hsts.c.
References dList_free(), dList_length(), dList_nth_data(), domains, Hsts_free_policy(), DilloPrefs::http_strict_transport_security, and prefs.
Referenced by main().
void a_Hsts_init | ( | FILE * | preload_file | ) |
Definition at line 357 of file hsts.c.
References dList_new(), domains, hsts_latest_representable_time, Hsts_preload(), DilloPrefs::http_strict_transport_security, and prefs.
Referenced by main().
bool_t a_Hsts_require_https | ( | const char * | host | ) |
Definition at line 271 of file hsts.c.
References _MSG, FALSE, Hsts_expired(), Hsts_get_policy(), Hsts_remove_policy(), and TRUE.
Referenced by a_Url_new().
void a_Hsts_set | ( | const char * | header, |
const DilloUrl * | url | ||
) |
The reponse for this url had an HSTS header, so let's take action.
Definition at line 201 of file hsts.c.
References _MSG, a_Tls_certificate_is_clean(), dFree(), dStrAsciiCasecmp(), FALSE, Hsts_eat_value(), Hsts_get_policy(), Hsts_parse_attr(), Hsts_parse_value(), Hsts_remove_policy(), Hsts_set_policy(), MSG, TRUE, and URL_HOST.
Referenced by Cache_parse_header().
|
static |
Compare function for searching domains.
Definition at line 117 of file hsts.c.
References dStrAsciiCasecmp().
Referenced by Hsts_set_policy().
|
static |
Compare function for searching a domain node by domain string.
Definition at line 72 of file hsts.c.
References dStrAsciiCasecmp().
Referenced by Hsts_get_policy().
|
static |
|
static |
|
static |
Definition at line 49 of file hsts.c.
References dFree().
Referenced by a_Hsts_freeall(), and Hsts_remove_policy().
|
static |
Return the time_t for a future time.
Definition at line 97 of file hsts.c.
References hsts_latest_representable_time.
Referenced by Hsts_set_policy().
|
static |
Definition at line 80 of file hsts.c.
References dList_find_sorted(), Domain_node_domain_str_cmp(), and domains.
Referenced by a_Hsts_require_https(), a_Hsts_set(), and Hsts_set_policy().
|
static |
Read the next attribute.
Definition at line 144 of file hsts.c.
References dIsspace, and dStrndup().
Referenced by a_Hsts_set().
|
static |
Get the value in *header_str.
Definition at line 165 of file hsts.c.
References dIsspace, and dStrndup().
Referenced by a_Hsts_set().
|
static |
Definition at line 309 of file hsts.c.
References dIsspace, dStrAsciiCasecmp(), dStrerror, dStrstrip(), FALSE, Hsts_set_policy(), LINE_MAXLEN, MSG_WARN, and TRUE.
Referenced by a_Hsts_init().
|
static |
Definition at line 85 of file hsts.c.
References _MSG, dList_remove(), domains, and Hsts_free_policy().
Referenced by a_Hsts_require_https(), and a_Hsts_set().
|
static |
Definition at line 124 of file hsts.c.
References _MSG, dList_insert_sorted(), dNew0, Domain_node_cmp(), domains, dStrdup(), Hsts_future_time(), and Hsts_get_policy().
Referenced by a_Hsts_set(), and Hsts_preload().
|
static |
Definition at line 47 of file hsts.c.
Referenced by a_Hsts_freeall(), a_Hsts_init(), Hsts_get_policy(), Hsts_remove_policy(), and Hsts_set_policy().
|
static |
Definition at line 46 of file hsts.c.
Referenced by a_Hsts_init(), and Hsts_future_time().