Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/885897f610b9b3650d061b17ef58d6493287488b
...commit
http://git.netsurf-browser.org/netsurf.git/commit/885897f610b9b3650d061b17ef58d6493287488b
...tree
http://git.netsurf-browser.org/netsurf.git/tree/885897f610b9b3650d061b17ef58d6493287488b
The branch, master has been updated
via 885897f610b9b3650d061b17ef58d6493287488b (commit)
via 52805a78604f595d523f01bb5c1fa7abd5968c17 (commit)
via b15cbb72ac882cf820dd0db80238594a44f0ed00 (commit)
via c92b31babea9f34a1987f99ce20a4c7b067f9b68 (commit)
from e95c11dac89e39634aa9fa82a13ac780740122ee (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=885897f610b9b3650d061b17ef58d6493287488b
commit 885897f610b9b3650d061b17ef58d6493287488b
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
llcache: Uncachable scheme checks don't need to be caseless.
diff --git a/content/llcache.c b/content/llcache.c
index 1e87480..54848cf 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -1798,16 +1798,18 @@ llcache_object_retrieve(nsurl *url,
scheme = nsurl_get_component(defragmented_url, NSURL_SCHEME);
- if (lwc_string_caseless_isequal(scheme, corestring_lwc_http,
+ /* nsurl ensures lower case schemes, and corestrings are lower
+ * case, so it's safe to use case-sensitive comparison. */
+ if (lwc_string_isequal(scheme, corestring_lwc_http,
&match) == lwc_error_ok &&
(match == false) &&
- lwc_string_caseless_isequal(scheme, corestring_lwc_https,
+ lwc_string_isequal(scheme, corestring_lwc_https,
&match) == lwc_error_ok &&
(match == false) &&
- lwc_string_caseless_isequal(scheme, corestring_lwc_resource,
+ lwc_string_isequal(scheme, corestring_lwc_resource,
&match) == lwc_error_ok &&
(match == false) &&
- lwc_string_caseless_isequal(scheme, corestring_lwc_file,
+ lwc_string_isequal(scheme, corestring_lwc_file,
&match) == lwc_error_ok &&
(match == false)) {
uncachable = true;
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=52805a78604f595d523f01bb5c1fa7abd5968c17
commit 52805a78604f595d523f01bb5c1fa7abd5968c17
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
llcache: Allow file and resource schemes to be cached.
This means things like the default css file and adblock css file
are only loaded and parsed once.
diff --git a/content/llcache.c b/content/llcache.c
index cd40662..1e87480 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -1792,7 +1792,7 @@ llcache_object_retrieve(nsurl *url,
/* POST requests are never cached */
uncachable = true;
} else {
- /* only http and https schemes are cached */
+ /* only http(s), resource, and file schemes are cached */
lwc_string *scheme;
bool match;
@@ -1800,13 +1800,17 @@ llcache_object_retrieve(nsurl *url,
if (lwc_string_caseless_isequal(scheme, corestring_lwc_http,
&match) == lwc_error_ok &&
+ (match == false) &&
+ lwc_string_caseless_isequal(scheme, corestring_lwc_https,
+ &match) == lwc_error_ok &&
+ (match == false) &&
+ lwc_string_caseless_isequal(scheme, corestring_lwc_resource,
+ &match) == lwc_error_ok &&
+ (match == false) &&
+ lwc_string_caseless_isequal(scheme, corestring_lwc_file,
+ &match) == lwc_error_ok &&
(match == false)) {
- if (lwc_string_caseless_isequal(scheme,
- corestring_lwc_https, &match) ==
- lwc_error_ok &&
- (match == false)) {
- uncachable = true;
- }
+ uncachable = true;
}
lwc_string_unref(scheme);
}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=b15cbb72ac882cf820dd0db80238594a44f0ed00
commit b15cbb72ac882cf820dd0db80238594a44f0ed00
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
File fetcher: Avoid atoi for If-None-Match value parse.
The file fetcher emits FETCH_NOTMODIFIED if the file is unchanged.
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index 4fa1a21..5c9d158 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -50,6 +50,8 @@
#include "utils/corestrings.h"
#include "utils/messages.h"
#include "utils/utils.h"
+#include "utils/log.h"
+#include "utils/time.h"
#include "utils/ring.h"
#include "utils/file.h"
#include "netsurf/fetch.h"
@@ -156,18 +158,25 @@ fetch_file_setup(struct fetch *fetchh,
/* Scan request headers looking for If-None-Match */
for (i = 0; headers[i] != NULL; i++) {
- if (strncasecmp(headers[i], "If-None-Match:",
- SLEN("If-None-Match:")) == 0) {
- /* If-None-Match: "12345678" */
- const char *d = headers[i] + SLEN("If-None-Match:");
-
- /* Scan to first digit, if any */
- while (*d != '\0' && (*d < '0' || '9' < *d))
- d++;
-
- /* Convert to time_t */
- if (*d != '\0')
- ctx->file_etag = atoi(d);
+ if (strncasecmp(headers[i], "If-None-Match:",
+ SLEN("If-None-Match:")) != 0) {
+ continue;
+ }
+
+ /* If-None-Match: "12345678" */
+ const char *d = headers[i] + SLEN("If-None-Match:");
+
+ /* Scan to first digit, if any */
+ while (*d != '\0' && (*d < '0' || '9' < *d))
+ d++;
+
+ /* Convert to time_t */
+ if (*d != '\0') {
+ ret = nsc_snptimet(d, strlen(d), &ctx->file_etag);
+ if (ret != NSERROR_OK) {
+ NSLOG(fetch, WARNING,
+ "Bad If-None-Match value");
+ }
}
}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=c92b31babea9f34a1987f99ce20a4c7b067f9b68
commit c92b31babea9f34a1987f99ce20a4c7b067f9b68
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Resource fetcher: Fix ETag handling.
* Changed ETag storage to be time_t, rather than int.
* Changed `If-None-Match` value parsing to use proper
time_t parsing, rather than `atoi`.
We emit FETCH_NOTMODIFIED if the resource hasn't changed.
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index 7875773..94a5140 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -33,6 +33,7 @@
#include "utils/nsurl.h"
#include "utils/corestrings.h"
#include "utils/log.h"
+#include "utils/time.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/ring.h"
@@ -97,7 +98,7 @@ struct fetch_resource_context {
fetch_resource_handler handler;
- int etag;
+ time_t etag;
};
static struct fetch_resource_context *ring = NULL;
@@ -328,6 +329,7 @@ fetch_resource_setup(struct fetch *fetchh,
{
struct fetch_resource_context *ctx;
lwc_string *path;
+ nserror ret;
uint32_t i;
ctx = calloc(1, sizeof(*ctx));
@@ -364,17 +366,24 @@ fetch_resource_setup(struct fetch *fetchh,
/* Scan request headers looking for If-None-Match */
for (i = 0; headers[i] != NULL; i++) {
if (strncasecmp(headers[i], "If-None-Match:",
- SLEN("If-None-Match:")) == 0) {
- /* If-None-Match: "12345678" */
- const char *d = headers[i] + SLEN("If-None-Match:");
+ SLEN("If-None-Match:")) != 0) {
+ continue;
+ }
- /* Scan to first digit, if any */
- while (*d != '\0' && (*d < '0' || '9' < *d))
- d++;
+ /* If-None-Match: "12345678" */
+ const char *d = headers[i] + SLEN("If-None-Match:");
- /* Convert to time_t */
- if (*d != '\0')
- ctx->etag = atoi(d);
+ /* Scan to first digit, if any */
+ while (*d != '\0' && (*d < '0' || '9' < *d))
+ d++;
+
+ /* Convert to time_t */
+ if (*d != '\0') {
+ ret = nsc_snptimet(d, strlen(d), &ctx->etag);
+ if (ret != NSERROR_OK) {
+ NSLOG(fetch, WARNING,
+ "Bad If-None-Match value");
+ }
}
}
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/file.c | 33 +++++++++++++++++++++------------
content/fetchers/resource.c | 29 +++++++++++++++++++----------
content/llcache.c | 22 ++++++++++++++--------
3 files changed, 54 insertions(+), 30 deletions(-)
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index 4fa1a21..5c9d158 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -50,6 +50,8 @@
#include "utils/corestrings.h"
#include "utils/messages.h"
#include "utils/utils.h"
+#include "utils/log.h"
+#include "utils/time.h"
#include "utils/ring.h"
#include "utils/file.h"
#include "netsurf/fetch.h"
@@ -156,18 +158,25 @@ fetch_file_setup(struct fetch *fetchh,
/* Scan request headers looking for If-None-Match */
for (i = 0; headers[i] != NULL; i++) {
- if (strncasecmp(headers[i], "If-None-Match:",
- SLEN("If-None-Match:")) == 0) {
- /* If-None-Match: "12345678" */
- const char *d = headers[i] + SLEN("If-None-Match:");
-
- /* Scan to first digit, if any */
- while (*d != '\0' && (*d < '0' || '9' < *d))
- d++;
-
- /* Convert to time_t */
- if (*d != '\0')
- ctx->file_etag = atoi(d);
+ if (strncasecmp(headers[i], "If-None-Match:",
+ SLEN("If-None-Match:")) != 0) {
+ continue;
+ }
+
+ /* If-None-Match: "12345678" */
+ const char *d = headers[i] + SLEN("If-None-Match:");
+
+ /* Scan to first digit, if any */
+ while (*d != '\0' && (*d < '0' || '9' < *d))
+ d++;
+
+ /* Convert to time_t */
+ if (*d != '\0') {
+ ret = nsc_snptimet(d, strlen(d), &ctx->file_etag);
+ if (ret != NSERROR_OK) {
+ NSLOG(fetch, WARNING,
+ "Bad If-None-Match value");
+ }
}
}
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index 7875773..94a5140 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -33,6 +33,7 @@
#include "utils/nsurl.h"
#include "utils/corestrings.h"
#include "utils/log.h"
+#include "utils/time.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/ring.h"
@@ -97,7 +98,7 @@ struct fetch_resource_context {
fetch_resource_handler handler;
- int etag;
+ time_t etag;
};
static struct fetch_resource_context *ring = NULL;
@@ -328,6 +329,7 @@ fetch_resource_setup(struct fetch *fetchh,
{
struct fetch_resource_context *ctx;
lwc_string *path;
+ nserror ret;
uint32_t i;
ctx = calloc(1, sizeof(*ctx));
@@ -364,17 +366,24 @@ fetch_resource_setup(struct fetch *fetchh,
/* Scan request headers looking for If-None-Match */
for (i = 0; headers[i] != NULL; i++) {
if (strncasecmp(headers[i], "If-None-Match:",
- SLEN("If-None-Match:")) == 0) {
- /* If-None-Match: "12345678" */
- const char *d = headers[i] + SLEN("If-None-Match:");
+ SLEN("If-None-Match:")) != 0) {
+ continue;
+ }
- /* Scan to first digit, if any */
- while (*d != '\0' && (*d < '0' || '9' < *d))
- d++;
+ /* If-None-Match: "12345678" */
+ const char *d = headers[i] + SLEN("If-None-Match:");
- /* Convert to time_t */
- if (*d != '\0')
- ctx->etag = atoi(d);
+ /* Scan to first digit, if any */
+ while (*d != '\0' && (*d < '0' || '9' < *d))
+ d++;
+
+ /* Convert to time_t */
+ if (*d != '\0') {
+ ret = nsc_snptimet(d, strlen(d), &ctx->etag);
+ if (ret != NSERROR_OK) {
+ NSLOG(fetch, WARNING,
+ "Bad If-None-Match value");
+ }
}
}
diff --git a/content/llcache.c b/content/llcache.c
index cd40662..54848cf 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -1792,21 +1792,27 @@ llcache_object_retrieve(nsurl *url,
/* POST requests are never cached */
uncachable = true;
} else {
- /* only http and https schemes are cached */
+ /* only http(s), resource, and file schemes are cached */
lwc_string *scheme;
bool match;
scheme = nsurl_get_component(defragmented_url, NSURL_SCHEME);
- if (lwc_string_caseless_isequal(scheme, corestring_lwc_http,
+ /* nsurl ensures lower case schemes, and corestrings are lower
+ * case, so it's safe to use case-sensitive comparison. */
+ if (lwc_string_isequal(scheme, corestring_lwc_http,
+ &match) == lwc_error_ok &&
+ (match == false) &&
+ lwc_string_isequal(scheme, corestring_lwc_https,
+ &match) == lwc_error_ok &&
+ (match == false) &&
+ lwc_string_isequal(scheme, corestring_lwc_resource,
+ &match) == lwc_error_ok &&
+ (match == false) &&
+ lwc_string_isequal(scheme, corestring_lwc_file,
&match) == lwc_error_ok &&
(match == false)) {
- if (lwc_string_caseless_isequal(scheme,
- corestring_lwc_https, &match) ==
- lwc_error_ok &&
- (match == false)) {
- uncachable = true;
- }
+ uncachable = true;
}
lwc_string_unref(scheme);
}
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org