Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/c1dc4e61bd87abdfc120888e79c2da6bad8ce26b
...commit
http://git.netsurf-browser.org/netsurf.git/commit/c1dc4e61bd87abdfc120888e79c2da6bad8ce26b
...tree
http://git.netsurf-browser.org/netsurf.git/tree/c1dc4e61bd87abdfc120888e79c2da6bad8ce26b
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=c1dc4e61bd87abdfc120888e79c2da6bad8ce26b
commit c1dc4e61bd87abdfc120888e79c2da6bad8ce26b
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>
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=23698aecf844c105b210fa42b642c1d0203978c9
commit 23698aecf844c105b210fa42b642c1d0203978c9
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>
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
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org