#!/usr/bin/python from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import os class ExampleHTTPRequestHandler(BaseHTTPRequestHandler): def do_GET(self): session_key = os.path.basename(self.path) file = '/tmp/openvpn_sso_' + session_key print 'session file: ' + file try: f = open(file) #send code 200 response self.send_response(200) #send header first self.send_header('Content-type','text-html') self.end_headers() #send file content to client user = f.read().rstrip() print 'session user: ' + user print 'session key: ' + session_key self.wfile.write('