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

Serves poc.html (and any sibling files) on http://localhost:8080/.
"""
import http.server
import os
import socketserver

PORT = 8080


class Handler(http.server.SimpleHTTPRequestHandler):
    def __init__(self, *args, **kwargs):
        super().__init__(
            *args, directory=os.path.dirname(os.path.abspath(__file__)), **kwargs
        )

    def end_headers(self):
        self.send_header("Cache-Control", "no-store")
        super().end_headers()


def main():
    socketserver.TCPServer.allow_reuse_address = True
    with socketserver.TCPServer(("127.0.0.1", PORT), Handler) as httpd:
        print(f"[*] Serving POC on http://127.0.0.1:{PORT}/poc.html")
        httpd.serve_forever()


if __name__ == "__main__":
    main()
