From 46ff5e725cf280a617986feb9c892e77340e8e60 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <bdrung@debian.org>
Date: Fri, 8 Jan 2021 00:39:00 +0100
Subject: Fix crash when authentication credentials are given

Bug: https://bugs.debian.org/978020
Forwarded: https://github.com/stackp/Droopy/pull/20
Signed-off-by: Benjamin Drung <bdrung@debian.org>
---
 droopy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/droopy b/droopy
index ed671b3..6f62e13 100755
--- a/droopy
+++ b/droopy
@@ -119,7 +119,7 @@ def check_auth(method):
         if self.auth:
             # TODO: Between minor versions this handles str/bytes differently
             received = self.get_case_insensitive_header('Authorization', None)
-            expected = 'Basic ' + base64.b64encode(self.auth)
+            expected = 'Basic ' + base64.b64encode(self.auth.encode("utf-8")).decode("utf-8")
             # TODO: Timing attack?
             if received != expected:
                 self.send_response(401)
-- 
2.27.0

