#!/usr/bin/env python3
import http.server, socketserver

PORT = 8080

class H(http.server.SimpleHTTPRequestHandler):
    def do_POST(self):
        # Consume body so the password manager treats the login as successful
        # and offers to save / later fill.
        self.rfile.read(int(self.headers.get('Content-Length', 0)))
        self.send_response(303)
        self.send_header('Location', '/opener.html')
        self.end_headers()

socketserver.TCPServer.allow_reuse_address = True
with socketserver.TCPServer(("", PORT), H) as httpd:
    print(f"serving on http://localhost:{PORT}/opener.html")
    httpd.serve_forever()
