#!/usr/bin/env python3
"""Minimal HTTP server for the keyjacking POC.

navigator.credentials is only exposed in secure contexts; http://localhost
is treated as a secure context by Chromium so plain HTTP is sufficient.
"""
import http.server
import os
import socketserver

PORT = 18347
os.chdir(os.path.dirname(os.path.abspath(__file__)))

class Handler(http.server.SimpleHTTPRequestHandler):
    def end_headers(self):
        self.send_header("Cache-Control", "no-store")
        super().end_headers()

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