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);
stop = true;
}
// catch oom?
}
try

View File

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

View File

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