diff --git a/lg.py b/lg.py index 657915d..8966226 100644 --- a/lg.py +++ b/lg.py @@ -20,6 +20,7 @@ # ### +import base64 from datetime import datetime import memcache import subprocess @@ -401,6 +402,7 @@ def show_bgpmap(): if not data: abort(400) + data = base64.b64decode(data) data = json.loads(data) graph = pydot.Dot('BGPMAP', graph_type='digraph') @@ -508,6 +510,7 @@ def show_bgpmap(): #response = Response("
" + graph.create_dot() + "") response = Response(graph.create_png(), mimetype='image/png') + # response = Response(graph.create_svg(), mimetype='image/svg+xml') response.headers['Last-Modified'] = datetime.now() response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0' response.headers['Pragma'] = 'no-cache' @@ -635,7 +638,7 @@ def show_route(request_type, hosts, proto): detail[host] = add_links(res) if bgpmap: - detail = json.dumps(detail) + detail = base64.b64encode(json.dumps(detail)) return render_template((bgpmap and 'bgpmap.html' or 'route.html'), detail=detail, command=command, expression=expression, errors=errors)