@@ -223,6 +223,7 @@ import urllib.request
223223
224224HOST = "host.openshell.internal"
225225PORT = {port}
226+ DETAILS = {{}}
226227
227228QUERY_VIEWER = "query Viewer {{ viewer {{ login }} }}"
228229QUERY_REPOSITORY = "query Repo {{ repository(owner:\"o\", name:\"r\") {{ id }} }}"
@@ -317,7 +318,8 @@ def forward_chunked_status(query):
317318 ).encode() + chunk
318319 sock.sendall(request)
319320 sock.shutdown(socket.SHUT_WR)
320- response = read_until(sock, b"\r\n\r\n")
321+ response, body = read_response(sock)
322+ DETAILS["forward_chunked_query_allowed_detail"] = body.decode(errors="replace")
321323 return int(response.split()[1])
322324
323325def read_until(sock, marker):
@@ -329,6 +331,21 @@ def read_until(sock, marker):
329331 data += chunk
330332 return data
331333
334+ def read_response(sock):
335+ response = read_until(sock, b"\r\n\r\n")
336+ headers, _, body = response.partition(b"\r\n\r\n")
337+ content_length = 0
338+ for line in headers.split(b"\r\n")[1:]:
339+ if line.lower().startswith(b"content-length:"):
340+ content_length = int(line.split(b":", 1)[1].strip())
341+ break
342+ while len(body) < content_length:
343+ chunk = sock.recv(4096)
344+ if not chunk:
345+ break
346+ body += chunk
347+ return response, body
348+
332349def connect_status(query):
333350 proxy_host, proxy_port = connect_proxy_parts()
334351 target = f"{{HOST}}:{{PORT}}"
@@ -476,6 +493,7 @@ results = {{
476493 "connect_mutation_allowed": connect_status(MUTATION_CREATE),
477494 "connect_deny_rule_denied": connect_status(MUTATION_DELETE),
478495}}
496+ results.update(DETAILS)
479497print(json.dumps(results, sort_keys=True))
480498"# ,
481499 port = server. port,
0 commit comments