Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

notary_http - Serve a static index page with explanation info for vis…

…itors

Hopefully this will help orient visitors who stumble across a network notary.
Might even encourage people to get involved!
  • Loading branch information...
commit ae419c7131f7b3d6dc8bef522cb46bc976252c81 1 parent 394873b
@daveschaefer daveschaefer authored
View
4 notary.cherrypy.config
@@ -4,3 +4,7 @@
[/favicon.ico]
tools.staticfile.on = True
tools.staticfile.filename = "img/perspectives.ico"
+
+[/img]
+tools.staticdir.on = True
+tools.staticdir.dir = "img"
View
9 notary_http.py
@@ -43,6 +43,7 @@ class NotaryHTTPServer:
DEFAULT_WEB_PORT=8080
ENV_PORT_KEY_NAME='PORT'
STATIC_DIR = "notary_static"
+ STATIC_INDEX = "index.html"
def __init__(self):
parser = argparse.ArgumentParser(parents=[ndb.get_parser(), keygen.get_parser()],
@@ -160,8 +161,14 @@ def get_xml(self, service_id):
@cherrypy.expose
def index(self, host=None, port=None, service_type=None):
- if (host == None or port == None or service_type == None):
+ if (host == None and port == None and service_type == None):
+ # probably a visitor that doesn't know what this server is for.
+ # serve a static explanation page
+ path = os.path.join(cherrypy.request.app.config['/']['tools.staticfile.root'], self.STATIC_INDEX)
+ return cherrypy.lib.static.serve_file(path)
+ elif (host == None or port == None or service_type == None):
raise cherrypy.HTTPError(400)
+
if service_type != "1" and service_type != "2":
raise cherrypy.HTTPError(404)
View
BIN  notary_static/img/perspectives-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
50 notary_static/index.html
@@ -0,0 +1,50 @@
+<html>
+<head>
+ <title>Perspectives Network Notary Server</title>
+ <style type='text/css'>
+ body {
+ background-color: white;
+ color: #333333;
+ padding: 20px;
+ margin: 0;
+ line-height: 20px;
+ font-size: 14px;
+ font-family: Arial, sans-serif;
+ }
+
+ .section.info {
+ color: #222222; }
+
+ .section.info h1 {
+ font-size: 22px;
+ background-color: #99ccff;
+ padding: 10px 10px 10px 10px;
+ margin: 0;
+ overflow: hidden; }
+
+ .section.info .box {
+ border: 4px solid #99ccff;
+ padding: 20px 20px 20px 20px; }
+
+ .section.info .box a {
+ color: #6666cc; }
+
+ .section.info img {
+ vertical-align: text-bottom;}
+ }
+ </style>
+</head>
+
+<body>
+ <div class='container'>
+ <div class='section info'>
+ <h1><IMG SRC="img/perspectives-logo.png" TITLE="Perspectives" width="32" heigh="32" />&nbsp;Perspectives Network Notary Server</h1>
+ <div class='box'>
+ <p>This is a Perspectives 'network notary' server. It collects and shares information on SSL certificates from around the internet.</p>
+ <p>For more information see <a href="http://perspectives-project.org">http://perspectives-project.org</a>.</p>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
+
Please sign in to comment.
Something went wrong with that request. Please try again.