From 394d3cfee60b48fa1eeb2cd0602ee675dedd822a Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Sun, 24 Jul 2022 08:48:43 +0530 Subject: [PATCH] auth-utils: Use handle_request in creating the server it just handles one request and the server is terminated automatically --- src/common/auth-utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/auth-utils.sh b/src/common/auth-utils.sh index dc596dd..abccf29 100644 --- a/src/common/auth-utils.sh +++ b/src/common/auth-utils.sh @@ -363,7 +363,7 @@ class handler(BaseHTTPRequestHandler): self.wfile.write(bytes(message, "utf8")) with HTTPServer(('', ${server_port_check_refresh_token}), handler) as server: - server.serve_forever() + server.handle_request() EOF _tmp_server_pid="${!}" elif command -v nc 1> /dev/null; then @@ -384,7 +384,7 @@ EOF "${QUIET:-_print_center}" "normal" " Press enter if you have completed the process in browser" "-" read -r _ - kill "${_tmp_server_pid}" + kill "${_tmp_server_pid}" 1>| /dev/null 2>&1 || : if ! authorization_code="$(grep -m1 'GET.*code.*HTTP/1.1' < "${TMPFILE}.code" | sed -e 's/.*GET.*code=//' -e 's/\&.*//')" && _assert_regex "${authorization_code_regex}" "${authorization_code}"; then