Bypass router queue for LuCI static assets

This commit is contained in:
kzolotarev95 committed 2026-07-01 22:43:59 +04:00
1 parent ff05cf92dd
commit 3a120e4e28
1 file changed
+6 -5
+6 -5
View File
@@ -2626,14 +2626,15 @@ class Handler(BaseHTTPRequestHandler):
if body is not None: if body is not None:
headers["Content-Length"] = str(len(body)) headers["Content-Length"] = str(len(body))
limiter = router_proxy_limiter(router_id) limiter = None if is_static else router_proxy_limiter(router_id)
acquired = False acquired = False
backend = None backend = None
try: try:
acquired = limiter.acquire(timeout=PROXY_TIMEOUT) if limiter is not None:
if not acquired: acquired = limiter.acquire(timeout=PROXY_TIMEOUT)
self.send_text(503, "proxy busy: router is handling too many requests") if not acquired:
return self.send_text(503, "proxy busy: router is handling too many requests")
return
backend = http.client.HTTPConnection("127.0.0.1", port, timeout=PROXY_TIMEOUT) backend = http.client.HTTPConnection("127.0.0.1", port, timeout=PROXY_TIMEOUT)
backend.request(self.command, target, body=body, headers=headers) backend.request(self.command, target, body=body, headers=headers)
resp = backend.getresponse() resp = backend.getresponse()