Skip to content

Commit

Permalink
* fix urlproxy for urls containing dolar signs
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7979 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
f1ori committed Sep 29, 2011
1 parent 3ac6fb0 commit e207c41
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions source/de/anomic/http/server/HTTPDFileHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,9 @@ private static void doURLProxy(final serverObjects args, final HashMap<String, O
if(m.group(8) != null) url = m.group(8);
if(m.group(10) != null) url = m.group(10);
if (url.startsWith("data:") || url.startsWith("#") || url.startsWith("mailto:") || url.startsWith("javascript:")) {
m.appendReplacement(result, init + url);
String newurl = init + url;
newurl = newurl.replaceAll("\\$","\\\\\\$");
m.appendReplacement(result, newurl);

} else if (url.startsWith("http")) {
// absoulte url of form href="http://domain.com/path"
Expand All @@ -1422,17 +1424,36 @@ private static void doURLProxy(final serverObjects args, final HashMap<String, O
}
}

m.appendReplacement(result, init + "/proxy.html?url=" + url);
String newurl = init + "/proxy.html?url=" + url;
newurl = newurl.replaceAll("\\$","\\\\\\$");
m.appendReplacement(result, newurl);

} else if (url.startsWith("//")) {
// absoulte url but same protocol of form href="//domain.com/path"
String complete_url = proxyurl.getProtocol() + ":" + url;
if (sb.getConfig("proxyURL.rewriteURLs", "all").equals("domainlist")) {
if (sb.crawlStacker.urlInAcceptedDomain(new DigestURI(complete_url)) != null) {
continue;
}
}

String newurl = init + "/proxy.html?url=" + complete_url;
newurl = newurl.replaceAll("\\$","\\\\\\$");
m.appendReplacement(result, newurl);

} else if (url.startsWith("/")) {
// absolute path of form href="/absolute/path/to/linked/page"
m.appendReplacement(result, init + "/proxy.html?url=http://" + proxyurl.getHost() + url);
String newurl = init + "/proxy.html?url=http://" + host + url;
newurl = newurl.replaceAll("\\$","\\\\\\$");
m.appendReplacement(result, newurl);

} else {
// relative path of form href="relative/path"
try {
target = new MultiProtocolURI(proxyurl.getHost() + directory + "/" + url);
m.appendReplacement(result, init + "/proxy.html?url=" + target.toString());
target = new MultiProtocolURI("http://" + host + directory + "/" + url);
String newurl = init + "/proxy.html?url=" + target.toString();
newurl = newurl.replaceAll("\\$","\\\\\\$");
m.appendReplacement(result, newurl);
}
catch (MalformedURLException e) {}

Expand Down

0 comments on commit e207c41

Please sign in to comment.