TheAiCollectiveART commited on
Commit
4868e91
·
verified ·
1 Parent(s): 00bf58d

Update/Add WASM_U-Performance_Record/server.py for WebAssembly 7.10us record

Browse files
Files changed (1) hide show
  1. WASM_U-Performance_Record/server.py +30 -0
WASM_U-Performance_Record/server.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Watermark: ip zymatica.space | astronautshe.com
3
+ # Local HTTP Server with Cross-Origin Isolation Headers
4
+
5
+ import http.server
6
+ import socketserver
7
+
8
+ PORT = 8080
9
+
10
+ class CrossOriginIsolatedRequestHandler(http.server.SimpleHTTPRequestHandler):
11
+ def end_headers(self):
12
+ # Inject COOP and COEP headers to enable high-precision timing (Spectre mitigation bypass)
13
+ self.send_header("Cross-Origin-Opener-Policy", "same-origin")
14
+ self.send_header("Cross-Origin-Embedder-Policy", "require-corp")
15
+ super().end_headers()
16
+
17
+ if __name__ == "__main__":
18
+ # Allow address reuse to avoid port binding errors on restarts
19
+ socketserver.TCPServer.allow_reuse_address = True
20
+
21
+ with socketserver.TCPServer(("", PORT), CrossOriginIsolatedRequestHandler) as httpd:
22
+ print("=" * 80)
23
+ print(f" [+] CROSS-ORIGIN ISOLATED SERVER RUNNING AT: http://localhost:{PORT}/")
24
+ print(" [+] COOP / COEP Headers injected to unlock high-precision browser clocks.")
25
+ print(" [+] PRESS CTRL+C TO SHUT DOWN SERVER PROCESS.")
26
+ print("=" * 80)
27
+ try:
28
+ httpd.serve_forever()
29
+ except KeyboardInterrupt:
30
+ print("\n [*] Shutting down local server...")