libcss: branch master updated. release/0.8.0-72-gf3b8e29
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/f3b8e297d3af3817f83011...
...commit http://git.netsurf-browser.org/libcss.git/commit/f3b8e297d3af3817f83011b6...
...tree http://git.netsurf-browser.org/libcss.git/tree/f3b8e297d3af3817f83011b64c...
The branch, master has been updated
via f3b8e297d3af3817f83011b64cf2a389059115f3 (commit)
from 35ab0a4e9406f9eeb29ca261680d911c423e4f90 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=f3b8e297d3af3817f830...
commit f3b8e297d3af3817f83011b64cf2a389059115f3
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
resolve use of uninitialised pointer in media query initialisation
diff --git a/src/parse/mq.c b/src/parse/mq.c
index fb32b38..a8a5411 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -745,6 +745,9 @@ static css_error mq_parse_media_in_parens(lwc_string **strings,
*ctx = old_ctx;
error = mq_parse_general_enclosed(strings, vector, ctx);
+ if (error == CSS_OK) {
+ *cond_or_feature = NULL;
+ }
return error;
}
-----------------------------------------------------------------------
Summary of changes:
src/parse/mq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/parse/mq.c b/src/parse/mq.c
index fb32b38..a8a5411 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -745,6 +745,9 @@ static css_error mq_parse_media_in_parens(lwc_string **strings,
*ctx = old_ctx;
error = mq_parse_general_enclosed(strings, vector, ctx);
+ if (error == CSS_OK) {
+ *cond_or_feature = NULL;
+ }
return error;
}
--
Cascading Style Sheets library
3 years, 7 months
libcss: branch master updated. release/0.8.0-71-g35ab0a4
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/35ab0a4e9406f9eeb29ca2...
...commit http://git.netsurf-browser.org/libcss.git/commit/35ab0a4e9406f9eeb29ca261...
...tree http://git.netsurf-browser.org/libcss.git/tree/35ab0a4e9406f9eeb29ca26168...
The branch, master has been updated
via 35ab0a4e9406f9eeb29ca261680d911c423e4f90 (commit)
from 00cafe488273eab18e9c93bf59191efaa722fc3b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libcss.git/commit/?id=35ab0a4e9406f9eeb29c...
commit 35ab0a4e9406f9eeb29ca261680d911c423e4f90
Author: Michael Drake <Michael Drake tlsa(a)netsurf-browser.org>
Commit: Michael Drake <Michael Drake tlsa(a)netsurf-browser.org>
Media queries: Simplify parsed mq data structure slightly.
diff --git a/src/parse/mq.c b/src/parse/mq.c
index 2e817d1..fb32b38 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -39,21 +39,13 @@ static void css__mq_feature_destroy(css_mq_feature *feature)
static void css__mq_cond_or_feature_destroy(
css_mq_cond_or_feature *cond_or_feature);
-static void css__mq_cond_parts_destroy(css_mq_cond_parts *cond_parts)
-{
- if (cond_parts != NULL) {
- for (uint32_t i = 0; i < cond_parts->nparts; i++) {
- css__mq_cond_or_feature_destroy(cond_parts->parts[i]);
- }
- free(cond_parts->parts);
- free(cond_parts);
- }
-}
-
static void css__mq_cond_destroy(css_mq_cond *cond)
{
if (cond != NULL) {
- css__mq_cond_parts_destroy(cond->parts);
+ for (uint32_t i = 0; i < cond->nparts; i++) {
+ css__mq_cond_or_feature_destroy(cond->parts[i]);
+ }
+ free(cond->parts);
free(cond);
}
}
@@ -790,12 +782,6 @@ static css_error mq_parse_condition(lwc_string **strings,
return CSS_NOMEM;
}
memset(result, 0, sizeof(*result));
- result->parts = malloc(sizeof(*result->parts));
- if (result->parts == NULL) {
- free(result);
- return CSS_NOMEM;
- }
- memset(result->parts, 0, sizeof(*result->parts));
if (tokenIsChar(token, '(') == false) {
/* Must be "not" */
@@ -810,14 +796,14 @@ static css_error mq_parse_condition(lwc_string **strings,
}
result->negate = 1;
- result->parts->nparts = 1;
- result->parts->parts = malloc(sizeof(*result->parts->parts));
- if (result->parts->parts == NULL) {
+ result->nparts = 1;
+ result->parts = malloc(sizeof(*result->parts));
+ if (result->parts == NULL) {
css__mq_cond_or_feature_destroy(cond_or_feature);
css__mq_cond_destroy(result);
return CSS_NOMEM;
}
- result->parts->parts[0] = cond_or_feature;
+ result->parts[0] = cond_or_feature;
*cond = result;
@@ -834,16 +820,16 @@ static css_error mq_parse_condition(lwc_string **strings,
return CSS_INVALID;
}
- parts = realloc(result->parts->parts,
- (result->parts->nparts+1)*sizeof(*result->parts->parts));
+ parts = realloc(result->parts,
+ (result->nparts+1)*sizeof(*result->parts));
if (parts == NULL) {
css__mq_cond_or_feature_destroy(cond_or_feature);
css__mq_cond_destroy(result);
return CSS_NOMEM;
}
- parts[result->parts->nparts] = cond_or_feature;
- result->parts->parts = parts;
- result->parts->nparts++;
+ parts[result->nparts] = cond_or_feature;
+ result->parts = parts;
+ result->nparts++;
consumeWhitespace(vector, ctx);
diff --git a/src/parse/mq.h b/src/parse/mq.h
index 0e2f845..7a51578 100644
--- a/src/parse/mq.h
+++ b/src/parse/mq.h
@@ -57,14 +57,10 @@ typedef struct {
typedef struct css_mq_cond_or_feature css_mq_cond_or_feature;
typedef struct {
- uint32_t nparts;
- css_mq_cond_or_feature **parts;
-} css_mq_cond_parts;
-
-typedef struct {
uint32_t negate : 1, /* set if "not" */
op : 1; /* clear if "and", set if "or" */
- css_mq_cond_parts *parts;
+ uint32_t nparts;
+ css_mq_cond_or_feature **parts;
} css_mq_cond;
struct css_mq_cond_or_feature {
diff --git a/src/select/mq.h b/src/select/mq.h
index f51d0db..c01144b 100644
--- a/src/select/mq.h
+++ b/src/select/mq.h
@@ -222,17 +222,15 @@ static inline bool mq_match_condition(
{
bool matched = !cond->op;
- for (uint32_t i = 0; i < cond->parts->nparts; i++) {
+ for (uint32_t i = 0; i < cond->nparts; i++) {
bool part_matched;
- if (cond->parts->parts[i]->type == CSS_MQ_FEATURE) {
+ if (cond->parts[i]->type == CSS_MQ_FEATURE) {
part_matched = mq_match_feature(
- cond->parts->parts[i]->data.feat,
- media);
+ cond->parts[i]->data.feat, media);
} else {
- assert(cond->parts->parts[i]->type == CSS_MQ_COND);
+ assert(cond->parts[i]->type == CSS_MQ_COND);
part_matched = mq_match_condition(
- cond->parts->parts[i]->data.cond,
- media);
+ cond->parts[i]->data.cond, media);
}
if (cond->op) {
-----------------------------------------------------------------------
Summary of changes:
src/parse/mq.c | 40 +++++++++++++---------------------------
src/parse/mq.h | 8 ++------
src/select/mq.h | 12 +++++-------
3 files changed, 20 insertions(+), 40 deletions(-)
diff --git a/src/parse/mq.c b/src/parse/mq.c
index 2e817d1..fb32b38 100644
--- a/src/parse/mq.c
+++ b/src/parse/mq.c
@@ -39,21 +39,13 @@ static void css__mq_feature_destroy(css_mq_feature *feature)
static void css__mq_cond_or_feature_destroy(
css_mq_cond_or_feature *cond_or_feature);
-static void css__mq_cond_parts_destroy(css_mq_cond_parts *cond_parts)
-{
- if (cond_parts != NULL) {
- for (uint32_t i = 0; i < cond_parts->nparts; i++) {
- css__mq_cond_or_feature_destroy(cond_parts->parts[i]);
- }
- free(cond_parts->parts);
- free(cond_parts);
- }
-}
-
static void css__mq_cond_destroy(css_mq_cond *cond)
{
if (cond != NULL) {
- css__mq_cond_parts_destroy(cond->parts);
+ for (uint32_t i = 0; i < cond->nparts; i++) {
+ css__mq_cond_or_feature_destroy(cond->parts[i]);
+ }
+ free(cond->parts);
free(cond);
}
}
@@ -790,12 +782,6 @@ static css_error mq_parse_condition(lwc_string **strings,
return CSS_NOMEM;
}
memset(result, 0, sizeof(*result));
- result->parts = malloc(sizeof(*result->parts));
- if (result->parts == NULL) {
- free(result);
- return CSS_NOMEM;
- }
- memset(result->parts, 0, sizeof(*result->parts));
if (tokenIsChar(token, '(') == false) {
/* Must be "not" */
@@ -810,14 +796,14 @@ static css_error mq_parse_condition(lwc_string **strings,
}
result->negate = 1;
- result->parts->nparts = 1;
- result->parts->parts = malloc(sizeof(*result->parts->parts));
- if (result->parts->parts == NULL) {
+ result->nparts = 1;
+ result->parts = malloc(sizeof(*result->parts));
+ if (result->parts == NULL) {
css__mq_cond_or_feature_destroy(cond_or_feature);
css__mq_cond_destroy(result);
return CSS_NOMEM;
}
- result->parts->parts[0] = cond_or_feature;
+ result->parts[0] = cond_or_feature;
*cond = result;
@@ -834,16 +820,16 @@ static css_error mq_parse_condition(lwc_string **strings,
return CSS_INVALID;
}
- parts = realloc(result->parts->parts,
- (result->parts->nparts+1)*sizeof(*result->parts->parts));
+ parts = realloc(result->parts,
+ (result->nparts+1)*sizeof(*result->parts));
if (parts == NULL) {
css__mq_cond_or_feature_destroy(cond_or_feature);
css__mq_cond_destroy(result);
return CSS_NOMEM;
}
- parts[result->parts->nparts] = cond_or_feature;
- result->parts->parts = parts;
- result->parts->nparts++;
+ parts[result->nparts] = cond_or_feature;
+ result->parts = parts;
+ result->nparts++;
consumeWhitespace(vector, ctx);
diff --git a/src/parse/mq.h b/src/parse/mq.h
index 0e2f845..7a51578 100644
--- a/src/parse/mq.h
+++ b/src/parse/mq.h
@@ -57,14 +57,10 @@ typedef struct {
typedef struct css_mq_cond_or_feature css_mq_cond_or_feature;
typedef struct {
- uint32_t nparts;
- css_mq_cond_or_feature **parts;
-} css_mq_cond_parts;
-
-typedef struct {
uint32_t negate : 1, /* set if "not" */
op : 1; /* clear if "and", set if "or" */
- css_mq_cond_parts *parts;
+ uint32_t nparts;
+ css_mq_cond_or_feature **parts;
} css_mq_cond;
struct css_mq_cond_or_feature {
diff --git a/src/select/mq.h b/src/select/mq.h
index f51d0db..c01144b 100644
--- a/src/select/mq.h
+++ b/src/select/mq.h
@@ -222,17 +222,15 @@ static inline bool mq_match_condition(
{
bool matched = !cond->op;
- for (uint32_t i = 0; i < cond->parts->nparts; i++) {
+ for (uint32_t i = 0; i < cond->nparts; i++) {
bool part_matched;
- if (cond->parts->parts[i]->type == CSS_MQ_FEATURE) {
+ if (cond->parts[i]->type == CSS_MQ_FEATURE) {
part_matched = mq_match_feature(
- cond->parts->parts[i]->data.feat,
- media);
+ cond->parts[i]->data.feat, media);
} else {
- assert(cond->parts->parts[i]->type == CSS_MQ_COND);
+ assert(cond->parts[i]->type == CSS_MQ_COND);
part_matched = mq_match_condition(
- cond->parts->parts[i]->data.cond,
- media);
+ cond->parts[i]->data.cond, media);
}
if (cond->op) {
--
Cascading Style Sheets library
3 years, 7 months
netsurf: branch master updated. release/3.8-272-gc1dc4e6
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/c1dc4e61bd87abdfc1208...
...commit http://git.netsurf-browser.org/netsurf.git/commit/c1dc4e61bd87abdfc120888...
...tree http://git.netsurf-browser.org/netsurf.git/tree/c1dc4e61bd87abdfc120888e7...
The branch, master has been updated
via c1dc4e61bd87abdfc120888e79c2da6bad8ce26b (commit)
via 23698aecf844c105b210fa42b642c1d0203978c9 (commit)
from 047c82cfce53102aced0f76f5ca13fe3c56b4db2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=c1dc4e61bd87abdfc12...
commit c1dc4e61bd87abdfc120888e79c2da6bad8ce26b
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
LLCache: validate max-age before use
diff --git a/content/llcache.c b/content/llcache.c
index d78d5bb..58ac00a 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -602,7 +602,9 @@ llcache_fetch_parse_cache_control(llcache_object *object, char *value)
object->cache.no_cache = LLCACHE_VALIDATE_ALWAYS;
}
- object->cache.max_age = http_cache_control_max_age(cc);
+ if (http_cache_control_has_max_age(cc)) {
+ object->cache.max_age = http_cache_control_max_age(cc);
+ }
http_cache_control_destroy(cc);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=23698aecf844c105b21...
commit 23698aecf844c105b210fa42b642c1d0203978c9
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
HTTP: expose validity of max-age in Cache-Control
As max-age is an optional directive, provide a means to determine
if it is present and correct.
diff --git a/utils/http/cache-control.c b/utils/http/cache-control.c
index f348f16..4470082 100644
--- a/utils/http/cache-control.c
+++ b/utils/http/cache-control.c
@@ -30,6 +30,7 @@
*/
struct http_cache_control {
uint32_t max_age; /**< Max age (delta seconds) */
+ bool max_age_valid; /**< Whether max-age is valid */
bool no_cache; /**< Whether caching is forbidden */
bool no_store; /**< Whether persistent caching is forbidden */
};
@@ -240,6 +241,7 @@ nserror http_parse_cache_control(const char *header_value,
http_directive *directives = NULL;
lwc_string *value_str = NULL;
uint32_t max_age = 0;
+ bool max_age_valid = false;
bool no_cache = false;
bool no_store = false;
nserror error;
@@ -279,6 +281,7 @@ nserror http_parse_cache_control(const char *header_value,
corestring_lwc_max_age, &value_str);
if (error == NSERROR_OK && value_str != NULL) {
error = parse_max_age(value_str, &max_age);
+ max_age_valid = (error == NSERROR_OK);
lwc_string_unref(value_str);
}
@@ -310,6 +313,7 @@ nserror http_parse_cache_control(const char *header_value,
}
cc->max_age = max_age;
+ cc->max_age_valid = max_age_valid;
cc->no_cache = no_cache;
cc->no_store = no_store;
@@ -325,6 +329,12 @@ void http_cache_control_destroy(http_cache_control *victim)
}
/* See cache-control.h for documentation */
+bool http_cache_control_has_max_age(http_cache_control *cc)
+{
+ return cc->max_age_valid;
+}
+
+/* See cache-control.h for documentation */
uint32_t http_cache_control_max_age(http_cache_control *cc)
{
return cc->max_age;
diff --git a/utils/http/cache-control.h b/utils/http/cache-control.h
index 22c5f97..945cfce 100644
--- a/utils/http/cache-control.h
+++ b/utils/http/cache-control.h
@@ -43,6 +43,14 @@ nserror http_parse_cache_control(const char *header_value,
void http_cache_control_destroy(http_cache_control *victim);
/**
+ * Determine if a valid max-age directive is present
+ *
+ * \param cc Object to inspect
+ * \return Whether max-age is valid
+ */
+bool http_cache_control_has_max_age(http_cache_control *cc);
+
+/**
* Get the value of a cache control's max-age
*
* \param cc Object to inspect
-----------------------------------------------------------------------
Summary of changes:
content/llcache.c | 4 +++-
utils/http/cache-control.c | 10 ++++++++++
utils/http/cache-control.h | 8 ++++++++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/content/llcache.c b/content/llcache.c
index d78d5bb..58ac00a 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -602,7 +602,9 @@ llcache_fetch_parse_cache_control(llcache_object *object, char *value)
object->cache.no_cache = LLCACHE_VALIDATE_ALWAYS;
}
- object->cache.max_age = http_cache_control_max_age(cc);
+ if (http_cache_control_has_max_age(cc)) {
+ object->cache.max_age = http_cache_control_max_age(cc);
+ }
http_cache_control_destroy(cc);
diff --git a/utils/http/cache-control.c b/utils/http/cache-control.c
index f348f16..4470082 100644
--- a/utils/http/cache-control.c
+++ b/utils/http/cache-control.c
@@ -30,6 +30,7 @@
*/
struct http_cache_control {
uint32_t max_age; /**< Max age (delta seconds) */
+ bool max_age_valid; /**< Whether max-age is valid */
bool no_cache; /**< Whether caching is forbidden */
bool no_store; /**< Whether persistent caching is forbidden */
};
@@ -240,6 +241,7 @@ nserror http_parse_cache_control(const char *header_value,
http_directive *directives = NULL;
lwc_string *value_str = NULL;
uint32_t max_age = 0;
+ bool max_age_valid = false;
bool no_cache = false;
bool no_store = false;
nserror error;
@@ -279,6 +281,7 @@ nserror http_parse_cache_control(const char *header_value,
corestring_lwc_max_age, &value_str);
if (error == NSERROR_OK && value_str != NULL) {
error = parse_max_age(value_str, &max_age);
+ max_age_valid = (error == NSERROR_OK);
lwc_string_unref(value_str);
}
@@ -310,6 +313,7 @@ nserror http_parse_cache_control(const char *header_value,
}
cc->max_age = max_age;
+ cc->max_age_valid = max_age_valid;
cc->no_cache = no_cache;
cc->no_store = no_store;
@@ -325,6 +329,12 @@ void http_cache_control_destroy(http_cache_control *victim)
}
/* See cache-control.h for documentation */
+bool http_cache_control_has_max_age(http_cache_control *cc)
+{
+ return cc->max_age_valid;
+}
+
+/* See cache-control.h for documentation */
uint32_t http_cache_control_max_age(http_cache_control *cc)
{
return cc->max_age;
diff --git a/utils/http/cache-control.h b/utils/http/cache-control.h
index 22c5f97..945cfce 100644
--- a/utils/http/cache-control.h
+++ b/utils/http/cache-control.h
@@ -43,6 +43,14 @@ nserror http_parse_cache_control(const char *header_value,
void http_cache_control_destroy(http_cache_control *victim);
/**
+ * Determine if a valid max-age directive is present
+ *
+ * \param cc Object to inspect
+ * \return Whether max-age is valid
+ */
+bool http_cache_control_has_max_age(http_cache_control *cc);
+
+/**
* Get the value of a cache control's max-age
*
* \param cc Object to inspect
--
NetSurf Browser
3 years, 7 months
netsurf: branch master updated. release/3.8-270-g047c82c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/047c82cfce53102aced0f...
...commit http://git.netsurf-browser.org/netsurf.git/commit/047c82cfce53102aced0f76...
...tree http://git.netsurf-browser.org/netsurf.git/tree/047c82cfce53102aced0f76f5...
The branch, master has been updated
via 047c82cfce53102aced0f76f5ca13fe3c56b4db2 (commit)
via 04b790643b9e45a1ba8919481f3c4beb80a66c31 (commit)
from 9893b05b084980ff498eee6dd17853d8df807f27 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=047c82cfce53102aced...
commit 047c82cfce53102aced0f76f5ca13fe3c56b4db2
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
LLCache: use Cache-Control parser
diff --git a/content/llcache.c b/content/llcache.c
index 0bf3979..d78d5bb 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -45,6 +45,7 @@
#include "utils/nsurl.h"
#include "utils/utils.h"
#include "utils/time.h"
+#include "utils/http.h"
#include "netsurf/misc.h"
#include "desktop/gui_internal.h"
@@ -583,59 +584,28 @@ static nserror llcache_fetch_split_header(const uint8_t *data, size_t len,
static nserror
llcache_fetch_parse_cache_control(llcache_object *object, char *value)
{
- const char *start = value;
- const char *comma = value;
-
- while (*comma != '\0') {
- while (*comma != '\0' && *comma != ',') {
- comma++;
- }
-
- if ((8 < comma - start) &&
- (strncasecmp(start, "no-cache", 8) == 0 ||
- strncasecmp(start, "no-store", 8) == 0)) {
- /**
- * \todo When we get a disk cache we should
- * distinguish between these two.
- */
- object->cache.no_cache = LLCACHE_VALIDATE_ALWAYS;
- } else if ((7 < comma - start) &&
- strncasecmp(start, "max-age", 7) == 0) {
- start += 7; /* skip max-age */
-
- /* Find '=' */
- while (start < comma && *start != '=') {
- start++;
- }
-
- /* Skip over '=' */
- start++;
-
-#define SKIP_ST(p) while (*p != '\0' && (*p == ' ' || *p == '\t')) p++
-
- if (start < comma) {
- /* Skip whitespace */
- SKIP_ST(start);
- }
+ http_cache_control *cc;
+ nserror error;
- if (start < comma) {
- object->cache.max_age = atoi(start);
+ error = http_parse_cache_control(value, &cc);
+ if (error != NSERROR_OK) {
+ /* Ignore parse errors */
+ return NSERROR_OK;
+ }
- }
- }
+ if (http_cache_control_no_cache(cc) ||
+ http_cache_control_no_store(cc)) {
+ /**
+ * \todo When we get a disk cache we should
+ * distinguish between these two.
+ */
+ object->cache.no_cache = LLCACHE_VALIDATE_ALWAYS;
+ }
- if (*comma != '\0') {
- /* Skip past comma */
- comma++;
- /* Skip whitespace */
- SKIP_ST(comma);
- }
+ object->cache.max_age = http_cache_control_max_age(cc);
-#undef SKIP_ST
+ http_cache_control_destroy(cc);
- /* Set start for next token */
- start = comma;
- }
return NSERROR_OK;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=04b790643b9e45a1ba8...
commit 04b790643b9e45a1ba8919481f3c4beb80a66c31
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
HTTP: add minimal parser for Cache-Control
diff --git a/utils/corestringlist.h b/utils/corestringlist.h
index ea8d7de..4261f4d 100644
--- a/utils/corestringlist.h
+++ b/utils/corestringlist.h
@@ -144,6 +144,8 @@ CORESTRING_LWC_STRING(_top);
CORESTRING_LWC_VALUE(shortcut_icon, "shortcut icon");
CORESTRING_LWC_VALUE(slash_, "/");
CORESTRING_LWC_VALUE(max_age, "max-age");
+CORESTRING_LWC_VALUE(no_cache, "no-cache");
+CORESTRING_LWC_VALUE(no_store, "no-store");
/* mime types */
CORESTRING_LWC_VALUE(multipart_form_data, "multipart/form-data");
diff --git a/utils/http.h b/utils/http.h
index 00caf89..8da4f3f 100644
--- a/utils/http.h
+++ b/utils/http.h
@@ -27,6 +27,7 @@
#include "utils/errors.h"
+#include "utils/http/cache-control.h"
#include "utils/http/content-disposition.h"
#include "utils/http/content-type.h"
#include "utils/http/strict-transport-security.h"
diff --git a/utils/http/Makefile b/utils/http/Makefile
index f3bb765..b60f8f6 100644
--- a/utils/http/Makefile
+++ b/utils/http/Makefile
@@ -1,7 +1,7 @@
# http utils sources
S_HTTP := challenge.c generics.c primitives.c parameter.c \
- content-disposition.c content-type.c \
+ cache-control.c content-disposition.c content-type.c \
strict-transport-security.c www-authenticate.c
S_HTTP := $(addprefix utils/http/,$(S_HTTP))
diff --git a/utils/http/cache-control.c b/utils/http/cache-control.c
new file mode 100644
index 0000000..f348f16
--- /dev/null
+++ b/utils/http/cache-control.c
@@ -0,0 +1,343 @@
+/*
+ * Copyright 2019 John-Mark Bell <jmb(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <limits.h>
+#include <stdlib.h>
+
+#include "utils/corestrings.h"
+#include "utils/http.h"
+
+#include "utils/http/generics.h"
+#include "utils/http/primitives.h"
+
+/**
+ * Representation of a Cache-Control
+ */
+struct http_cache_control {
+ uint32_t max_age; /**< Max age (delta seconds) */
+ bool no_cache; /**< Whether caching is forbidden */
+ bool no_store; /**< Whether persistent caching is forbidden */
+};
+
+/**
+ * Representation of a directive
+ */
+typedef struct http_directive {
+ http__item base;
+
+ lwc_string *name; /**< Parameter name */
+ lwc_string *value; /**< Parameter value (optional) */
+} http_directive;
+
+
+static void http_destroy_directive(http_directive *self)
+{
+ lwc_string_unref(self->name);
+ if (self->value != NULL) {
+ lwc_string_unref(self->value);
+ }
+ free(self);
+}
+
+static nserror http__parse_directive(const char **input,
+ http_directive **result)
+{
+ const char *pos = *input;
+ lwc_string *name;
+ lwc_string *value = NULL;
+ http_directive *directive;
+ nserror error;
+
+ /* token [ "=" ( token | quoted-string ) ] */
+
+ error = http__parse_token(&pos, &name);
+ if (error != NSERROR_OK)
+ return error;
+
+ http__skip_LWS(&pos);
+
+ if (*pos == '=') {
+ pos++;
+
+ http__skip_LWS(&pos);
+
+ if (*pos == '"')
+ error = http__parse_quoted_string(&pos, &value);
+ else
+ error = http__parse_token(&pos, &value);
+
+ if (error != NSERROR_OK) {
+ lwc_string_unref(name);
+ return error;
+ }
+ }
+
+ directive = malloc(sizeof(*directive));
+ if (directive == NULL) {
+ if (value != NULL) {
+ lwc_string_unref(value);
+ }
+ lwc_string_unref(name);
+ return NSERROR_NOMEM;
+ }
+
+ HTTP__ITEM_INIT(directive, NULL, http_destroy_directive);
+ directive->name = name;
+ directive->value = value;
+
+ *result = directive;
+ *input = pos;
+
+ return NSERROR_OK;
+}
+
+static void http_directive_list_destroy(http_directive *list)
+{
+ http__item_list_destroy(list);
+}
+
+static nserror http_directive_list_find_item(const http_directive *list,
+ lwc_string *name, lwc_string **value)
+{
+ bool match;
+
+ while (list != NULL) {
+ if (lwc_string_caseless_isequal(name, list->name,
+ &match) == lwc_error_ok && match)
+ break;
+
+ list = (http_directive *) list->base.next;
+ }
+
+ if (list == NULL)
+ return NSERROR_NOT_FOUND;
+
+ if (list->value != NULL) {
+ *value = lwc_string_ref(list->value);
+ } else {
+ *value = NULL;
+ }
+
+ return NSERROR_OK;
+}
+
+static const http_directive *http_directive_list_iterate(
+ const http_directive *cur,
+ lwc_string **name, lwc_string **value)
+{
+ if (cur == NULL)
+ return NULL;
+
+ *name = lwc_string_ref(cur->name);
+ if (cur->value != NULL) {
+ *value = lwc_string_ref(cur->value);
+ } else {
+ *value = NULL;
+ }
+
+ return (http_directive *) cur->base.next;
+}
+
+static uint32_t count(const http_directive *list, lwc_string *key)
+{
+ uint32_t count = 0;
+ bool match;
+
+ while (list != NULL) {
+ if (lwc_string_caseless_isequal(key, list->name,
+ &match) == lwc_error_ok && match) {
+ count++;
+ }
+
+ list = (http_directive *) list->base.next;
+ }
+
+ return count;
+}
+
+static bool check_duplicates(const http_directive *directives)
+{
+ bool result = true;
+ const http_directive *key = directives;
+
+ if (key == NULL) {
+ /* No directives, so there can't be any duplicates */
+ return true;
+ }
+
+ do {
+ lwc_string *name = NULL, *value = NULL;
+
+ key = http_directive_list_iterate(key, &name, &value);
+
+ result &= (count(directives, name) == 1);
+
+ lwc_string_unref(name);
+ if (value != NULL) {
+ lwc_string_unref(value);
+ }
+ } while (key != NULL);
+
+ return result;
+}
+
+static nserror parse_max_age(lwc_string *value, uint32_t *result)
+{
+ const char *pos = lwc_string_data(value);
+ const char *end = pos + lwc_string_length(value);
+ uint32_t val = 0;
+
+ /* 1*DIGIT */
+
+ if (pos == end) {
+ /* Blank value */
+ return NSERROR_NOT_FOUND;
+ }
+
+ while (pos < end) {
+ if ('0' <= *pos && *pos <= '9') {
+ uint32_t nv = val * 10 + (*pos - '0');
+ if (nv < val) {
+ val = UINT_MAX;
+ } else {
+ val = nv;
+ }
+ } else {
+ /* Non-digit */
+ return NSERROR_NOT_FOUND;
+ }
+
+ pos++;
+ }
+
+ *result = val;
+
+ return NSERROR_OK;
+}
+
+/* See cache-control.h for documentation */
+nserror http_parse_cache_control(const char *header_value,
+ http_cache_control **result)
+{
+ const char *pos = header_value;
+ http_cache_control *cc;
+ http_directive *first = NULL;
+ http_directive *directives = NULL;
+ lwc_string *value_str = NULL;
+ uint32_t max_age = 0;
+ bool no_cache = false;
+ bool no_store = false;
+ nserror error;
+
+ /* 1#cache-directive */
+
+ http__skip_LWS(&pos);
+
+ error = http__parse_directive(&pos, &first);
+ if (error != NSERROR_OK) {
+ return error;
+ }
+
+ http__skip_LWS(&pos);
+
+ if (*pos == ',') {
+ error = http__item_list_parse(&pos,
+ http__parse_directive, first, &directives);
+ if (error != NSERROR_OK) {
+ if (directives != NULL) {
+ http_directive_list_destroy(directives);
+ }
+ return error;
+ }
+ } else {
+ directives = first;
+ }
+
+ /* Each directive must only appear once */
+ if (check_duplicates(directives) == false) {
+ http_directive_list_destroy(directives);
+ return NSERROR_NOT_FOUND;
+ }
+
+ /* Find max-age */
+ error = http_directive_list_find_item(directives,
+ corestring_lwc_max_age, &value_str);
+ if (error == NSERROR_OK && value_str != NULL) {
+ error = parse_max_age(value_str, &max_age);
+ lwc_string_unref(value_str);
+ }
+
+ /* Find no-cache */
+ error = http_directive_list_find_item(directives,
+ corestring_lwc_no_cache, &value_str);
+ if (error == NSERROR_OK) {
+ no_cache = true;
+ if (value_str != NULL) {
+ lwc_string_unref(value_str);
+ }
+ }
+
+ /* Find no-store */
+ error = http_directive_list_find_item(directives,
+ corestring_lwc_no_store, &value_str);
+ if (error == NSERROR_OK) {
+ no_store = true;
+ if (value_str != NULL) {
+ lwc_string_unref(value_str);
+ }
+ }
+
+ http_directive_list_destroy(directives);
+
+ cc = malloc(sizeof(*cc));
+ if (cc == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ cc->max_age = max_age;
+ cc->no_cache = no_cache;
+ cc->no_store = no_store;
+
+ *result = cc;
+
+ return NSERROR_OK;
+}
+
+/* See cache-control.h for documentation */
+void http_cache_control_destroy(http_cache_control *victim)
+{
+ free(victim);
+}
+
+/* See cache-control.h for documentation */
+uint32_t http_cache_control_max_age(http_cache_control *cc)
+{
+ return cc->max_age;
+}
+
+/* See cache-control.h for documentation */
+bool http_cache_control_no_cache(http_cache_control *cc)
+{
+ return cc->no_cache;
+}
+
+/* See cache-control.h for documentation */
+bool http_cache_control_no_store(http_cache_control *cc)
+{
+ return cc->no_store;
+}
diff --git a/utils/http/cache-control.h b/utils/http/cache-control.h
new file mode 100644
index 0000000..22c5f97
--- /dev/null
+++ b/utils/http/cache-control.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2019 John-Mark Bell <jmb(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NETSURF_UTILS_HTTP_CACHE_CONTROL_H_
+#define NETSURF_UTILS_HTTP_CACHE_CONTROL_H_
+
+#include <libwapcaplet/libwapcaplet.h>
+
+typedef struct http_cache_control http_cache_control;
+
+/**
+ * Parse an HTTP Cache-Control header value
+ *
+ * \param header_value Header value to parse
+ * \param result Pointer to location to receive result
+ * \return NSERROR_OK on success,
+ * NSERROR_NOMEM on memory exhaustion,
+ * appropriate error otherwise
+ */
+nserror http_parse_cache_control(const char *header_value,
+ http_cache_control **result);
+
+/**
+ * Destroy a cache_control object
+ *
+ * \param victim Object to destroy
+ */
+void http_cache_control_destroy(http_cache_control *victim);
+
+/**
+ * Get the value of a cache control's max-age
+ *
+ * \param cc Object to inspect
+ * \return Max age, in delta-seconds
+ */
+uint32_t http_cache_control_max_age(http_cache_control *cc);
+
+/**
+ * Get the value of a cache control's no-cache flag
+ *
+ * \param cc Object to inspect
+ * \return Whether caching is forbidden
+ */
+bool http_cache_control_no_cache(http_cache_control *cc);
+
+/**
+ * Get the value of a cache control's no-store flag
+ *
+ * \param cc Object to inspect
+ * \return Whether persistent caching is forbidden
+ */
+bool http_cache_control_no_store(http_cache_control *cc);
+
+#endif
-----------------------------------------------------------------------
Summary of changes:
content/llcache.c | 66 ++++--------
utils/corestringlist.h | 2 +
utils/http.h | 1 +
utils/http/Makefile | 2 +-
...strict-transport-security.c => cache-control.c} | 106 ++++++++++----------
...strict-transport-security.h => cache-control.h} | 43 ++++----
6 files changed, 100 insertions(+), 120 deletions(-)
copy utils/http/{strict-transport-security.c => cache-control.c} (72%)
copy utils/http/{strict-transport-security.h => cache-control.h} (51%)
diff --git a/content/llcache.c b/content/llcache.c
index 0bf3979..d78d5bb 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -45,6 +45,7 @@
#include "utils/nsurl.h"
#include "utils/utils.h"
#include "utils/time.h"
+#include "utils/http.h"
#include "netsurf/misc.h"
#include "desktop/gui_internal.h"
@@ -583,59 +584,28 @@ static nserror llcache_fetch_split_header(const uint8_t *data, size_t len,
static nserror
llcache_fetch_parse_cache_control(llcache_object *object, char *value)
{
- const char *start = value;
- const char *comma = value;
-
- while (*comma != '\0') {
- while (*comma != '\0' && *comma != ',') {
- comma++;
- }
-
- if ((8 < comma - start) &&
- (strncasecmp(start, "no-cache", 8) == 0 ||
- strncasecmp(start, "no-store", 8) == 0)) {
- /**
- * \todo When we get a disk cache we should
- * distinguish between these two.
- */
- object->cache.no_cache = LLCACHE_VALIDATE_ALWAYS;
- } else if ((7 < comma - start) &&
- strncasecmp(start, "max-age", 7) == 0) {
- start += 7; /* skip max-age */
-
- /* Find '=' */
- while (start < comma && *start != '=') {
- start++;
- }
-
- /* Skip over '=' */
- start++;
-
-#define SKIP_ST(p) while (*p != '\0' && (*p == ' ' || *p == '\t')) p++
-
- if (start < comma) {
- /* Skip whitespace */
- SKIP_ST(start);
- }
+ http_cache_control *cc;
+ nserror error;
- if (start < comma) {
- object->cache.max_age = atoi(start);
+ error = http_parse_cache_control(value, &cc);
+ if (error != NSERROR_OK) {
+ /* Ignore parse errors */
+ return NSERROR_OK;
+ }
- }
- }
+ if (http_cache_control_no_cache(cc) ||
+ http_cache_control_no_store(cc)) {
+ /**
+ * \todo When we get a disk cache we should
+ * distinguish between these two.
+ */
+ object->cache.no_cache = LLCACHE_VALIDATE_ALWAYS;
+ }
- if (*comma != '\0') {
- /* Skip past comma */
- comma++;
- /* Skip whitespace */
- SKIP_ST(comma);
- }
+ object->cache.max_age = http_cache_control_max_age(cc);
-#undef SKIP_ST
+ http_cache_control_destroy(cc);
- /* Set start for next token */
- start = comma;
- }
return NSERROR_OK;
}
diff --git a/utils/corestringlist.h b/utils/corestringlist.h
index ea8d7de..4261f4d 100644
--- a/utils/corestringlist.h
+++ b/utils/corestringlist.h
@@ -144,6 +144,8 @@ CORESTRING_LWC_STRING(_top);
CORESTRING_LWC_VALUE(shortcut_icon, "shortcut icon");
CORESTRING_LWC_VALUE(slash_, "/");
CORESTRING_LWC_VALUE(max_age, "max-age");
+CORESTRING_LWC_VALUE(no_cache, "no-cache");
+CORESTRING_LWC_VALUE(no_store, "no-store");
/* mime types */
CORESTRING_LWC_VALUE(multipart_form_data, "multipart/form-data");
diff --git a/utils/http.h b/utils/http.h
index 00caf89..8da4f3f 100644
--- a/utils/http.h
+++ b/utils/http.h
@@ -27,6 +27,7 @@
#include "utils/errors.h"
+#include "utils/http/cache-control.h"
#include "utils/http/content-disposition.h"
#include "utils/http/content-type.h"
#include "utils/http/strict-transport-security.h"
diff --git a/utils/http/Makefile b/utils/http/Makefile
index f3bb765..b60f8f6 100644
--- a/utils/http/Makefile
+++ b/utils/http/Makefile
@@ -1,7 +1,7 @@
# http utils sources
S_HTTP := challenge.c generics.c primitives.c parameter.c \
- content-disposition.c content-type.c \
+ cache-control.c content-disposition.c content-type.c \
strict-transport-security.c www-authenticate.c
S_HTTP := $(addprefix utils/http/,$(S_HTTP))
diff --git a/utils/http/strict-transport-security.c b/utils/http/cache-control.c
similarity index 72%
copy from utils/http/strict-transport-security.c
copy to utils/http/cache-control.c
index 9de610c..f348f16 100644
--- a/utils/http/strict-transport-security.c
+++ b/utils/http/cache-control.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 John-Mark Bell <jmb(a)netsurf-browser.org>
+ * Copyright 2019 John-Mark Bell <jmb(a)netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -26,11 +26,12 @@
#include "utils/http/primitives.h"
/**
- * Representation of a Strict-Transport-Security
+ * Representation of a Cache-Control
*/
-struct http_strict_transport_security {
+struct http_cache_control {
uint32_t max_age; /**< Max age (delta seconds) */
- bool include_sub_domains; /**< Whether subdomains are included */
+ bool no_cache; /**< Whether caching is forbidden */
+ bool no_store; /**< Whether persistent caching is forbidden */
};
/**
@@ -229,20 +230,21 @@ static nserror parse_max_age(lwc_string *value, uint32_t *result)
return NSERROR_OK;
}
-/* See strict-transport-security.h for documentation */
-nserror http_parse_strict_transport_security(const char *header_value,
- http_strict_transport_security **result)
+/* See cache-control.h for documentation */
+nserror http_parse_cache_control(const char *header_value,
+ http_cache_control **result)
{
const char *pos = header_value;
- http_strict_transport_security *sts;
+ http_cache_control *cc;
http_directive *first = NULL;
http_directive *directives = NULL;
- lwc_string *max_age_str = NULL, *isd_str = NULL;
- uint32_t max_age;
- bool include_sub_domains = false;
+ lwc_string *value_str = NULL;
+ uint32_t max_age = 0;
+ bool no_cache = false;
+ bool no_store = false;
nserror error;
- /* directive *( ";" directive ) */
+ /* 1#cache-directive */
http__skip_LWS(&pos);
@@ -253,7 +255,7 @@ nserror http_parse_strict_transport_security(const char *header_value,
http__skip_LWS(&pos);
- if (*pos == ';') {
+ if (*pos == ',') {
error = http__item_list_parse(&pos,
http__parse_directive, first, &directives);
if (error != NSERROR_OK) {
@@ -272,70 +274,70 @@ nserror http_parse_strict_transport_security(const char *header_value,
return NSERROR_NOT_FOUND;
}
- /* max-age is required */
+ /* Find max-age */
error = http_directive_list_find_item(directives,
- corestring_lwc_max_age, &max_age_str);
- if (error != NSERROR_OK || max_age_str == NULL) {
- http_directive_list_destroy(directives);
- return NSERROR_NOT_FOUND;
+ corestring_lwc_max_age, &value_str);
+ if (error == NSERROR_OK && value_str != NULL) {
+ error = parse_max_age(value_str, &max_age);
+ lwc_string_unref(value_str);
}
- error = parse_max_age(max_age_str, &max_age);
- if (error != NSERROR_OK) {
- lwc_string_unref(max_age_str);
- http_directive_list_destroy(directives);
- return NSERROR_NOT_FOUND;
+ /* Find no-cache */
+ error = http_directive_list_find_item(directives,
+ corestring_lwc_no_cache, &value_str);
+ if (error == NSERROR_OK) {
+ no_cache = true;
+ if (value_str != NULL) {
+ lwc_string_unref(value_str);
+ }
}
- lwc_string_unref(max_age_str);
- /* includeSubDomains is optional and valueless */
+ /* Find no-store */
error = http_directive_list_find_item(directives,
- corestring_lwc_includesubdomains, &isd_str);
- if (error != NSERROR_OK && error != NSERROR_NOT_FOUND) {
- http_directive_list_destroy(directives);
- return NSERROR_NOT_FOUND;
- } else if (error == NSERROR_OK) {
- if (isd_str != NULL) {
- /* Present, but not valueless: invalid */
- lwc_string_unref(isd_str);
- http_directive_list_destroy(directives);
- return NSERROR_NOT_FOUND;
+ corestring_lwc_no_store, &value_str);
+ if (error == NSERROR_OK) {
+ no_store = true;
+ if (value_str != NULL) {
+ lwc_string_unref(value_str);
}
- include_sub_domains = true;
}
+
http_directive_list_destroy(directives);
- sts = malloc(sizeof(*sts));
- if (sts == NULL) {
+ cc = malloc(sizeof(*cc));
+ if (cc == NULL) {
return NSERROR_NOMEM;
}
- sts->max_age = max_age;
- sts->include_sub_domains = include_sub_domains;
+ cc->max_age = max_age;
+ cc->no_cache = no_cache;
+ cc->no_store = no_store;
- *result = sts;
+ *result = cc;
return NSERROR_OK;
}
-/* See strict-transport-security.h for documentation */
-void http_strict_transport_security_destroy(
- http_strict_transport_security *victim)
+/* See cache-control.h for documentation */
+void http_cache_control_destroy(http_cache_control *victim)
{
free(victim);
}
-/* See strict-transport-security.h for documentation */
-uint32_t http_strict_transport_security_max_age(
- http_strict_transport_security *sts)
+/* See cache-control.h for documentation */
+uint32_t http_cache_control_max_age(http_cache_control *cc)
{
- return sts->max_age;
+ return cc->max_age;
}
-/* See strict-transport-security.h for documentation */
-bool http_strict_transport_security_include_subdomains(
- http_strict_transport_security *sts)
+/* See cache-control.h for documentation */
+bool http_cache_control_no_cache(http_cache_control *cc)
{
- return sts->include_sub_domains;
+ return cc->no_cache;
}
+/* See cache-control.h for documentation */
+bool http_cache_control_no_store(http_cache_control *cc)
+{
+ return cc->no_store;
+}
diff --git a/utils/http/strict-transport-security.h b/utils/http/cache-control.h
similarity index 51%
copy from utils/http/strict-transport-security.h
copy to utils/http/cache-control.h
index 4e52419..22c5f97 100644
--- a/utils/http/strict-transport-security.h
+++ b/utils/http/cache-control.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 John-Mark Bell <jmb(a)netsurf-browser.org>
+ * Copyright 2019 John-Mark Bell <jmb(a)netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,15 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NETSURF_UTILS_HTTP_STRICT_TRANSPORT_SECURITY_H_
-#define NETSURF_UTILS_HTTP_STRICT_TRANSPORT_SECURITY_H_
+#ifndef NETSURF_UTILS_HTTP_CACHE_CONTROL_H_
+#define NETSURF_UTILS_HTTP_CACHE_CONTROL_H_
#include <libwapcaplet/libwapcaplet.h>
-typedef struct http_strict_transport_security http_strict_transport_security;
+typedef struct http_cache_control http_cache_control;
/**
- * Parse an HTTP Strict-Transport-Security header value
+ * Parse an HTTP Cache-Control header value
*
* \param header_value Header value to parse
* \param result Pointer to location to receive result
@@ -32,33 +32,38 @@ typedef struct http_strict_transport_security http_strict_transport_security;
* NSERROR_NOMEM on memory exhaustion,
* appropriate error otherwise
*/
-nserror http_parse_strict_transport_security(const char *header_value,
- http_strict_transport_security **result);
+nserror http_parse_cache_control(const char *header_value,
+ http_cache_control **result);
/**
- * Destroy a strict transport security object
+ * Destroy a cache_control object
*
* \param victim Object to destroy
*/
-void http_strict_transport_security_destroy(
- http_strict_transport_security *victim);
+void http_cache_control_destroy(http_cache_control *victim);
/**
- * Get the value of a strict transport security's max-age
+ * Get the value of a cache control's max-age
*
- * \param sts Object to inspect
+ * \param cc Object to inspect
* \return Max age, in delta-seconds
*/
-uint32_t http_strict_transport_security_max_age(
- http_strict_transport_security *sts);
+uint32_t http_cache_control_max_age(http_cache_control *cc);
/**
- * Get the value of a strict transport security's includeSubDomains flag
+ * Get the value of a cache control's no-cache flag
*
- * \param sts Object to inspect
- * \return Whether subdomains should be included
+ * \param cc Object to inspect
+ * \return Whether caching is forbidden
*/
-bool http_strict_transport_security_include_subdomains(
- http_strict_transport_security *sts);
+bool http_cache_control_no_cache(http_cache_control *cc);
+
+/**
+ * Get the value of a cache control's no-store flag
+ *
+ * \param cc Object to inspect
+ * \return Whether persistent caching is forbidden
+ */
+bool http_cache_control_no_store(http_cache_control *cc);
#endif
--
NetSurf Browser
3 years, 7 months
netsurf: branch master updated. release/3.8-268-g9893b05
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/9893b05b084980ff498ee...
...commit http://git.netsurf-browser.org/netsurf.git/commit/9893b05b084980ff498eee6...
...tree http://git.netsurf-browser.org/netsurf.git/tree/9893b05b084980ff498eee6dd...
The branch, master has been updated
via 9893b05b084980ff498eee6dd17853d8df807f27 (commit)
from e598dcd139d8221f828d542ccf6f03466a5aecdc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=9893b05b084980ff498...
commit 9893b05b084980ff498eee6dd17853d8df807f27
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
use jmb suggested fix to cache-control header parse error
diff --git a/content/llcache.c b/content/llcache.c
index c804b73..0bf3979 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -608,16 +608,15 @@ llcache_fetch_parse_cache_control(llcache_object *object, char *value)
start++;
}
- if (start < comma) {
- /* Skip over '=' */
- start++;
- }
-
+ /* Skip over '=' */
+ start++;
#define SKIP_ST(p) while (*p != '\0' && (*p == ' ' || *p == '\t')) p++
- /* Skip whitespace */
- SKIP_ST(start);
+ if (start < comma) {
+ /* Skip whitespace */
+ SKIP_ST(start);
+ }
if (start < comma) {
object->cache.max_age = atoi(start);
-----------------------------------------------------------------------
Summary of changes:
content/llcache.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/content/llcache.c b/content/llcache.c
index c804b73..0bf3979 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -608,16 +608,15 @@ llcache_fetch_parse_cache_control(llcache_object *object, char *value)
start++;
}
- if (start < comma) {
- /* Skip over '=' */
- start++;
- }
-
+ /* Skip over '=' */
+ start++;
#define SKIP_ST(p) while (*p != '\0' && (*p == ' ' || *p == '\t')) p++
- /* Skip whitespace */
- SKIP_ST(start);
+ if (start < comma) {
+ /* Skip whitespace */
+ SKIP_ST(start);
+ }
if (start < comma) {
object->cache.max_age = atoi(start);
--
NetSurf Browser
3 years, 7 months
netsurf: branch master updated. release/3.8-267-ge598dcd
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/e598dcd139d8221f828d5...
...commit http://git.netsurf-browser.org/netsurf.git/commit/e598dcd139d8221f828d542...
...tree http://git.netsurf-browser.org/netsurf.git/tree/e598dcd139d8221f828d542cc...
The branch, master has been updated
via e598dcd139d8221f828d542ccf6f03466a5aecdc (commit)
from 24590a1145f3d9e6a2842d51b426157da653be5d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=e598dcd139d8221f828...
commit e598dcd139d8221f828d542ccf6f03466a5aecdc
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fix parsing of invalid syntax max-age value Cache-control header
diff --git a/content/llcache.c b/content/llcache.c
index 5aa8a9a..c804b73 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -601,13 +601,18 @@ llcache_fetch_parse_cache_control(llcache_object *object, char *value)
object->cache.no_cache = LLCACHE_VALIDATE_ALWAYS;
} else if ((7 < comma - start) &&
strncasecmp(start, "max-age", 7) == 0) {
+ start += 7; /* skip max-age */
+
/* Find '=' */
while (start < comma && *start != '=') {
start++;
}
- /* Skip over it */
- start++;
+ if (start < comma) {
+ /* Skip over '=' */
+ start++;
+ }
+
#define SKIP_ST(p) while (*p != '\0' && (*p == ' ' || *p == '\t')) p++
@@ -616,6 +621,7 @@ llcache_fetch_parse_cache_control(llcache_object *object, char *value)
if (start < comma) {
object->cache.max_age = atoi(start);
+
}
}
-----------------------------------------------------------------------
Summary of changes:
content/llcache.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/content/llcache.c b/content/llcache.c
index 5aa8a9a..c804b73 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -601,13 +601,18 @@ llcache_fetch_parse_cache_control(llcache_object *object, char *value)
object->cache.no_cache = LLCACHE_VALIDATE_ALWAYS;
} else if ((7 < comma - start) &&
strncasecmp(start, "max-age", 7) == 0) {
+ start += 7; /* skip max-age */
+
/* Find '=' */
while (start < comma && *start != '=') {
start++;
}
- /* Skip over it */
- start++;
+ if (start < comma) {
+ /* Skip over '=' */
+ start++;
+ }
+
#define SKIP_ST(p) while (*p != '\0' && (*p == ' ' || *p == '\t')) p++
@@ -616,6 +621,7 @@ llcache_fetch_parse_cache_control(llcache_object *object, char *value)
if (start < comma) {
object->cache.max_age = atoi(start);
+
}
}
--
NetSurf Browser
3 years, 7 months
netsurf: branch master updated. release/3.8-266-g24590a1
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/24590a1145f3d9e6a2842...
...commit http://git.netsurf-browser.org/netsurf.git/commit/24590a1145f3d9e6a2842d5...
...tree http://git.netsurf-browser.org/netsurf.git/tree/24590a1145f3d9e6a2842d51b...
The branch, master has been updated
via 24590a1145f3d9e6a2842d51b426157da653be5d (commit)
from 93494790f31b4a0bb36827bc60e00e97559482f8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=24590a1145f3d9e6a28...
commit 24590a1145f3d9e6a2842d51b426157da653be5d
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Check callback memory is allocated before trying to use it.
diff --git a/frontends/amiga/schedule.c b/frontends/amiga/schedule.c
index da674f8..307fff3 100644
--- a/frontends/amiga/schedule.c
+++ b/frontends/amiga/schedule.c
@@ -345,12 +345,13 @@ nserror ami_schedule(int t, void (*callback)(void *p), void *p)
nscb = AllocSysObjectTags(ASOT_IOREQUEST,
ASOIOR_Duplicate, tioreq,
TAG_DONE);
+ if(nscb == NULL) return NSERROR_NOMEM;
#else
if(schedule_msgport == NULL) return NSERROR_NOMEM;
nscb = AllocVec(sizeof(struct nscallback), MEMF_PUBLIC | MEMF_CLEAR);
+ if(nscb == NULL) return NSERROR_NOMEM;
*nscb = *tioreq;
#endif
- if(!nscb) return NSERROR_NOMEM;
if (ami_schedule_add_timer_event(nscb, t) != NSERROR_OK)
return NSERROR_NOMEM;
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/schedule.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/frontends/amiga/schedule.c b/frontends/amiga/schedule.c
index da674f8..307fff3 100644
--- a/frontends/amiga/schedule.c
+++ b/frontends/amiga/schedule.c
@@ -345,12 +345,13 @@ nserror ami_schedule(int t, void (*callback)(void *p), void *p)
nscb = AllocSysObjectTags(ASOT_IOREQUEST,
ASOIOR_Duplicate, tioreq,
TAG_DONE);
+ if(nscb == NULL) return NSERROR_NOMEM;
#else
if(schedule_msgport == NULL) return NSERROR_NOMEM;
nscb = AllocVec(sizeof(struct nscallback), MEMF_PUBLIC | MEMF_CLEAR);
+ if(nscb == NULL) return NSERROR_NOMEM;
*nscb = *tioreq;
#endif
- if(!nscb) return NSERROR_NOMEM;
if (ami_schedule_add_timer_event(nscb, t) != NSERROR_OK)
return NSERROR_NOMEM;
--
NetSurf Browser
3 years, 7 months
netsurf: branch master updated. release/3.8-265-g9349479
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/93494790f31b4a0bb3682...
...commit http://git.netsurf-browser.org/netsurf.git/commit/93494790f31b4a0bb36827b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/93494790f31b4a0bb36827bc6...
The branch, master has been updated
via 93494790f31b4a0bb36827bc60e00e97559482f8 (commit)
from 7314651b9506d9810ce15c45811894e4e6a89107 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=93494790f31b4a0bb36...
commit 93494790f31b4a0bb36827bc60e00e97559482f8
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Fix memory leak in Amiga frontend
diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index 63add64..57afbdd 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -247,6 +247,7 @@ char *translate_escape_chars(const char *s)
{
size_t i, ii, len;
char *ret;
+ char *outs;
len = strlen(s);
ret = malloc(len + 1);
if (ret == NULL)
@@ -262,7 +263,9 @@ char *translate_escape_chars(const char *s)
}
ret[ii] = '\0';
- return ami_utf8_easy(ret);
+ outs = ami_utf8_easy(ret);
+ free(ret);
+ return outs;
}
/**
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/misc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index 63add64..57afbdd 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -247,6 +247,7 @@ char *translate_escape_chars(const char *s)
{
size_t i, ii, len;
char *ret;
+ char *outs;
len = strlen(s);
ret = malloc(len + 1);
if (ret == NULL)
@@ -262,7 +263,9 @@ char *translate_escape_chars(const char *s)
}
ret[ii] = '\0';
- return ami_utf8_easy(ret);
+ outs = ami_utf8_easy(ret);
+ free(ret);
+ return outs;
}
/**
--
NetSurf Browser
3 years, 7 months
netsurf: branch chris/debug updated. release/3.8-270-g4b4ec5b
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/4b4ec5b4d21b77590f4ad...
...commit http://git.netsurf-browser.org/netsurf.git/commit/4b4ec5b4d21b77590f4adf2...
...tree http://git.netsurf-browser.org/netsurf.git/tree/4b4ec5b4d21b77590f4adf2dd...
The branch, chris/debug has been updated
discards bc6deb1adf2b05a102247cd81a6f2ea12dc7cabd (commit)
discards d13c920e07f819b484139145c196609a8f0a2d18 (commit)
discards e36c78074799920d38564100b76817f7ea7d2f8c (commit)
discards dd1b2bb2b0953efda49757f32e7baf559ad6438c (commit)
discards 25237f93db0fb5e393145aa815dc95a7988db29b (commit)
via 4b4ec5b4d21b77590f4adf2dd76fdf88ca1e8485 (commit)
via b5c2f8bb9e2e272f259b09b7dbb20dfebfdc794c (commit)
via 0278cf48770b34de9726a2517adec22bd35faf50 (commit)
via 87b34e1ddd22cf575c994ab04c2185f3cab6a9f6 (commit)
via 4134d4cbd67ab734ab1703489cca47d39a7e9864 (commit)
via 1a235de6628693b18e1b2e9a5ed1d4154d2fe749 (commit)
via 7314651b9506d9810ce15c45811894e4e6a89107 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (bc6deb1adf2b05a102247cd81a6f2ea12dc7cabd)
\
N -- N -- N (4b4ec5b4d21b77590f4adf2dd76fdf88ca1e8485)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4b4ec5b4d21b77590f4...
commit 4b4ec5b4d21b77590f4adf2dd76fdf88ca1e8485
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Correct memory pool allocs with the ones from master
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index 93201a2..a9a882e 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -51,10 +51,10 @@ void *ami_memory_clear_alloc(size_t size, UBYTE value);
#define ami_memory_itempool_alloc(p,s) ItemPoolAlloc(p)
#define ami_memory_itempool_free(p,i,s) ItemPoolFree(p,i)
#else
-#define ami_memory_itempool_create(s) (NULL)
+#define ami_memory_itempool_create(s) ((APTR)1)
#define ami_memory_itempool_delete(p) ((void)0)
#define ami_memory_itempool_alloc(p,s) malloc(s)
-#define ami_memory_itempool_free(p,i,s) free(p)
+#define ami_memory_itempool_free(p,i,s) free(i)
#endif
/* clib2 slab allocator */
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=b5c2f8bb9e2e272f259...
commit b5c2f8bb9e2e272f259b09b7dbb20dfebfdc794c
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Revert "Ensure we free the pen list memory"
This reverts commit 74d7c2d2c2b2161701c1f0258bbfc7feb753ac1e.
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index b6add47..f06f911 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -354,6 +354,7 @@ void ami_plot_release_pens(struct MinList *shared_pens)
Remove((struct Node *)node);
ami_memory_itempool_free(pool_pens, node, sizeof(struct ami_plot_pen));
} while((node = nnode));
+
}
static void ami_plot_setapen(struct gui_globals *glob, struct RastPort *rp, ULONG colr)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0278cf48770b34de972...
commit 0278cf48770b34de9726a2517adec22bd35faf50
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Replace custom itempool functions with malloc/free as clib handles these more efficiently than our pools.
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index a9a882e..93201a2 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -51,10 +51,10 @@ void *ami_memory_clear_alloc(size_t size, UBYTE value);
#define ami_memory_itempool_alloc(p,s) ItemPoolAlloc(p)
#define ami_memory_itempool_free(p,i,s) ItemPoolFree(p,i)
#else
-#define ami_memory_itempool_create(s) ((APTR)1)
+#define ami_memory_itempool_create(s) (NULL)
#define ami_memory_itempool_delete(p) ((void)0)
#define ami_memory_itempool_alloc(p,s) malloc(s)
-#define ami_memory_itempool_free(p,i,s) free(i)
+#define ami_memory_itempool_free(p,i,s) free(p)
#endif
/* clib2 slab allocator */
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=87b34e1ddd22cf575c9...
commit 87b34e1ddd22cf575c994ab04c2185f3cab6a9f6
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Modify some "free" references which were failing to build with clib2 debug mode
diff --git a/content/fetch.c b/content/fetch.c
index 7665029..e6af45a 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -598,7 +598,7 @@ void fetch_free(struct fetch *f)
f,
f->fetcher_handle);
- fetchers[f->fetcherd].ops.free(f->fetcher_handle);
+ fetchers[f->fetcherd].ops.ffree(f->fetcher_handle);
fetch_unref_fetcher(f->fetcherd);
diff --git a/content/fetchers.h b/content/fetchers.h
index 6392e24..36d77c1 100644
--- a/content/fetchers.h
+++ b/content/fetchers.h
@@ -83,7 +83,7 @@ struct fetcher_operation_table {
/**
* free a fetch allocated through the setup method.
*/
- void (*free)(void *fetch);
+ void (*ffree)(void *fetch);
/**
* poll a fetcher to let it make progress.
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 4d14020..76985a7 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -853,7 +853,7 @@ nserror fetch_about_register(void)
.setup = fetch_about_setup,
.start = fetch_about_start,
.abort = fetch_about_abort,
- .free = fetch_about_free,
+ .ffree = fetch_about_free,
.poll = fetch_about_poll,
.finalise = fetch_about_finalise
};
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index c039429..e54f863 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -1484,7 +1484,7 @@ nserror fetch_curl_register(void)
.setup = fetch_curl_setup,
.start = fetch_curl_start,
.abort = fetch_curl_abort,
- .free = fetch_curl_free,
+ .ffree = fetch_curl_free,
.poll = fetch_curl_poll,
.fdset = fetch_curl_fdset,
.finalise = fetch_curl_finalise
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index 8c04bcf..cb7dbdc 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -316,7 +316,7 @@ nserror fetch_data_register(void)
.setup = fetch_data_setup,
.start = fetch_data_start,
.abort = fetch_data_abort,
- .free = fetch_data_free,
+ .ffree = fetch_data_free,
.poll = fetch_data_poll,
.finalise = fetch_data_finalise
};
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index 4fa1a21..52c0263 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -827,7 +827,7 @@ nserror fetch_file_register(void)
.setup = fetch_file_setup,
.start = fetch_file_start,
.abort = fetch_file_abort,
- .free = fetch_file_free,
+ .ffree = fetch_file_free,
.poll = fetch_file_poll,
.finalise = fetch_file_finalise
};
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index 7875773..3177e7c 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -464,7 +464,7 @@ nserror fetch_resource_register(void)
.setup = fetch_resource_setup,
.start = fetch_resource_start,
.abort = fetch_resource_abort,
- .free = fetch_resource_free,
+ .ffree = fetch_resource_free,
.poll = fetch_resource_poll,
.finalise = fetch_resource_finalise
};
diff --git a/content/handlers/html/html_css_fetcher.c b/content/handlers/html/html_css_fetcher.c
index 7987ea0..cf2aa39 100644
--- a/content/handlers/html/html_css_fetcher.c
+++ b/content/handlers/html/html_css_fetcher.c
@@ -291,7 +291,7 @@ nserror html_css_fetcher_register(void)
.setup = html_css_fetcher_setup,
.start = html_css_fetcher_start,
.abort = html_css_fetcher_abort,
- .free = html_css_fetcher_free,
+ .ffree = html_css_fetcher_free,
.poll = html_css_fetcher_poll,
.finalise = html_css_fetcher_finalise
};
diff --git a/content/handlers/javascript/fetcher.c b/content/handlers/javascript/fetcher.c
index 839df26..80a53d8 100644
--- a/content/handlers/javascript/fetcher.c
+++ b/content/handlers/javascript/fetcher.c
@@ -208,7 +208,7 @@ nserror fetch_javascript_register(void)
.setup = fetch_javascript_setup,
.start = fetch_javascript_start,
.abort = fetch_javascript_abort,
- .free = fetch_javascript_free,
+ .ffree = fetch_javascript_free,
.poll = fetch_javascript_poll,
.finalise = fetch_javascript_finalise
};
diff --git a/utils/http/generics.c b/utils/http/generics.c
index e0798f9..054446e 100644
--- a/utils/http/generics.c
+++ b/utils/http/generics.c
@@ -33,7 +33,7 @@ void http___item_list_destroy(http__item *list)
list = victim->next;
- victim->free(victim);
+ victim->ffree(victim);
}
}
diff --git a/utils/http/generics.h b/utils/http/generics.h
index a5af734..878627e 100644
--- a/utils/http/generics.h
+++ b/utils/http/generics.h
@@ -29,12 +29,12 @@
typedef struct http__item {
struct http__item *next; /**< Next item in list, or NULL */
- void (*free)(struct http__item *self); /**< Item destructor */
+ void (*ffree)(struct http__item *self); /**< Item destructor */
} http__item;
#define HTTP__ITEM_INIT(item, n, f) \
((http__item *) (item))->next = (http__item *) (n); \
- ((http__item *) (item))->free = (void (*)(http__item *)) (f)
+ ((http__item *) (item))->ffree = (void (*)(http__item *)) (f)
/**
* Type of an item parser
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4134d4cbd67ab734ab1...
commit 4134d4cbd67ab734ab1703489cca47d39a7e9864
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Updates to allow clib2 memory debug mode to work
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index 6b68072..ca94d88 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -7,7 +7,7 @@ CFLAGS += -std=c99 -Dnsamiga
ifneq ($(SUBTARGET),os3)
CFLAGS += -O2 -mstrict-align -finline-functions -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__
else
- CFLAGS += -O2 -DPATH_MAX=1024 -D__m68k__ -m68020
+ CFLAGS += -O2 -DPATH_MAX=1024 -D__m68k__ -m68020 -D__MEM_DEBUG
endif
$(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
@@ -21,14 +21,14 @@ LDFLAGS += $(shell $(PKG_CONFIG) --static --libs libcurl)
LDFLAGS += $(shell $(PKG_CONFIG) --libs tre)
LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib
-LDFLAGS += -lpbl -liconv -ldebug
+LDFLAGS += -lpbl -liconv
ifeq ($(NETSURF_USE_OPENSSL),YES)
LDFLAGS += $(shell $(PKG_CONFIG) --static --libs openssl)
endif
ifeq ($(SUBTARGET),os3)
- LDFLAGS += -lamiga -lm
+ LDFLAGS += -lamiga -lm -ldebug
endif
COMMON_WARNFLAGS += -Wno-cast-align
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
index be74838..2e53c68 100755
--- a/frontends/amiga/memory.c
+++ b/frontends/amiga/memory.c
@@ -167,7 +167,7 @@ struct Interrupt *ami_memory_init(void)
struct Interrupt *memhandler = malloc(sizeof(struct Interrupt));
if(memhandler == NULL) return NULL; // we're screwed
- kprintf("init");
+ kprintf("netsurf init");
memhandler->is_Node.ln_Pri = -127; // low down as will be slow
memhandler->is_Node.ln_Name = "NetSurf low memory handler";
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=1a235de6628693b18e1...
commit 1a235de6628693b18e1b2e9a5ed1d4154d2fe749
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Enable clib2 debug to work
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index 77d2b45..6b68072 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -21,7 +21,7 @@ LDFLAGS += $(shell $(PKG_CONFIG) --static --libs libcurl)
LDFLAGS += $(shell $(PKG_CONFIG) --libs tre)
LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib
-LDFLAGS += -lpbl -liconv
+LDFLAGS += -lpbl -liconv -ldebug
ifeq ($(NETSURF_USE_OPENSSL),YES)
LDFLAGS += $(shell $(PKG_CONFIG) --static --libs openssl)
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
index 35ca969..be74838 100755
--- a/frontends/amiga/memory.c
+++ b/frontends/amiga/memory.c
@@ -167,6 +167,8 @@ struct Interrupt *ami_memory_init(void)
struct Interrupt *memhandler = malloc(sizeof(struct Interrupt));
if(memhandler == NULL) return NULL; // we're screwed
+ kprintf("init");
+
memhandler->is_Node.ln_Pri = -127; // low down as will be slow
memhandler->is_Node.ln_Name = "NetSurf low memory handler";
memhandler->is_Data = NULL;
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/bitmap.c | 1 +
frontends/amiga/memory.h | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 6ad1610..e160f93 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -546,6 +546,7 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
DirectDrawTrueColor(ddh, (ULONG *)amiga_bitmap_get_buffer(bitmap), 0, 0, TAG_DONE);
DeleteDirectDrawHandle(ddh);
ReleaseDrawHandle(bitmap->drawhandle);
+ bitmap->drawhandle = NULL;
}
ami_bitmap_argb_to_rgba(bitmap);
} else {
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index 93201a2..a9a882e 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -51,10 +51,10 @@ void *ami_memory_clear_alloc(size_t size, UBYTE value);
#define ami_memory_itempool_alloc(p,s) ItemPoolAlloc(p)
#define ami_memory_itempool_free(p,i,s) ItemPoolFree(p,i)
#else
-#define ami_memory_itempool_create(s) (NULL)
+#define ami_memory_itempool_create(s) ((APTR)1)
#define ami_memory_itempool_delete(p) ((void)0)
#define ami_memory_itempool_alloc(p,s) malloc(s)
-#define ami_memory_itempool_free(p,i,s) free(p)
+#define ami_memory_itempool_free(p,i,s) free(i)
#endif
/* clib2 slab allocator */
--
NetSurf Browser
3 years, 7 months
netsurf: branch master updated. release/3.8-264-g7314651
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/7314651b9506d9810ce15...
...commit http://git.netsurf-browser.org/netsurf.git/commit/7314651b9506d9810ce15c4...
...tree http://git.netsurf-browser.org/netsurf.git/tree/7314651b9506d9810ce15c458...
The branch, master has been updated
via 7314651b9506d9810ce15c45811894e4e6a89107 (commit)
from e82107a29611f9d77a8699bac625df4524563137 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7314651b9506d9810ce...
commit 7314651b9506d9810ce15c45811894e4e6a89107
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
NULL drawhandle after free
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 6ad1610..e160f93 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -546,6 +546,7 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
DirectDrawTrueColor(ddh, (ULONG *)amiga_bitmap_get_buffer(bitmap), 0, 0, TAG_DONE);
DeleteDirectDrawHandle(ddh);
ReleaseDrawHandle(bitmap->drawhandle);
+ bitmap->drawhandle = NULL;
}
ami_bitmap_argb_to_rgba(bitmap);
} else {
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/bitmap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 6ad1610..e160f93 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -546,6 +546,7 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
DirectDrawTrueColor(ddh, (ULONG *)amiga_bitmap_get_buffer(bitmap), 0, 0, TAG_DONE);
DeleteDirectDrawHandle(ddh);
ReleaseDrawHandle(bitmap->drawhandle);
+ bitmap->drawhandle = NULL;
}
ami_bitmap_argb_to_rgba(bitmap);
} else {
--
NetSurf Browser
3 years, 7 months