Skip to content

Commit 394d3cf

Browse files
committed
auth-utils: Use handle_request in creating the server
it just handles one request and the server is terminated automatically
1 parent ffc3adb commit 394d3cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/auth-utils.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class handler(BaseHTTPRequestHandler):
363363
self.wfile.write(bytes(message, "utf8"))
364364
365365
with HTTPServer(('', ${server_port_check_refresh_token}), handler) as server:
366-
server.serve_forever()
366+
server.handle_request()
367367
EOF
368368
_tmp_server_pid="${!}"
369369
elif command -v nc 1> /dev/null; then
@@ -384,7 +384,7 @@ EOF
384384

385385
"${QUIET:-_print_center}" "normal" " Press enter if you have completed the process in browser" "-"
386386
read -r _
387-
kill "${_tmp_server_pid}"
387+
kill "${_tmp_server_pid}" 1>| /dev/null 2>&1 || :
388388

389389
if ! authorization_code="$(grep -m1 'GET.*code.*HTTP/1.1' < "${TMPFILE}.code" | sed -e 's/.*GET.*code=//' -e 's/\&.*//')" &&
390390
_assert_regex "${authorization_code_regex}" "${authorization_code}"; then

0 commit comments

Comments
 (0)