* NewsFetcher: add last-modified support, reduce number of retries

* Error pages: add icon and logo,
        clarify 'destination not found' and 'proxy not found' pages
This commit is contained in:
zzz
2008-01-09 04:11:12 +00:00
committed by zzz
parent a96119d09b
commit f35cbf59d8
8 changed files with 64 additions and 50 deletions

View File

@ -24,6 +24,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
private Log _log;
private boolean _updateAvailable;
private long _lastFetch;
private String _lastModified;
private static NewsFetcher _instance;
//public static final synchronized NewsFetcher getInstance() { return _instance; }
public static final synchronized NewsFetcher getInstance(I2PAppContext ctx) {
@ -105,11 +106,12 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
proxyPort = Integer.parseInt(port);
EepGet get = null;
if (shouldProxy)
get = new EepGet(_context, proxyHost, proxyPort, 10, TEMP_NEWS_FILE, newsURL);
get = new EepGet(_context, true, proxyHost, proxyPort, 2, TEMP_NEWS_FILE, newsURL, true, null, _lastModified);
else
get = new EepGet(_context, 10, TEMP_NEWS_FILE, newsURL);
get = new EepGet(_context, false, null, 0, 0, TEMP_NEWS_FILE, newsURL, true, null, _lastModified);
get.addStatusListener(this);
get.fetch();
if (get.fetch())
_lastModified = get.getLastModified();
} catch (Throwable t) {
_log.error("Error fetching the news", t);
}
@ -212,8 +214,8 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
_log.error("Failed to copy the news file!");
}
} else {
if (_log.shouldLog(Log.ERROR))
_log.error("Transfer complete, but no file?");
if (_log.shouldLog(Log.WARN))
_log.warn("Transfer complete, but no file? - probably 304 Not Modified");
}
checkForUpdates();
}

View File

@ -1,4 +1,4 @@
$Id: history.txt,v 1.612 2008-01-07 03:09:44 zzz Exp $
$Id: history.txt,v 1.613 2008-01-08 21:15:45 zzz Exp $
2008-01-08 zzz
* addressbook: Limit size of subscribed hosts.txt,
@ -7,6 +7,11 @@ $Id: history.txt,v 1.612 2008-01-07 03:09:44 zzz Exp $
enforce size limits even when size not in returned header,
don't return old etag or last-modified data,
don't call transferFailed listener more than once
* Sign my update signing key
* NewsFetcher: add last-modified support, reduce number of retries
* Error pages: add icon and logo,
clarify 'destination not found' and 'proxy not found' pages
2008-01-07 zzz
* profiles.jsp formatting cleanup

View File

@ -6,6 +6,7 @@ Proxy-Connection: close
<html><head>
<title>Destination key conflict</title>
<link rel="shortcut icon" href="http://localhost:7657/favicon.ico" />
<style type='text/css'>
div.warning {
margin: 0em 1em 1em 224px;
@ -31,7 +32,7 @@ div.logo {
</head>
<body>
<div class=logo>
<a href="http://localhost:7657/index.jsp">Router Console</a><br />
<a href="http://localhost:7657/index.jsp" title="Router Console"><img src="http://localhost:7657/i2plogo.png" alt="Router Console" width="187" height="35" border="0"/></a><br />
[<a href="http://localhost:7657/config.jsp">configuration</a> | <a href="http://localhost:7657/help.jsp">help</a>]
</div>
<div class=warning id=warning>

View File

@ -4,39 +4,41 @@ Cache-control: no-cache
Connection: close
Proxy-Connection: close
<html><head>
<title>Eepsite not reachable</title>
<style type='text/css'>
div.warning {
margin: 0em 1em 1em 224px;
padding: .5em 1em;
background-color: #ffefef;
border: medium solid #ffafaf;
text-align: left;
color: inherit;
}
div.logo {
float: left;
width: 200px;
left: 1em;
top: 1em;
margin: 0em;
padding: .5em;
text-align: left;
border: medium solid #efefff;
background-color: #fafaff;
color: inherit;
}
</style>
</head>
<body>
<div class=logo>
<a href="http://localhost:7657/index.jsp">Router Console</a><br />
[<a href="http://localhost:7657/config.jsp">configuration</a> | <a href="http://localhost:7657/help.jsp">help</a>]
</div>
<div class=warning id=warning>
The eepsite was not reachable.
The eepsite is temporarily offline, or there is network congestion.
You may want to
<a href="javascript: window.location.reload()">retry</a>.
<BR><BR>Could not find the following destination:<BR><BR>
<html><head>
<title>Eepsite not reachable</title>
<link rel="shortcut icon" href="http://localhost:7657/favicon.ico" />
<style type='text/css'>
div.warning {
margin: 0em 1em 1em 224px;
padding: .5em 1em;
background-color: #ffefef;
border: medium solid #ffafaf;
text-align: left;
color: inherit;
}
div.logo {
float: left;
width: 200px;
left: 1em;
top: 1em;
margin: 0em;
padding: .5em;
text-align: left;
border: medium solid #efefff;
background-color: #fafaff;
color: inherit;
}
</style>
</head>
<body>
<div class=logo>
<a href="http://localhost:7657/index.jsp" title="Router Console"><img src="http://localhost:7657/i2plogo.png" alt="Router Console" width="187" height="35" border="0"/></a><br />
[<a href="http://localhost:7657/config.jsp">configuration</a> | <a href="http://localhost:7657/help.jsp">help</a>]
</div>
<div class=warning id=warning>
The eepsite was not reachable.
The eepsite is temporarily offline, there is network congestion,
or your router is not yet well-integrated with peers.
You may want to
<a href="javascript: window.location.reload()">retry</a>.
<BR><BR>Could not find the following destination:<BR><BR>

View File

@ -6,6 +6,7 @@ Proxy-Connection: close
<html><head>
<title>Invalid eepsite destination</title>
<link rel="shortcut icon" href="http://localhost:7657/favicon.ico" />
<style type='text/css'>
div.warning {
margin: 0em 1em 1em 224px;
@ -31,7 +32,7 @@ div.logo {
</head>
<body>
<div class=logo>
<a href="http://localhost:7657/index.jsp">Router Console</a><br />
<a href="http://localhost:7657/index.jsp" title="Router Console"><img src="http://localhost:7657/i2plogo.png" alt="Router Console" width="187" height="35" border="0"/></a><br />
[<a href="http://localhost:7657/config.jsp">configuration</a> | <a href="http://localhost:7657/help.jsp">help</a>]
</div>
<div class=warning id=warning>

View File

@ -6,6 +6,7 @@ Proxy-Connection: close
<html><head>
<title>Eepsite unknown</title>
<link rel="shortcut icon" href="http://localhost:7657/favicon.ico" />
<style type='text/css'>
div.warning {
margin: 0em 1em 1em 224px;
@ -31,7 +32,7 @@ div.logo {
</head>
<body>
<div class=logo>
<a href="http://localhost:7657/index.jsp">Router Console</a><br />
<a href="http://localhost:7657/index.jsp" title="Router Console"><img src="http://localhost:7657/i2plogo.png" alt="Router Console" width="187" height="35" border="0"/></a><br />
[<a href="http://localhost:7657/config.jsp">configuration</a> | <a href="http://localhost:7657/help.jsp">help</a>]
</div>
<div class=warning id=warning>

View File

@ -6,6 +6,7 @@ Proxy-Connection: close
<html><head>
<title>Outproxy Not Found</title>
<link rel="shortcut icon" href="http://localhost:7657/favicon.ico" />
<style type='text/css'>
div.warning {
margin: 0em 1em 1em 224px;
@ -32,13 +33,14 @@ div.logo {
</head>
<body>
<div class=logo>
<a href="http://localhost:7657/index.jsp">Router Console</a><br />
<a href="http://localhost:7657/index.jsp" title="Router Console"><img src="http://localhost:7657/i2plogo.png" alt="Router Console" width="187" height="35" border="0"/></a><br />
[<a href="http://localhost:7657/config.jsp">configuration</a> | <a href="http://localhost:7657/help.jsp">help</a>]
</div>
<div class=warning id=warning>
The WWW Outproxy was not found.
It could
be temporarily offline. You may want to
It is offline, there is network congestion,
or your router is not yet well-integrated with peers.
You may want to
<a href="javascript: parent.window.location.reload()">retry</a>
as this will randomly reselect an outproxy from the pool you have defined
<a href="http://localhost:7657/i2ptunnel/index.jsp">here</a>

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.547 $ $Date: 2008-01-07 03:09:43 $";
public final static String ID = "$Revision: 1.548 $ $Date: 2008-01-08 21:15:43 $";
public final static String VERSION = "0.6.1.30";
public final static long BUILD = 19;
public final static long BUILD = 20;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);