summaryrefslogtreecommitdiff
path: root/content/fetchcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'content/fetchcache.c')
-rw-r--r--content/fetchcache.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/content/fetchcache.c b/content/fetchcache.c
index c58d9d34f..a7e68ee97 100644
--- a/content/fetchcache.c
+++ b/content/fetchcache.c
@@ -307,8 +307,20 @@ void fetchcache_callback(fetch_msg msg, void *p, const char *data,
* destroyed in content_clean() */
c->status = CONTENT_STATUS_ERROR;
if (result == URL_FUNC_OK) {
- msg_data.redirect = url;
- content_broadcast(c, CONTENT_MSG_REDIRECT, msg_data);
+ /* check that we're not attempting to
+ * redirect to the same URL */
+ if (strcasecmp(c->url, url) == 0) {
+ msg_data.error =
+ messages_get("BadRedirect");
+ content_broadcast(c,
+ CONTENT_MSG_ERROR, msg_data);
+ }
+ else {
+ msg_data.redirect = url;
+ content_broadcast(c,
+ CONTENT_MSG_REDIRECT,
+ msg_data);
+ }
free(url);
} else {
msg_data.error = messages_get("BadRedirect");