[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-web/master] Remove previously disabled or deprecated website parts.
commit 82a41fbb14a2e88d8a9494888d2eb2003e76531c
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Thu Mar 22 14:28:10 2012 +0100
Remove previously disabled or deprecated website parts.
---
etc/web.xml | 64 ----
src/org/torproject/ernie/cron/ArchiveReader.java | 8 -
.../cron/RelayDescriptorDatabaseImporter.java | 165 ---------
.../torproject/ernie/web/DescriptorServlet.java | 353 --------------------
.../ernie/web/ExtraInfoDescriptorServlet.java | 113 -------
.../torproject/ernie/web/NetworkStatusServlet.java | 24 --
.../torproject/ernie/web/RouterDetailServlet.java | 24 --
src/org/torproject/ernie/web/VotesServlet.java | 132 --------
web/WEB-INF/banner.jsp | 2 -
web/WEB-INF/networkstatus.jsp | 23 --
web/WEB-INF/routerdetail.jsp | 23 --
web/robots.txt | 2 -
12 files changed, 0 insertions(+), 933 deletions(-)
diff --git a/etc/web.xml b/etc/web.xml
index 12e35fa..c831f3f 100644
--- a/etc/web.xml
+++ b/etc/web.xml
@@ -130,27 +130,6 @@
</servlet-mapping>
<servlet>
- <servlet-name>NetworkStatus</servlet-name>
- <servlet-class>
- org.torproject.ernie.web.NetworkStatusServlet
- </servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>NetworkStatus</servlet-name>
- <url-pattern>/networkstatus.html</url-pattern>
- </servlet-mapping>
- <servlet>
- <servlet-name>RouterDetail</servlet-name>
- <servlet-class>
- org.torproject.ernie.web.RouterDetailServlet
- </servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>RouterDetail</servlet-name>
- <url-pattern>/routerdetail.html</url-pattern>
- </servlet-mapping>
-
- <servlet>
<servlet-name>Relay</servlet-name>
<servlet-class>
org.torproject.ernie.web.RelayServlet
@@ -238,10 +217,6 @@
<servlet-name>GraphImage</servlet-name>
<url-pattern>/connbidirect.png</url-pattern>
</servlet-mapping>
- <servlet-mapping>
- <servlet-name>GraphImage</servlet-name>
- <url-pattern>/routerdetail.png</url-pattern>
- </servlet-mapping>
<servlet>
<servlet-name>Csv</servlet-name>
@@ -276,32 +251,6 @@
<url-pattern>/serverdesc</url-pattern>
</servlet-mapping>
-<!--
- <servlet>
- <servlet-name>ExtraInfoDescriptor</servlet-name>
- <servlet-class>
- org.torproject.ernie.web.ExtraInfoDescriptorServlet
- </servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>ExtraInfoDescriptor</servlet-name>
- <url-pattern>/extrainfodesc</url-pattern>
- </servlet-mapping>
--->
-
-<!--
- <servlet>
- <servlet-name>Descriptor</servlet-name>
- <servlet-class>
- org.torproject.ernie.web.DescriptorServlet
- </servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>Descriptor</servlet-name>
- <url-pattern>/descriptor.html</url-pattern>
- </servlet-mapping>
--->
-
<servlet>
<servlet-name>Consensus</servlet-name>
<servlet-class>
@@ -313,19 +262,6 @@
<url-pattern>/consensus</url-pattern>
</servlet-mapping>
-<!--
- <servlet>
- <servlet-name>Votes</servlet-name>
- <servlet-class>
- org.torproject.ernie.web.VotesServlet
- </servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>Votes</servlet-name>
- <url-pattern>/votes</url-pattern>
- </servlet-mapping>
--->
-
<servlet>
<servlet-name>ErnieGeneratedFile</servlet-name>
<servlet-class>
diff --git a/src/org/torproject/ernie/cron/ArchiveReader.java b/src/org/torproject/ernie/cron/ArchiveReader.java
index e4f6b2a..e32072d 100644
--- a/src/org/torproject/ernie/cron/ArchiveReader.java
+++ b/src/org/torproject/ernie/cron/ArchiveReader.java
@@ -79,9 +79,6 @@ public class ArchiveReader {
if (descriptor instanceof RelayNetworkStatusConsensus) {
this.addRelayNetworkStatusConsensus(
(RelayNetworkStatusConsensus) descriptor);
- } else if (descriptor instanceof RelayNetworkStatusVote) {
- this.addRelayNetworkStatusVote(
- (RelayNetworkStatusVote) descriptor);
} else if (descriptor instanceof ServerDescriptor) {
this.addServerDescriptor((ServerDescriptor) descriptor);
} else if (descriptor instanceof ExtraInfoDescriptor) {
@@ -119,11 +116,6 @@ public class ArchiveReader {
consensus.getRawDescriptorBytes());
}
- private void addRelayNetworkStatusVote(RelayNetworkStatusVote vote) {
- this.rddi.addVote(vote.getValidAfterMillis(), vote.getIdentity(),
- vote.getRawDescriptorBytes());
- }
-
private void addServerDescriptor(ServerDescriptor descriptor) {
String digest = null;
try {
diff --git a/src/org/torproject/ernie/cron/RelayDescriptorDatabaseImporter.java b/src/org/torproject/ernie/cron/RelayDescriptorDatabaseImporter.java
index 3ee7b6b..3e7e694 100644
--- a/src/org/torproject/ernie/cron/RelayDescriptorDatabaseImporter.java
+++ b/src/org/torproject/ernie/cron/RelayDescriptorDatabaseImporter.java
@@ -71,12 +71,6 @@ public final class RelayDescriptorDatabaseImporter {
private PreparedStatement psRs;
/**
- * Prepared statement to check whether a given extra-info descriptor has
- * been imported into the database before.
- */
- private PreparedStatement psEs;
-
- /**
* Prepared statement to check whether a given server descriptor has
* been imported into the database before.
*/
@@ -89,12 +83,6 @@ public final class RelayDescriptorDatabaseImporter {
private PreparedStatement psCs;
/**
- * Prepared statement to check whether a given network status vote has
- * been imported into the database before.
- */
- private PreparedStatement psVs;
-
- /**
* Prepared statement to check whether a given conn-bi-direct stats
* string has been imported into the database before.
*/
@@ -130,12 +118,6 @@ public final class RelayDescriptorDatabaseImporter {
private PreparedStatement psD;
/**
- * Prepared statement to insert an extra-info descriptor into the
- * database.
- */
- private PreparedStatement psE;
-
- /**
* Callable statement to insert the bandwidth history of an extra-info
* descriptor into the database.
*/
@@ -148,12 +130,6 @@ public final class RelayDescriptorDatabaseImporter {
private PreparedStatement psC;
/**
- * Prepared statement to insert a network status vote into the
- * database.
- */
- private PreparedStatement psV;
-
- /**
* Prepared statement to insert a conn-bi-direct stats string into the
* database.
*/
@@ -186,11 +162,6 @@ public final class RelayDescriptorDatabaseImporter {
private BufferedWriter descriptorOut;
/**
- * Raw import file containing extra-info descriptors.
- */
- private BufferedWriter extrainfoOut;
-
- /**
* Raw import file containing bandwidth histories.
*/
private BufferedWriter bwhistOut;
@@ -201,11 +172,6 @@ public final class RelayDescriptorDatabaseImporter {
private BufferedWriter consensusOut;
/**
- * Raw import file containing votes.
- */
- private BufferedWriter voteOut;
-
- /**
* Raw import file containing conn-bi-direct stats strings.
*/
private BufferedWriter connBiDirectOut;
@@ -268,12 +234,8 @@ public final class RelayDescriptorDatabaseImporter {
+ "fingerprint = ?");
this.psDs = conn.prepareStatement("SELECT COUNT(*) "
+ "FROM descriptor WHERE descriptor = ?");
- this.psEs = conn.prepareStatement("SELECT COUNT(*) "
- + "FROM extrainfo WHERE extrainfo = ?");
this.psCs = conn.prepareStatement("SELECT COUNT(*) "
+ "FROM consensus WHERE validafter = ?");
- this.psVs = conn.prepareStatement("SELECT COUNT(*) "
- + "FROM vote WHERE validafter = ? AND dirsource = ?");
this.psBs = conn.prepareStatement("SELECT COUNT(*) "
+ "FROM connbidirect WHERE source = ? AND statsend = ?");
this.psQs = conn.prepareStatement("SELECT COUNT(*) "
@@ -292,15 +254,10 @@ public final class RelayDescriptorDatabaseImporter {
+ "bandwidthobserved, platform, published, uptime, "
+ "extrainfo, rawdesc) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
+ "?, ?, ?, ?)");
- this.psE = conn.prepareStatement("INSERT INTO extrainfo "
- + "(extrainfo, nickname, fingerprint, published, rawdesc) "
- + "VALUES (?, ?, ?, ?, ?)");
this.csH = conn.prepareCall("{call insert_bwhist(?, ?, ?, ?, ?, "
+ "?)}");
this.psC = conn.prepareStatement("INSERT INTO consensus "
+ "(validafter, rawdesc) VALUES (?, ?)");
- this.psV = conn.prepareStatement("INSERT INTO vote "
- + "(validafter, dirsource, rawdesc) VALUES (?, ?, ?)");
this.psB = conn.prepareStatement("INSERT INTO connbidirect "
+ "(source, statsend, seconds, belownum, readnum, writenum, "
+ "bothnum) VALUES (?, ?, ?, ?, ?, ?, ?)");
@@ -590,60 +547,6 @@ public final class RelayDescriptorDatabaseImporter {
public void addExtraInfoDescriptor(String extraInfoDigest,
String nickname, String fingerprint, long published,
byte[] rawDescriptor, List<String> bandwidthHistoryLines) {
- if (this.importIntoDatabase) {
- try {
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
- this.psEs.setString(1, extraInfoDigest);
- ResultSet rs = psEs.executeQuery();
- rs.next();
- if (rs.getInt(1) == 0) {
- this.psE.clearParameters();
- this.psE.setString(1, extraInfoDigest);
- this.psE.setString(2, nickname);
- this.psE.setString(3, fingerprint);
- this.psE.setTimestamp(4, new Timestamp(published), cal);
- this.psE.setBytes(5, rawDescriptor);
- this.psE.executeUpdate();
- resCount++;
- if (resCount % autoCommitCount == 0) {
- this.conn.commit();
- }
- }
- } catch (SQLException e) {
- this.logger.log(Level.WARNING, "Could not add extra-info "
- + "descriptor. We won't make any further SQL requests in "
- + "this execution.", e);
- this.importIntoDatabase = false;
- }
- }
- if (this.writeRawImportFiles) {
- try {
- if (this.extrainfoOut == null) {
- new File(rawFilesDirectory).mkdirs();
- this.extrainfoOut = new BufferedWriter(new FileWriter(
- rawFilesDirectory + "/extrainfo.sql"));
- this.extrainfoOut.write(" COPY extrainfo (extrainfo, nickname, "
- + "fingerprint, published, rawdesc) FROM stdin;\n");
- }
- this.extrainfoOut.write(extraInfoDigest.toLowerCase() + "\t"
- + nickname + "\t" + fingerprint.toLowerCase() + "\t"
- + this.dateTimeFormat.format(published) + "\t");
- this.extrainfoOut.write(PGbytea.toPGString(rawDescriptor).
- replaceAll("\\\\", "\\\\\\\\") + "\n");
- } catch (IOException e) {
- this.logger.log(Level.WARNING, "Could not write extra-info "
- + "descriptor to raw database import file. We won't make "
- + "any further attempts to write raw import files in this "
- + "execution.", e);
- this.writeRawImportFiles = false;
- } catch (SQLException e) {
- this.logger.log(Level.WARNING, "Could not write extra-info "
- + "descriptor to raw database import file. We won't make "
- + "any further attempts to write raw import files in this "
- + "execution.", e);
- this.writeRawImportFiles = false;
- }
- }
if (!bandwidthHistoryLines.isEmpty()) {
this.addBandwidthHistory(fingerprint.toLowerCase(), published,
bandwidthHistoryLines);
@@ -955,66 +858,6 @@ public final class RelayDescriptorDatabaseImporter {
}
/**
- * Insert network status vote into database.
- */
- public void addVote(long validAfter, String dirSource,
- byte[] rawDescriptor) {
- if (this.importIntoDatabase) {
- try {
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
- Timestamp validAfterTimestamp = new Timestamp(validAfter);
- this.psVs.setTimestamp(1, validAfterTimestamp, cal);
- this.psVs.setString(2, dirSource);
- ResultSet rs = psVs.executeQuery();
- rs.next();
- if (rs.getInt(1) == 0) {
- this.psV.clearParameters();
- this.psV.setTimestamp(1, validAfterTimestamp, cal);
- this.psV.setString(2, dirSource);
- this.psV.setBytes(3, rawDescriptor);
- this.psV.executeUpdate();
- rvsCount++;
- if (rvsCount % autoCommitCount == 0) {
- this.conn.commit();
- }
- }
- } catch (SQLException e) {
- this.logger.log(Level.WARNING, "Could not add network status "
- + "vote. We won't make any further SQL requests in this "
- + "execution.", e);
- this.importIntoDatabase = false;
- }
- }
- if (this.writeRawImportFiles) {
- try {
- if (this.voteOut == null) {
- new File(rawFilesDirectory).mkdirs();
- this.voteOut = new BufferedWriter(new FileWriter(
- rawFilesDirectory + "/vote.sql"));
- this.voteOut.write(" COPY vote (validafter, dirsource, "
- + "rawdesc) FROM stdin;\n");
- }
- String validAfterString = this.dateTimeFormat.format(validAfter);
- this.voteOut.write(validAfterString + "\t" + dirSource + "\t");
- this.voteOut.write(PGbytea.toPGString(rawDescriptor).
- replaceAll("\\\\", "\\\\\\\\") + "\n");
- } catch (SQLException e) {
- this.logger.log(Level.WARNING, "Could not write network status "
- + "vote to raw database import file. We won't make any "
- + "further attempts to write raw import files in this "
- + "execution.", e);
- this.writeRawImportFiles = false;
- } catch (IOException e) {
- this.logger.log(Level.WARNING, "Could not write network status "
- + "vote to raw database import file. We won't make any "
- + "further attempts to write raw import files in this "
- + "execution.", e);
- this.writeRawImportFiles = false;
- }
- }
- }
-
- /**
* Insert a conn-bi-direct stats string into the database.
*/
public void addConnBiDirect(String source, long statsEndMillis,
@@ -1195,10 +1038,6 @@ public final class RelayDescriptorDatabaseImporter {
this.descriptorOut.write("\\.\n");
this.descriptorOut.close();
}
- if (this.extrainfoOut != null) {
- this.extrainfoOut.write("\\.\n");
- this.extrainfoOut.close();
- }
if (this.bwhistOut != null) {
this.bwhistOut.write("\\.\n");
this.bwhistOut.close();
@@ -1207,10 +1046,6 @@ public final class RelayDescriptorDatabaseImporter {
this.consensusOut.write("\\.\n");
this.consensusOut.close();
}
- if (this.voteOut != null) {
- this.voteOut.write("\\.\n");
- this.voteOut.close();
- }
if (this.connBiDirectOut != null) {
this.connBiDirectOut.write("\\.\n");
this.connBiDirectOut.close();
diff --git a/src/org/torproject/ernie/web/DescriptorServlet.java b/src/org/torproject/ernie/web/DescriptorServlet.java
deleted file mode 100644
index 7b3a1b7..0000000
--- a/src/org/torproject/ernie/web/DescriptorServlet.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/* Copyright 2011, 2012 The Tor Project
- * See LICENSE for licensing information */
-package org.torproject.ernie.web;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringReader;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
-public class DescriptorServlet extends HttpServlet {
-
- private static final long serialVersionUID = 7933295702958621380L;
-
- private DataSource ds;
-
- private Logger logger;
-
- public void init() {
-
- /* Initialize logger. */
- this.logger = Logger.getLogger(DescriptorServlet.class.toString());
-
- /* Look up data source. */
- try {
- Context cxt = new InitialContext();
- this.ds = (DataSource) cxt.lookup("java:comp/env/jdbc/tordir");
- this.logger.info("Successfully looked up data source.");
- } catch (NamingException e) {
- this.logger.log(Level.WARNING, "Could not look up data source", e);
- }
- }
-
- private void writeHeader(PrintWriter out) throws IOException {
- out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 "
- + "Transitional//EN\"\n"
- + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
- + "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
- + " <head>\n"
- + " <meta content=\"text/html; charset=ISO-8859-1\"\n"
- + " http-equiv=\"content-type\" />\n"
- + " <title>Relay Descriptor</title>\n"
- + " <meta http-equiv=Content-Type content=\"text/html; "
- + "charset=iso-8859-1\">\n"
- + " <link href=\"/css/stylesheet-ltr.css\" type=text/css "
- + "rel=stylesheet>\n"
- + " <link href=\"/images/favicon.ico\" "
- + "type=image/x-icon rel=\"shortcut icon\">\n"
- + " </head>\n"
- + " <body>\n"
- + " <div class=\"center\">\n"
- + " <table class=\"banner\" border=\"0\" cellpadding=\"0\" "
- + "cellspacing=\"0\" summary=\"\">\n"
- + " <tr>\n"
- + " <td class=\"banner-left\"><a "
- + "href=\"/index.html\"><img src=\"/images/top-left.png\" "
- + "alt=\"Click to go to home page\" width=\"193\" "
- + "height=\"79\"></a></td>\n"
- + " <td class=\"banner-middle\">\n"
- + " <a href=\"/\">Home</a>\n"
- + " <a href=\"graphs.html\">Graphs</a>\n"
- + " <a href=\"research.html\">Research</a>\n"
- + " <a href=\"status.html\">Status</a>\n"
- + " <br/>\n"
- + " <font size=\"2\">\n"
- + " <a href=\"exonerator.html\">ExoneraTor</a>\n"
- + " <a class=\"current\">Relay Search</a>\n"
- + " <a href=\"consensus-health.html\">Consensus "
- + "Health</a>\n"
- + " </font>\n"
- + " </td>\n"
- + " <td class=\"banner-right\"></td>\n"
- + " </tr>\n"
- + " </table>\n"
- + " <div class=\"main-column\" style=\"margin:5; "
- + "Padding:0;\">\n"
- + " <h2>Relay Descriptor</h2>\n");
- }
-
- private void writeFooter(PrintWriter out) throws IOException {
- out.println(" <br/>\n"
- + " </div>\n"
- + " </div>\n"
- + " <div class=\"bottom\" id=\"bottom\">\n"
- + " <p>This material is supported in part by the National "
- + "Science Foundation under Grant No. CNS-0959138. Any "
- + "opinions, finding, and conclusions or recommendations "
- + "expressed in this material are those of the author(s) and "
- + "do not necessarily reflect the views of the National "
- + "Science Foundation.</p>\n"
- + " <p>\"Tor\" and the \"Onion Logo\" are <a "
- + "href=\"https://www.torproject.org/docs/trademark-faq.html.en\">"
- + "registered trademarks</a> of The Tor Project, Inc.</p>\n"
- + " <p>Data on this site is freely available under a <a "
- + "href=\"http://creativecommons.org/publicdomain/zero/1.0/\">"
- + "CC0 no copyright declaration</a>: To the extent possible "
- + "under law, the Tor Project has waived all copyright and "
- + "related or neighboring rights in the data. Graphs are "
- + "licensed under a <a "
- + "href=\"http://creativecommons.org/licenses/by/3.0/us/\">"
- + "Creative Commons Attribution 3.0 United States "
- + "License</a>.</p>\n"
- + " </div>\n"
- + " </body>\n"
- + "</html>");
- out.close();
- }
-
- public void doGet(HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException {
-
- /* Measure how long it takes to process this request. */
- long started = System.currentTimeMillis();
-
- /* Get print writer and start writing response. */
- PrintWriter out = response.getWriter();
- writeHeader(out);
-
- /* Check desc-id parameter. */
- String descIdParameter = request.getParameter("desc-id");
- String descId = null;
- if (descIdParameter != null && descIdParameter.length() >= 8 &&
- descIdParameter.length() <= 40) {
- Pattern descIdPattern = Pattern.compile("^[0-9a-f]{8,40}$");
- if (descIdPattern.matcher(descIdParameter.toLowerCase()).
- matches()) {
- descId = descIdParameter.toLowerCase();
- }
- }
- if (descId == null) {
- out.write(" <br/><p>Sorry, \""
- + StringEscapeUtils.escapeHtml(descIdParameter) + "\" is not a "
- + "valid descriptor identifier. Please provide at least the "
- + "first 8 hex characters of a descriptor identifier.</p>\n");
- writeFooter(out);
- return;
- }
-
- /* If we were only given a partial descriptor identifier, look up all
- * descriptor identifiers starting with that part to see if it's
- * unique. */
- if (descId.length() < 40) {
- SortedSet<String> allDescIds = new TreeSet<String>();
- try {
- long requestedConnection = System.currentTimeMillis();
- Connection conn = this.ds.getConnection();
- Statement statement = conn.createStatement();
- String query = "SELECT DISTINCT descriptor FROM statusentry "
- + "WHERE descriptor LIKE '" + descId + "%'";
- ResultSet rs = statement.executeQuery(query);
- while (rs.next()) {
- allDescIds.add(rs.getString(1));
- }
- rs.close();
- statement.close();
- conn.close();
- this.logger.info("Returned a database connection to the pool "
- + "after " + (System.currentTimeMillis()
- - requestedConnection) + " millis.");
- } catch (SQLException e) {
- out.println("<p><font color=\"red\"><b>Warning: </b></font>We "
- + "experienced an unknown database problem while looking up "
- + "descriptors with identifier starting with " + descId
- + ". If this problem persists, please "
- + "<a href=\"mailto:tor-assistants@xxxxxxxxxxxxxx\">let us "
- + "know</a>!</p>\n");
- writeFooter(out);
- return;
- }
- if (allDescIds.size() == 0) {
- out.write("<p>No descriptor found " + (descId.length() < 40
- ? "starting " : "") + "with identifier " + descId + ".</p>");
- writeFooter(out);
- return;
- } else if (allDescIds.size() > 1) {
- out.println("<p>The descriptor identifier part " + descIdParameter
- + " is not unique. Please choose one of the following "
- + "descriptors:</p><ul>");
- for (String f : allDescIds) {
- out.println("<li><a href=\"descriptor.html?desc-id=" + f + "\">"
- + f + "</a></li>");
- }
- out.write("</ul><br/>");
- writeFooter(out);
- return;
- } else {
- descId = allDescIds.first();
- }
- }
-
- /* Look up descriptor in the database. */
- String descriptor = null, nickname = null, published = null,
- extrainfo = null;
- byte[] rawDescriptor = null, rawExtrainfo = null;
- try {
- long requestedConnection = System.currentTimeMillis();
- Connection conn = this.ds.getConnection();
- Statement statement = conn.createStatement();
- String query = "SELECT descriptor, nickname, published, extrainfo, "
- + "rawdesc FROM descriptor WHERE descriptor = '" + descId
- + "'";
- ResultSet rs = statement.executeQuery(query);
- if (rs.next()) {
- descriptor = rs.getString(1);
- nickname = rs.getString(2);
- published = rs.getTimestamp(3).toString().substring(0, 19);
- extrainfo = rs.getString(4);
- rawDescriptor = rs.getBytes(5);
- }
- query = "SELECT rawdesc FROM extrainfo WHERE extrainfo = '"
- + extrainfo + "'";
- rs = statement.executeQuery(query);
- if (rs.next()) {
- rawExtrainfo = rs.getBytes(1);
- }
- rs.close();
- statement.close();
- conn.close();
- this.logger.info("Returned a database connection to the pool after "
- + (System.currentTimeMillis() - requestedConnection)
- + " millis.");
- } catch (SQLException e) {
- out.write("<br/><p><font color=\"red\"><b>Warning: </b></font>"
- + "Internal server error when looking up descriptor. If this "
- + "problem persists, please "
- + "<a href=\"mailto:tor-assistants@xxxxxxxxxxxxxx\">let us "
- + "know</a>!</p>\n");
- writeFooter(out);
- return;
- }
-
- /* If no descriptor was found, stop here. */
- if (descriptor == null) {
- out.write("<p>No descriptor found " + (descIdParameter.length() < 40
- ? "starting " : "") + "with identifier " + descIdParameter
- + ".</p>");
- writeFooter(out);
- return;
- }
-
- /* Print out both server and extra-info descriptor. */
- out.write("<br/><p>The following server descriptor was published by "
- + "relay " + nickname + " at " + published + " UTC:</p>");
- String descriptorString = new String(rawDescriptor, "US-ASCII");
- String escapedDescriptorString = StringEscapeUtils.escapeHtml(
- descriptorString);
- BufferedReader br = new BufferedReader(new StringReader(
- escapedDescriptorString));
- String line = null;
- while ((line = br.readLine()) != null) {
- out.println(" <tt>" + line + "</tt><br/>");
- }
- br.close();
- if (rawExtrainfo != null) {
- out.println("<br/><p>Together with this server descriptor, the "
- + "relay published the following extra-info descriptor:</p>");
- String extraInfoString = new String(rawExtrainfo, "US-ASCII");
- String escapedExtraInfoString = StringEscapeUtils.escapeHtml(
- extraInfoString);
- br = new BufferedReader(new StringReader(escapedExtraInfoString));
- line = null;
- while ((line = br.readLine()) != null) {
- out.println(" <tt>" + line + "</tt><br/>");
- }
- }
-
- /* Print out in which consensuses this descriptor is referenced. */
- try {
- long requestedConnection = System.currentTimeMillis();
- Connection conn = this.ds.getConnection();
- Statement statement = conn.createStatement();
- String query = "SELECT validafter, rawdesc FROM statusentry "
- + "WHERE descriptor = '" + descriptor + "' ORDER BY validafter "
- + "DESC";
- ResultSet rs = statement.executeQuery(query);
- boolean printedDescription = false;
- while (rs.next()) {
- if (!printedDescription) {
- out.println("<br/><p>This server descriptor is referenced from "
- + "the following network status consensuses:</p>");
- printedDescription = true;
- }
- String validAfter = rs.getTimestamp(1).toString().
- substring(0, 19);
- out.println(" <br/><tt>valid-after "
- + "<a href=\"consensus?valid-after="
- + validAfter.replaceAll(":", "-").replaceAll(" ", "-")
- + "\" target=\"_blank\">" + validAfter + "</a></tt><br/>");
- byte[] rawStatusEntry = rs.getBytes(2);
- br = new BufferedReader(new StringReader(new String(
- rawStatusEntry, "US-ASCII")));
- line = null;
- while ((line = br.readLine()) != null) {
- out.println(" <tt>" + line + "</tt><br/>");
- }
- }
- rs.close();
- statement.close();
- conn.close();
- this.logger.info("Returned a database connection to the pool after "
- + (System.currentTimeMillis() - requestedConnection)
- + " millis.");
- } catch (SQLException e) {
- out.println("<p><font color=\"red\"><b>Warning: </b></font>We "
- + "experienced an unknown database problem while looking up "
- + "the network status consensuses referencing descriptor "
- + descId + ". If this problem persists, please "
- + "<a href=\"mailto:tor-assistants@xxxxxxxxxxxxxx\">let us "
- + "know</a>!</p>\n");
- }
-
- /* Provide links to raw descriptors, too. */
- out.println("<br/><p>Note that the descriptor" + (rawExtrainfo != null
- ? "s have" : " has") + " been converted to ASCII and reformatted "
- + "for display purposes. You may also download the raw "
- + "<a href=\"serverdesc?desc-id=" + descriptor
- + "\" target=\"_blank\">server " + "descriptor</a>"
- + (extrainfo != null ? " and <a href=\"extrainfodesc?desc-id="
- + extrainfo + "\" target=\"_blank\">extra-info descriptor</a>"
- : "") + " as " + (extrainfo != null ? "they were" : "it was")
- + " published to the directory authorities.</p>");
-
- /* Display total lookup time on the results page. */
- long searchTime = System.currentTimeMillis() - started;
- out.write(" <br/><p>Looking up this descriptor took us "
- + String.format("%d.%03d", searchTime / 1000, searchTime % 1000)
- + " seconds.</p>\n");
-
- /* Finish writing response. */
- writeFooter(out);
- }
-}
-
diff --git a/src/org/torproject/ernie/web/ExtraInfoDescriptorServlet.java b/src/org/torproject/ernie/web/ExtraInfoDescriptorServlet.java
deleted file mode 100644
index 8b532ce..0000000
--- a/src/org/torproject/ernie/web/ExtraInfoDescriptorServlet.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright 2011, 2012 The Tor Project
- * See LICENSE for licensing information */
-package org.torproject.ernie.web;
-
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-public class ExtraInfoDescriptorServlet extends HttpServlet {
-
- private static final long serialVersionUID = -177072581949479416L;
-
- private DataSource ds;
-
- private Logger logger;
-
- public void init() {
-
- /* Initialize logger. */
- this.logger = Logger.getLogger(
- ExtraInfoDescriptorServlet.class.toString());
-
- /* Look up data source. */
- try {
- Context cxt = new InitialContext();
- this.ds = (DataSource) cxt.lookup("java:comp/env/jdbc/tordir");
- this.logger.info("Successfully looked up data source.");
- } catch (NamingException e) {
- this.logger.log(Level.WARNING, "Could not look up data source", e);
- }
- }
-
- public void doGet(HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException {
-
- /* Check desc-id parameter. */
- String descIdParameter = request.getParameter("desc-id");
- if (descIdParameter == null || descIdParameter.length() < 8) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
- String descId = descIdParameter.toLowerCase();
- Pattern descIdPattern = Pattern.compile("^[0-9a-f]+$");
- Matcher descIdMatcher = descIdPattern.matcher(descId);
- if (!descIdMatcher.matches()) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
-
- /* Look up descriptor in the database. */
- String extrainfo = null;
- byte[] rawDescriptor = null;
- try {
- long requestedConnection = System.currentTimeMillis();
- Connection conn = this.ds.getConnection();
- Statement statement = conn.createStatement();
- String query = "SELECT extrainfo, rawdesc FROM extrainfo "
- + "WHERE extrainfo LIKE '" + descId + "%'";
- ResultSet rs = statement.executeQuery(query);
- if (rs.next()) {
- extrainfo = rs.getString(1);
- rawDescriptor = rs.getBytes(2);
- }
- rs.close();
- statement.close();
- conn.close();
- this.logger.info("Returned a database connection to the pool after "
- + (System.currentTimeMillis() - requestedConnection)
- + " millis.");
- } catch (SQLException e) {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
-
- /* Write response. */
- if (rawDescriptor == null) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
- try {
- response.setContentType("text/plain");
- response.setHeader("Content-Length", String.valueOf(
- rawDescriptor.length));
- response.setHeader("Content-Disposition", "inline; filename=\""
- + extrainfo + "\"");
- BufferedOutputStream output = new BufferedOutputStream(
- response.getOutputStream());
- output.write(rawDescriptor);
- output.flush();
- output.close();
- } finally {
- /* Nothing to do here. */
- }
- }
-}
-
diff --git a/src/org/torproject/ernie/web/NetworkStatusServlet.java b/src/org/torproject/ernie/web/NetworkStatusServlet.java
deleted file mode 100644
index 844fc4f..0000000
--- a/src/org/torproject/ernie/web/NetworkStatusServlet.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright 2011, 2012 The Tor Project
- * See LICENSE for licensing information */
-package org.torproject.ernie.web;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class NetworkStatusServlet extends HttpServlet {
-
- private static final long serialVersionUID = 1762552983543719111L;
-
- public void doGet(HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException {
-
- /* Forward the request to the JSP. */
- request.getRequestDispatcher("WEB-INF/networkstatus.jsp").forward(
- request, response);
- }
-}
-
diff --git a/src/org/torproject/ernie/web/RouterDetailServlet.java b/src/org/torproject/ernie/web/RouterDetailServlet.java
deleted file mode 100644
index fcbbe74..0000000
--- a/src/org/torproject/ernie/web/RouterDetailServlet.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright 2011, 2012 The Tor Project
- * See LICENSE for licensing information */
-package org.torproject.ernie.web;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class RouterDetailServlet extends HttpServlet {
-
- private static final long serialVersionUID = -5740769933146059947L;
-
- public void doGet(HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException {
-
- /* Forward the request to the JSP. */
- request.getRequestDispatcher("WEB-INF/routerdetail.jsp").forward(
- request, response);
- }
-}
-
diff --git a/src/org/torproject/ernie/web/VotesServlet.java b/src/org/torproject/ernie/web/VotesServlet.java
deleted file mode 100644
index 0821412..0000000
--- a/src/org/torproject/ernie/web/VotesServlet.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Copyright 2011, 2012 The Tor Project
- * See LICENSE for licensing information */
-package org.torproject.ernie.web;
-
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.TimeZone;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-public class VotesServlet extends HttpServlet {
-
- private static final long serialVersionUID = 246279501605993024L;
-
- private DataSource ds;
-
- private Logger logger;
-
- public void init() {
-
- /* Initialize logger. */
- this.logger = Logger.getLogger(VotesServlet.class.toString());
-
- /* Look up data source. */
- try {
- Context cxt = new InitialContext();
- this.ds = (DataSource) cxt.lookup("java:comp/env/jdbc/tordir");
- this.logger.info("Successfully looked up data source.");
- } catch (NamingException e) {
- this.logger.log(Level.WARNING, "Could not look up data source", e);
- }
- }
-
- public void doGet(HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException {
-
- /* Check valid-after parameter. */
- String validAfterParameter = request.getParameter("valid-after");
- if (validAfterParameter == null ||
- validAfterParameter.length() != "yyyy-MM-dd-HH-mm-ss".length()) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
- SimpleDateFormat parameterFormat = new SimpleDateFormat(
- "yyyy-MM-dd-HH-mm-ss");
- parameterFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- long parsedTimestamp = -1L;
- try {
- parsedTimestamp = parameterFormat.parse(validAfterParameter).
- getTime();
- } catch (ParseException e) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
- if (parsedTimestamp < 0L) {
- response.sendError(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
-
- /* Look up consensus in the database. */
- SimpleDateFormat databaseFormat = new SimpleDateFormat(
- "yyyy-MM-dd HH:mm:ss");
- databaseFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- String databaseParameter = databaseFormat.format(parsedTimestamp);
- List<byte[]> rawDescriptors = new ArrayList<byte[]>();
- try {
- long requestedConnection = System.currentTimeMillis();
- Connection conn = this.ds.getConnection();
- Statement statement = conn.createStatement();
- String query = "SELECT rawdesc FROM vote "
- + "WHERE validafter = '" + databaseParameter + "'";
- ResultSet rs = statement.executeQuery(query);
- while (rs.next()) {
- rawDescriptors.add(rs.getBytes(1));
- }
- rs.close();
- statement.close();
- conn.close();
- this.logger.info("Returned a database connection to the pool after "
- + (System.currentTimeMillis() - requestedConnection)
- + " millis.");
- } catch (SQLException e) {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
-
- /* Write response. */
- if (rawDescriptors.size() == 0) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
- try {
- response.setContentType("text/plain");
- int responseLength = 0;
- for (byte[] rawDescriptor : rawDescriptors) {
- responseLength += rawDescriptor.length;
- }
- response.setHeader("Content-Length", String.valueOf(
- responseLength));
- response.setHeader("Content-Disposition", "inline; filename=\""
- + validAfterParameter + "-votes\"");
- BufferedOutputStream output = new BufferedOutputStream(
- response.getOutputStream());
- for (byte[] rawDescriptor : rawDescriptors) {
- output.write(rawDescriptor);
- }
- output.flush();
- output.close();
- } finally {
- /* Nothing to do here. */
- }
- }
-}
-
diff --git a/web/WEB-INF/banner.jsp b/web/WEB-INF/banner.jsp
index a081423..c31875d 100644
--- a/web/WEB-INF/banner.jsp
+++ b/web/WEB-INF/banner.jsp
@@ -35,8 +35,6 @@
%>>Performance</a>
</font>
<%} else if (currentPage.endsWith("status.jsp") ||
- currentPage.endsWith("networkstatus.jsp") ||
- currentPage.endsWith("routerdetail.jsp") ||
currentPage.endsWith("exonerator.jsp") ||
currentPage.endsWith("relay-search.jsp") ||
currentPage.endsWith("consensus-health.jsp")) {
diff --git a/web/WEB-INF/networkstatus.jsp b/web/WEB-INF/networkstatus.jsp
deleted file mode 100644
index 8f7b379..0000000
--- a/web/WEB-INF/networkstatus.jsp
+++ /dev/null
@@ -1,23 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
-<head>
- <title>Tor Metrics Portal: Network Status</title>
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
- <link href="/css/stylesheet-ltr.css" type="text/css" rel="stylesheet">
- <link href="/images/favicon.ico" type="image/x-icon" rel="shortcut icon">
-</head>
-<body>
- <div class="center">
- <%@ include file="banner.jsp"%>
- <div class="main-column">
- <h2>Tor Metrics Portal: Network Status</h2>
- <br>
- <p>Sorry, this page has been discontinued.</p>
- </div>
- </div>
- <div class="bottom" id="bottom">
- <%@ include file="footer.jsp"%>
- </div>
-</body>
-</html>
diff --git a/web/WEB-INF/routerdetail.jsp b/web/WEB-INF/routerdetail.jsp
deleted file mode 100644
index 416285d..0000000
--- a/web/WEB-INF/routerdetail.jsp
+++ /dev/null
@@ -1,23 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
-<head>
- <title>Tor Metrics Portal: Router Detail</title>
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
- <link href="/css/stylesheet-ltr.css" type="text/css" rel="stylesheet">
- <link href="/images/favicon.ico" type="image/x-icon" rel="shortcut icon">
-</head>
-<body>
- <div class="center">
- <%@ include file="banner.jsp"%>
- <div class="main-column">
- <h2>Tor Metrics Portal: Router Detail</h2>
- <br>
- <p>Sorry, this page has been discontinued.</p>
- </div>
- </div>
- <div class="bottom" id="bottom">
- <%@ include file="footer.jsp"%>
- </div>
-</body>
-</html>
diff --git a/web/robots.txt b/web/robots.txt
index 7d138ee..f3ffac3 100644
--- a/web/robots.txt
+++ b/web/robots.txt
@@ -1,6 +1,4 @@
User-agent: *
-Disallow: /networkstatus.html
-Disallow: /routerdetail.html
Disallow: /relay.html
Disallow: /csv/
Disallow: /serverdesc
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits