summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-01-28 01:35:00 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-01-28 01:35:00 +0000
commit78d194cb77db00a530779aa2a1e8d2ef9707d229 (patch)
treeba4d25c396623825fcc020bf26cd757ca34f37ec /render
parent32fe1bd1bfcaa2c96cd407c3d1e20f2d4000bd0b (diff)
downloadnetsurf-78d194cb77db00a530779aa2a1e8d2ef9707d229.tar.gz
netsurf-78d194cb77db00a530779aa2a1e8d2ef9707d229.tar.bz2
Rework handling of HTTP redirects -- we now count the number of redirects followed for a given item and abort if a fixed limit is reached. This fixes sites which have pages that redirect to themselves.
Redirect handling is now transparent to clients of fetchcache. The new scheme works as follows: 1) Request content for URL (fetchcache() 2) Start fetch of content (fetchcache_go() 3) If no redirect, continue through LOADING, READY, DONE etc. states as before If redirect, receive NEWPTR for each redirect that occurs, then continue through LOADING, READY, DONE etc. states as before. The upshot of this is that redirects result in extra contents being created. It also means that, until LOADING has been received, the content (and thus the URL being fetched) may change. Therefore, fetchcache clients should expect to have to deal with transient data prior to LOADING occurring. As a necessary side-effect of this, the HTML object URLs and CSS @import URLs are no longer stored alongside the relevant contents. These URLs can be accessed by interrogating the url member of struct content anyway, so it was a rather redundant scheme before. svn path=/trunk/netsurf/; revision=3787
Diffstat (limited to 'render')
-rw-r--r--render/html.c62
-rw-r--r--render/html.h1
2 files changed, 0 insertions, 63 deletions
diff --git a/render/html.c b/render/html.c
index 1068319e3..5a9ba27ef 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1085,24 +1085,6 @@ void html_convert_css_callback(content_msg msg, struct content *css,
content_broadcast(c, CONTENT_MSG_STATUS, data);
break;
- case CONTENT_MSG_REDIRECT:
- c->active--;
- c->data.html.stylesheet_content[i] = fetchcache(
- data.redirect,
- html_convert_css_callback,
- (intptr_t) c, i, css->width, css->height,
- true, 0, 0, false, false);
- if (c->data.html.stylesheet_content[i]) {
- c->active++;
- fetchcache_go(c->data.html.stylesheet_content[i],
- c->url,
- html_convert_css_callback,
- (intptr_t) c, i, css->width,
- css->height, 0, 0, false,
- c->url);
- }
- break;
-
case CONTENT_MSG_NEWPTR:
c->data.html.stylesheet_content[i] = css;
break;
@@ -1169,12 +1151,6 @@ bool html_fetch_object(struct content *c, char *url, struct box *box,
return false;
}
c->data.html.object = object;
- c->data.html.object[i].url = talloc_strdup(c, url);
- if (!c->data.html.object[i].url) {
- content_remove_user(c_fetch, html_object_callback,
- (intptr_t) c, i);
- return false;
- }
c->data.html.object[i].box = box;
c->data.html.object[i].permitted_types = permitted_types;
c->data.html.object[i].background = background;
@@ -1221,8 +1197,6 @@ bool html_replace_object(struct content *c, unsigned int i, char *url,
html_object_callback, (intptr_t) c, i);
c->data.html.object[i].content = 0;
c->data.html.object[i].box->object = 0;
- talloc_free(c->data.html.object[i].url);
- c->data.html.object[i].url = 0;
}
/* initialise fetch */
@@ -1234,12 +1208,6 @@ bool html_replace_object(struct content *c, unsigned int i, char *url,
if (!c_fetch)
return false;
- c->data.html.object[i].url = talloc_strdup(c, url);
- if (!c->data.html.object[i].url) {
- content_remove_user(c_fetch, html_object_callback,
- (intptr_t) c, i);
- return false;
- }
c->data.html.object[i].content = c_fetch;
for (page = c; page; page = page->data.html.page) {
@@ -1349,35 +1317,6 @@ void html_object_callback(content_msg msg, struct content *object,
/* content_broadcast(c, CONTENT_MSG_STATUS, 0); */
break;
- case CONTENT_MSG_REDIRECT:
- c->active--;
- talloc_free(c->data.html.object[i].url);
- c->data.html.object[i].url = talloc_strdup(c,
- data.redirect);
- if (!c->data.html.object[i].url) {
- /** \todo report oom */
- } else {
- c->data.html.object[i].content = fetchcache(
- data.redirect,
- html_object_callback,
- (intptr_t) c, i, 0, 0, true,
- 0, 0, false, false);
- if (!c->data.html.object[i].content) {
- /** \todo report oom */
- } else {
- c->active++;
- fetchcache_go(c->data.html.object[i].
- content,
- c->url,
- html_object_callback,
- (intptr_t) c, i,
- 0, 0,
- 0, 0,
- false, c->url);
- }
- }
- break;
-
case CONTENT_MSG_REFORMAT:
break;
@@ -1439,7 +1378,6 @@ void html_object_callback(content_msg msg, struct content *object,
(msg == CONTENT_MSG_LOADING ||
msg == CONTENT_MSG_DONE ||
msg == CONTENT_MSG_ERROR ||
- msg == CONTENT_MSG_REDIRECT ||
msg == CONTENT_MSG_AUTH)) {
/* all objects have arrived */
content_reformat(c, c->available_width, c->height);
diff --git a/render/html.h b/render/html.h
index d21dc12d9..af6a886bf 100644
--- a/render/html.h
+++ b/render/html.h
@@ -66,7 +66,6 @@ typedef enum {
/** An object (<img>, <object>, etc.) in a CONTENT_HTML document. */
struct content_html_object {
- char *url; /**< URL of this object. */
struct content *content; /**< Content, or 0. */
struct box *box; /**< Node in box tree containing it. */
/** Pointer to array of permitted content_type, terminated by