|
0 |
Patch by corvid to address #642391. Source:
|
|
1 |
http://lists.auriga.wearlab.de/pipermail/dillo-dev/2011-September/008993.html
|
|
2 |
|
|
3 |
Index: dillo/src/cache.c
|
|
4 |
===================================================================
|
|
5 |
--- dillo.orig/src/cache.c 2011-09-23 01:25:50.000000000 +0200
|
|
6 |
+++ dillo/src/cache.c 2011-09-23 01:44:20.000000000 +0200
|
|
7 |
@@ -678,24 +678,31 @@
|
|
8 |
if (header[9] == '3' && header[10] == '0') {
|
|
9 |
/* 30x: URL redirection */
|
|
10 |
if ((location_str = Cache_parse_field(header, "Location"))) {
|
|
11 |
- DilloUrl *location_url;
|
|
12 |
-
|
|
13 |
- entry->Flags |= CA_Redirect;
|
|
14 |
- if (header[11] == '1')
|
|
15 |
- entry->Flags |= CA_ForceRedirect; /* 301 Moved Permanently */
|
|
16 |
- else if (header[11] == '2')
|
|
17 |
- entry->Flags |= CA_TempRedirect; /* 302 Temporary Redirect */
|
|
18 |
-
|
|
19 |
- location_url = a_Url_new(location_str, URL_STR_(entry->Url));
|
|
20 |
- if (URL_FLAGS(location_url) & (URL_Post + URL_Get) &&
|
|
21 |
- dStrcasecmp(URL_SCHEME(location_url), "dpi") == 0 &&
|
|
22 |
- dStrcasecmp(URL_SCHEME(entry->Url), "dpi") != 0) {
|
|
23 |
- /* Forbid dpi GET and POST from non dpi-generated urls */
|
|
24 |
- MSG("Redirection Denied! '%s' -> '%s'\n",
|
|
25 |
- URL_STR(entry->Url), URL_STR(location_url));
|
|
26 |
+ DilloUrl *location_url = a_Url_new(location_str,
|
|
27 |
+ URL_STR_(entry->Url));
|
|
28 |
+ if (prefs.filter_auto_requests == PREFS_FILTER_SAME_DOMAIN &&
|
|
29 |
+ !a_Url_same_organization(entry->Url, location_url)) {
|
|
30 |
+ /* don't redirect; just show body like usual (if any) */
|
|
31 |
+ MSG("Redirection not followed from %s to %s\n",
|
|
32 |
+ URL_HOST(entry->Url), URL_HOST(location_url));
|
|
33 |
a_Url_free(location_url);
|
|
34 |
} else {
|
|
35 |
- entry->Location = location_url;
|
|
36 |
+ entry->Flags |= CA_Redirect;
|
|
37 |
+ if (header[11] == '1')
|
|
38 |
+ entry->Flags |= CA_ForceRedirect; /* 301 Moved Permanently */
|
|
39 |
+ else if (header[11] == '2')
|
|
40 |
+ entry->Flags |= CA_TempRedirect; /* 302 Temporary Redirect*/
|
|
41 |
+
|
|
42 |
+ if (URL_FLAGS(location_url) & (URL_Post + URL_Get) &&
|
|
43 |
+ dStrcasecmp(URL_SCHEME(location_url), "dpi") == 0 &&
|
|
44 |
+ dStrcasecmp(URL_SCHEME(entry->Url), "dpi") != 0) {
|
|
45 |
+ /* Forbid dpi GET and POST from non dpi-generated urls */
|
|
46 |
+ MSG("Redirection Denied! '%s' -> '%s'\n",
|
|
47 |
+ URL_STR(entry->Url), URL_STR(location_url));
|
|
48 |
+ a_Url_free(location_url);
|
|
49 |
+ } else {
|
|
50 |
+ entry->Location = location_url;
|
|
51 |
+ }
|
|
52 |
}
|
|
53 |
dFree(location_str);
|
|
54 |
}
|