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

Serves poc.html on http://<host>:8080/poc.html so an iPhone on the same
network can load it. Binds to all interfaces so a real device can reach it;
restrict to 127.0.0.1 if you only need the iOS Simulator on the same Mac.
"""
import http.server
import os
import socketserver
import sys

PORT = int(sys.argv[1]) if len(sys.argv) > 1 else 8080
HOST = sys.argv[2] if len(sys.argv) > 2 else "0.0.0.0"

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((HOST, PORT), Handler) as httpd:
    print(f"Serving POC on http://{HOST}:{PORT}/poc.html")
    httpd.serve_forever()
