Handle HEAD checks for hub availability
This commit is contained in:
1 parent
438c1fdb73
commit
c3b2a09422
1 file changed
+5
-1
@@ -1859,6 +1859,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
self.send_header(key, value)
|
self.send_header(key, value)
|
||||||
self.send_header("Content-Length", str(len(body)))
|
self.send_header("Content-Length", str(len(body)))
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
if self.command != "HEAD":
|
||||||
self.wfile.write(body)
|
self.wfile.write(body)
|
||||||
|
|
||||||
def send_text(self, status, text, content_type="text/plain; charset=utf-8"):
|
def send_text(self, status, text, content_type="text/plain; charset=utf-8"):
|
||||||
@@ -2360,6 +2361,9 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
return
|
return
|
||||||
self.send_text(404, "not found")
|
self.send_text(404, "not found")
|
||||||
|
|
||||||
|
def do_HEAD(self):
|
||||||
|
self.do_GET()
|
||||||
|
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
path = self.parsed().path
|
path = self.parsed().path
|
||||||
if path == "/login":
|
if path == "/login":
|
||||||
@@ -2518,7 +2522,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
headers["Host"] = f"127.0.0.1:{port}"
|
headers["Host"] = f"127.0.0.1:{port}"
|
||||||
headers["X-Forwarded-Host"] = self.headers.get("Host", "")
|
headers["X-Forwarded-Host"] = self.headers.get("Host", "")
|
||||||
headers["X-Forwarded-Prefix"] = f"/access/{urllib.parse.quote(router_id)}"
|
headers["X-Forwarded-Prefix"] = f"/access/{urllib.parse.quote(router_id)}"
|
||||||
headers["X-Forwarded-Proto"] = "https" if self.headers.get("X-Forwarded-Proto", "") == "https" else "http"
|
headers["X-Forwarded-Proto"] = "https" if getattr(self.server, "is_tls", False) or self.headers.get("X-Forwarded-Proto", "") == "https" else "http"
|
||||||
if body is not None:
|
if body is not None:
|
||||||
headers["Content-Length"] = str(len(body))
|
headers["Content-Length"] = str(len(body))
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user