From b5a8fb5fd8c8dc7625a6f9059b9c20edac72f161 Mon Sep 17 00:00:00 2001 From: cominch Date: Fri, 24 Feb 2012 17:02:57 +0100 Subject: [PATCH] Catch malformed URL when submitted in encoded style --- source/de/anomic/http/server/HTTPDFileHandler.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java index 32fb5ca1f..b643fc81f 100644 --- a/source/de/anomic/http/server/HTTPDFileHandler.java +++ b/source/de/anomic/http/server/HTTPDFileHandler.java @@ -76,6 +76,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; +import java.net.URLDecoder; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -1426,7 +1427,13 @@ public final class HTTPDFileHandler { final String strARGS = (String) conProp.get("ARGS"); if(strARGS.startsWith("url=")) { final String strUrl = strARGS.substring(4); // strip url= + + try { proxyurl = new URL(strUrl); + } catch (MalformedURLException e) { + proxyurl = new URL (URLDecoder.decode(strUrl)); + + } } }