HTTP proxy: Fix addressbook name on redirect page

This commit is contained in:
zzz
2013-11-03 15:04:37 +00:00
parent 8296f8229e
commit 85c998e500

View File

@@ -183,6 +183,15 @@ public abstract class LocalHTTPServer {
/** @since 0.8.7 */ /** @since 0.8.7 */
private static void writeRedirectPage(OutputStream out, boolean success, String host, String book, String url) throws IOException { private static void writeRedirectPage(OutputStream out, boolean success, String host, String book, String url) throws IOException {
String tbook;
if ("hosts.txt".equals(book))
tbook = _("router");
else if ("userhosts.txt".equals(book))
tbook = _("master");
else if ("privatehosts.txt".equals(book))
tbook = _("private");
else
tbook = book;
out.write(("HTTP/1.1 200 OK\r\n"+ out.write(("HTTP/1.1 200 OK\r\n"+
"Content-Type: text/html; charset=UTF-8\r\n"+ "Content-Type: text/html; charset=UTF-8\r\n"+
"\r\n"+ "\r\n"+
@@ -199,8 +208,8 @@ public abstract class LocalHTTPServer {
"<div class=warning id=warning>\n" + "<div class=warning id=warning>\n" +
"<h3>" + "<h3>" +
(success ? (success ?
_("Saved {0} to the {1} addressbook, redirecting now.", host, book) : _("Saved {0} to the {1} addressbook, redirecting now.", host, tbook) :
_("Failed to save {0} to the {1} addressbook, redirecting now.", host, book)) + _("Failed to save {0} to the {1} addressbook, redirecting now.", host, tbook)) +
"</h3>\n<p><a href=\"" + url + "\">" + "</h3>\n<p><a href=\"" + url + "\">" +
_("Click here if you are not redirected automatically.") + _("Click here if you are not redirected automatically.") +
"</a></p></div>").getBytes("UTF-8")); "</a></p></div>").getBytes("UTF-8"));