Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/aa9d887887274224af73e...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/aa9d887887274224af73e0c...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/aa9d887887274224af73e0cf3...
The branch, vince/disccache has been updated
via aa9d887887274224af73e0cf3e5173c553d28d88 (commit)
from 0e952d5e6ebaefc9e9889d753895683396aeaa5f (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=aa9d887887274224af7...
commit aa9d887887274224af73e0cf3e5173c553d28d88
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
add url check to metadata
diff --git a/content/llcache.c b/content/llcache.c
index 62faae6..b27bcf6 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -200,7 +200,6 @@ struct llcache_s {
/** low level cache state */
static struct llcache_s *llcache = NULL;
-
/* forward referenced callback function */
static void llcache_fetch_callback(const fetch_msg *msg, void *p);
@@ -1068,18 +1067,53 @@ llcache_persist_retrieve(llcache_object *object)
&object->source_len);
}
+uint8_t *crlf_line(uint8_t *data, uint8_t *end)
+{
+ uint8_t *nln = data;
+ while ((nln < end) && ((nln[0] != 13) || (nln[1] != 10) ))
+ nln++;
+ nln[0] = 0;
+ nln += 2;
+ return nln;
+}
+
static nserror
llcache_process_metadata(llcache_object *object, uint8_t *data, size_t datasize)
{
+ nserror res;
uint8_t *metadata = NULL;
size_t metadatalen = 0;
+ nsurl *metadataurl;
+ uint8_t *end;
+ uint8_t *ln;
+ uint8_t *nln;
/* attempt to retrieve object metadata from the cache */
error = guit->llcache->meta(object->url, &metadata, &metadatalen);
if (error != NSERROR_OK)
return error;
+ end = matadata + metadatalen;
+ ln = metadata;
+ nln = crlf_line(ln, end);
+
+ res = metadataurl(ln, &metadataurl);
+ if (res != NSERROR_OK) {
+ free(metadata);
+ return res;
+ }
+
+ if (nsurl_compare(object->url, metadataurl, NSURL_COMPLETE) != true) {
+ /* backing store returned the wrong object for the
+ * request. This may occour if the backing store had
+ * a collision in its stoage method. We cope with this
+ * buy simply skipping caching of this object.
+ */
+ free(metadata);
+
+ return NSERROR_NOT_FOUND;
+ }
free(metadata);
-----------------------------------------------------------------------
Summary of changes:
content/llcache.c | 36 +++++++++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/content/llcache.c b/content/llcache.c
index 62faae6..b27bcf6 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -200,7 +200,6 @@ struct llcache_s {
/** low level cache state */
static struct llcache_s *llcache = NULL;
-
/* forward referenced callback function */
static void llcache_fetch_callback(const fetch_msg *msg, void *p);
@@ -1068,18 +1067,53 @@ llcache_persist_retrieve(llcache_object *object)
&object->source_len);
}
+uint8_t *crlf_line(uint8_t *data, uint8_t *end)
+{
+ uint8_t *nln = data;
+ while ((nln < end) && ((nln[0] != 13) || (nln[1] != 10) ))
+ nln++;
+ nln[0] = 0;
+ nln += 2;
+ return nln;
+}
+
static nserror
llcache_process_metadata(llcache_object *object, uint8_t *data, size_t datasize)
{
+ nserror res;
uint8_t *metadata = NULL;
size_t metadatalen = 0;
+ nsurl *metadataurl;
+ uint8_t *end;
+ uint8_t *ln;
+ uint8_t *nln;
/* attempt to retrieve object metadata from the cache */
error = guit->llcache->meta(object->url, &metadata, &metadatalen);
if (error != NSERROR_OK)
return error;
+ end = matadata + metadatalen;
+ ln = metadata;
+ nln = crlf_line(ln, end);
+
+ res = metadataurl(ln, &metadataurl);
+ if (res != NSERROR_OK) {
+ free(metadata);
+ return res;
+ }
+
+ if (nsurl_compare(object->url, metadataurl, NSURL_COMPLETE) != true) {
+ /* backing store returned the wrong object for the
+ * request. This may occour if the backing store had
+ * a collision in its stoage method. We cope with this
+ * buy simply skipping caching of this object.
+ */
+ free(metadata);
+
+ return NSERROR_NOT_FOUND;
+ }
free(metadata);
--
NetSurf Browser