Compare commits

..
2 Commits
3 changed files with 11 additions and 7 deletions
+1
View File
@@ -124,6 +124,7 @@ def main():
args.auth_host = f"https://{args.auth_host}" args.auth_host = f"https://{args.auth_host}"
args.auth_host = args.auth_host.rstrip("/") args.auth_host = args.auth_host.rstrip("/")
validate_auth_host(args.auth_host, args.rp_id) validate_auth_host(args.auth_host, args.rp_id)
if args.origins:
args.origins.insert(0, args.auth_host) # Ensure first in origins args.origins.insert(0, args.auth_host) # Ensure first in origins
# Normalize, strip trailing slashes, and deduplicate while preserving order # Normalize, strip trailing slashes, and deduplicate while preserving order
-6
View File
@@ -22,12 +22,6 @@ async def patched_html_response(request, filepath: str, status_code: int, **data
Returns: Returns:
Patched Response object, or original response if not 200. Patched Response object, or original response if not 200.
""" """
# Strip caching/compression headers to get raw uncompressed content
cache_headers = {b"if-none-match", b"if-modified-since", b"accept-encoding"}
request.scope["headers"] = [
(k, v) for k, v in request.scope["headers"] if k.lower() not in cache_headers
]
resp = await vitedev.handle(request, frontend, filepath) resp = await vitedev.handle(request, frontend, filepath)
# Pass through non-200 responses # Pass through non-200 responses
if resp.status_code != 200: if resp.status_code != 200:
+9
View File
@@ -63,4 +63,13 @@ async def handle(request, frontend, filepath: str):
) )
# Fallback to frontend.handle for cache negotiation # Fallback to frontend.handle for cache negotiation
# Strip accept-encoding to get uncompressed content (needed for HTML patching)
strip_headers = {b"accept-encoding", b"if-none-match", b"if-modified-since"}
request.scope["headers"] = [
(k, v) for k, v in request.scope["headers"] if k.lower() not in strip_headers
]
# Invalidate cached Headers object (it doesn't re-read scope after first access)
if hasattr(request, "_headers"):
del request._headers
return frontend.handle(request, filepath) return frontend.handle(request, filepath)