49 lwc_string_unref(self->
name);
50 lwc_string_unref(self->
value);
57 const char *pos = *input;
59 lwc_string *value = NULL;
82 lwc_string_unref(name);
87 directive = malloc(
sizeof(*directive));
88 if (directive == NULL) {
89 lwc_string_unref(value);
90 lwc_string_unref(name);
95 directive->
name = name;
96 directive->
value = value;
110 lwc_string *name, lwc_string **value)
114 while (list != NULL) {
115 if (lwc_string_caseless_isequal(name, list->
name,
116 &match) == lwc_error_ok && match)
125 if (list->
value != NULL) {
126 *value = lwc_string_ref(list->
value);
136 lwc_string **name, lwc_string **value)
141 *name = lwc_string_ref(cur->
name);
142 if (cur->
value != NULL) {
143 *value = lwc_string_ref(cur->
value);
156 while (list != NULL) {
157 if (lwc_string_caseless_isequal(key, list->
name,
158 &match) == lwc_error_ok && match) {
179 lwc_string *name = NULL, *value = NULL;
185 lwc_string_unref(name);
186 lwc_string_unref(value);
187 }
while (key != NULL);
194 const char *pos = lwc_string_data(value);
195 const char *end = pos + lwc_string_length(value);
206 if (
'0' <= *pos && *pos <=
'9') {
207 uint32_t nv = val * 10 + (*pos -
'0');
230 const char *pos = header_value;
234 lwc_string *max_age_str = NULL, *isd_str = NULL;
236 bool include_sub_domains =
false;
254 if (directives != NULL) {
271 corestring_lwc_max_age, &max_age_str);
272 if (error !=
NSERROR_OK || max_age_str == NULL) {
279 lwc_string_unref(max_age_str);
283 lwc_string_unref(max_age_str);
287 corestring_lwc_includesubdomains, &isd_str);
292 if (isd_str != NULL) {
294 lwc_string_unref(isd_str);
298 include_sub_domains =
true;
302 sts = malloc(
sizeof(*sts));
Useful interned string pointers (interface).
nserror
Enumeration of error codes.
@ NSERROR_NOT_FOUND
Requested item not found.
@ NSERROR_NOMEM
Memory exhaustion.
#define http__item_list_destroy(l)
#define HTTP__ITEM_INIT(item, n, f)
#define http__item_list_parse(i, p, f, r)
HTTP header parsing functions.
nserror http__parse_token(const char **input, lwc_string **value)
Parse an HTTP token.
void http__skip_LWS(const char **input)
Skip past linear whitespace in input.
nserror http__parse_quoted_string(const char **input, lwc_string **value)
Parse an HTTP quoted-string.
struct http_directive http_directive
Representation of a directive.
static bool check_duplicates(const http_directive *directives)
nserror http_parse_strict_transport_security(const char *header_value, http_strict_transport_security **result)
Parse an HTTP Strict-Transport-Security header value.
void http_strict_transport_security_destroy(http_strict_transport_security *victim)
Destroy a strict transport security object.
static void http_destroy_directive(http_directive *self)
static nserror parse_max_age(lwc_string *value, uint32_t *result)
static void http_directive_list_destroy(http_directive *list)
static nserror http__parse_directive(const char **input, http_directive **result)
static uint32_t count(const http_directive *list, lwc_string *key)
static const http_directive * http_directive_list_iterate(const http_directive *cur, lwc_string **name, lwc_string **value)
bool http_strict_transport_security_include_subdomains(http_strict_transport_security *sts)
Get the value of a strict transport security's includeSubDomains flag.
uint32_t http_strict_transport_security_max_age(http_strict_transport_security *sts)
Get the value of a strict transport security's max-age.
static nserror http_directive_list_find_item(const http_directive *list, lwc_string *name, lwc_string **value)
Representation of an item.
struct http__item * next
Next item in list, or NULL.
Representation of a directive.
lwc_string * value
Parameter value (optional)
lwc_string * name
Parameter name.
Representation of a Strict-Transport-Security.
uint32_t max_age
Max age (delta seconds)
bool include_sub_domains
Whether subdomains are included.