remove http from add torrent box

This commit is contained in:
zzz
2009-03-09 15:10:46 +00:00
parent 91b8f7c2ae
commit f3ddf3fa93
3 changed files with 12 additions and 7 deletions

View File

@ -152,6 +152,7 @@ public class ConnectionAcceptor implements Runnable
_util.debug("Error while accepting: " + ioe, Snark.ERROR); _util.debug("Error while accepting: " + ioe, Snark.ERROR);
stop = true; stop = true;
} }
// catch oom?
} }
try try

View File

@ -232,7 +232,7 @@ public class Snark
} }
// Explicit shutdown. // Explicit shutdown.
Runtime.getRuntime().removeShutdownHook(snarkhook); //Runtime.getRuntime().removeShutdownHook(snarkhook);
snarkhook.start(); snarkhook.start();
} }
} }

View File

@ -202,10 +202,14 @@ public class I2PSnarkServlet extends HttpServlet {
} catch (IOException ioe) { } catch (IOException ioe) {
_log.warn("hrm: " + local, ioe); _log.warn("hrm: " + local, ioe);
} }
} else if ( (newURL != null) && (newURL.trim().length() > "http://.i2p/".length()) ) { } else if (newURL != null) {
_manager.addMessage("Fetching " + newURL); if (newURL.startsWith("http://")) {
I2PAppThread fetch = new I2PAppThread(new FetchAndAdd(_manager, newURL), "Fetch and add"); _manager.addMessage("Fetching " + newURL);
fetch.start(); I2PAppThread fetch = new I2PAppThread(new FetchAndAdd(_manager, newURL), "Fetch and add");
fetch.start();
} else {
_manager.addMessage("Invalid URL - must start with http://");
}
} else { } else {
// no file or URL specified // no file or URL specified
} }
@ -644,7 +648,7 @@ public class I2PSnarkServlet extends HttpServlet {
private void writeAddForm(PrintWriter out, HttpServletRequest req) throws IOException { private void writeAddForm(PrintWriter out, HttpServletRequest req) throws IOException {
String uri = req.getRequestURI(); String uri = req.getRequestURI();
String newURL = req.getParameter("newURL"); String newURL = req.getParameter("newURL");
if ( (newURL == null) || (newURL.trim().length() <= 0) ) newURL = "http://"; if ( (newURL == null) || (newURL.trim().length() <= 0) ) newURL = "";
String newFile = req.getParameter("newFile"); String newFile = req.getParameter("newFile");
if ( (newFile == null) || (newFile.trim().length() <= 0) ) newFile = ""; if ( (newFile == null) || (newFile.trim().length() <= 0) ) newFile = "";
@ -772,7 +776,7 @@ public class I2PSnarkServlet extends HttpServlet {
return bytes + "B"; return bytes + "B";
else if (bytes < 5*1024*1024) else if (bytes < 5*1024*1024)
return ((bytes + 512)/1024) + "KB"; return ((bytes + 512)/1024) + "KB";
else if (bytes < 5*1024*1024*1024l) else if (bytes < 10*1024*1024*1024l)
return ((bytes + 512*1024)/(1024*1024)) + "MB"; return ((bytes + 512*1024)/(1024*1024)) + "MB";
else else
return ((bytes + 512*1024*1024)/(1024*1024*1024)) + "GB"; return ((bytes + 512*1024*1024)/(1024*1024*1024)) + "GB";