From fb1177329cb740a69c9b26133c166c1f5725b235 Mon Sep 17 00:00:00 2001 From: puke <1129090915@qq.com> Date: Thu, 28 Mar 2024 13:08:37 +0800 Subject: [PATCH] Fix bug when v is None --- src/h2/utilities.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/h2/utilities.py b/src/h2/utilities.py index 3a7bf6e07..d5d525313 100644 --- a/src/h2/utilities.py +++ b/src/h2/utilities.py @@ -177,6 +177,8 @@ def authority_from_headers(headers): # user, so we may have unicode floating around in here. We only want # bytes. if n in (b':authority', u':authority'): + if v is None: + return None return v.encode('utf-8') if not isinstance(v, bytes) else v return None