aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2011-09-24 01:08:46 +0000
committercorvid <corvid@lavabit.com>2011-09-24 01:08:46 +0000
commitfe7b91106c2e682b9a78a7e804542cf08bbd0989 (patch)
tree1f618c7bb90d0da6380616357025a2266efc7643 /src
parentad6f58aa1969452407d7bbd579d8e94853c4b6c4 (diff)
if not following a redirection, show body of redirecting page
as suggested by Axel Beckert in http://lists.auriga.wearlab.de/pipermail/dillo-dev/2011-September/008992.html
Diffstat (limited to 'src')
-rw-r--r--src/cache.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/cache.c b/src/cache.c
index 6094a8d5..15869ac6 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -675,18 +675,24 @@ static void Cache_parse_header(CacheEntry_t *entry)
entry->Header = dStr_new("");
return;
}
- if (header[9] == '3' && header[10] == '0') {
+ if (header[9] == '3' && header[10] == '0' &&
+ (location_str = Cache_parse_field(header, "Location"))) {
/* 30x: URL redirection */
- if ((location_str = Cache_parse_field(header, "Location"))) {
- DilloUrl *location_url;
-
+ DilloUrl *location_url = a_Url_new(location_str,URL_STR_(entry->Url));
+
+ if (prefs.filter_auto_requests == PREFS_FILTER_SAME_DOMAIN &&
+ !a_Url_same_organization(entry->Url, location_url)) {
+ /* don't redirect; just show body like usual (if any) */
+ MSG("Redirection not followed from %s to %s\n",
+ URL_HOST(entry->Url), URL_STR(location_url));
+ a_Url_free(location_url);
+ } else {
entry->Flags |= CA_Redirect;
if (header[11] == '1')
entry->Flags |= CA_ForceRedirect; /* 301 Moved Permanently */
else if (header[11] == '2')
entry->Flags |= CA_TempRedirect; /* 302 Temporary Redirect */
- location_url = a_Url_new(location_str, URL_STR_(entry->Url));
if (URL_FLAGS(location_url) & (URL_Post + URL_Get) &&
dStrcasecmp(URL_SCHEME(location_url), "dpi") == 0 &&
dStrcasecmp(URL_SCHEME(entry->Url), "dpi") != 0) {
@@ -697,8 +703,8 @@ static void Cache_parse_header(CacheEntry_t *entry)
} else {
entry->Location = location_url;
}
- dFree(location_str);
}
+ dFree(location_str);
} else if (strncmp(header + 9, "401", 3) == 0) {
entry->Auth =
Cache_parse_multiple_fields(header, "WWW-Authenticate");