From 4d60891531637aed2fdc50a5dff4809d7d9b3f32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Wed, 20 Sep 2023 15:28:37 +0200
Subject: [PATCH] [3.9] Support brotlicffi alternatively to brotli (#7611)
 (#7620)

---
 aiohttp/http_parser.py    | 5 ++++-
 tests/test_http_parser.py | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/aiohttp/http_parser.py b/aiohttp/http_parser.py
index 91e01f43..521ff5db 100644
--- a/aiohttp/http_parser.py
+++ b/aiohttp/http_parser.py
@@ -49,7 +49,10 @@ else:
     from typing_extensions import Literal
 
 try:
-    import brotli
+    try:
+        import brotlicffi as brotli
+    except ImportError:
+        import brotli
 
     HAS_BROTLI = True
 except ImportError:  # pragma: no cover
diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py
index 4b185c9e..dc373ea8 100644
--- a/tests/test_http_parser.py
+++ b/tests/test_http_parser.py
@@ -21,7 +21,10 @@ from aiohttp.http_parser import (
 )
 
 try:
-    import brotli
+    try:
+        import brotlicffi as brotli
+    except ImportError:
+        import brotli
 except ImportError:
     brotli = None
 
-- 
2.42.0

