diff --git a/pyproject.toml b/pyproject.toml index 767db31..90a378d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ inspect = [ ] # Empreinte TLS Chrome (curl_cffi) et décompression br tls = [ - "curl_cffi>=0.15,<0.17", # 0.17 n'envoie plus l'en-tête User-Agent de l'empreinte imitée + "curl_cffi>=0.15,<0.18", # 0.17 : en-têtes de l'empreinte en minuscules (Chrome 152) "brotli>=1.2.1", ] # Gestes humains et préparation des profils (warmup, gestes) diff --git a/tests/test_tls_fingerprint.py b/tests/test_tls_fingerprint.py index 17c882c..192d1c0 100644 --- a/tests/test_tls_fingerprint.py +++ b/tests/test_tls_fingerprint.py @@ -30,16 +30,18 @@ def test_imitation_lit_une_page(): def test_imitation_envoie_une_empreinte_de_navigateur(): - seen = {} + # Noms d'en-têtes lus sans la casse : depuis curl_cffi 0.17, l'empreinte Chrome 152 + # les envoie en minuscules (« user-agent »). + seen = httpx.Headers() def h(req): - seen.update(req.headers) + seen.update(list(req.headers.items())) _send(req, 200, b"ok", {"Content-Type": "text/plain"}) with LocalServer({"/": h}) as s: asyncio.run(_http.aimpersonate_get(s.url("/"), headers={"Accept": "text/html"})) assert "Chrome" in seen.get("User-Agent", "") - assert seen.get("Accept") == "text/html" + assert seen.get_list("Accept") == ["text/html"] # celui de l'appelant, sans doublon de l'empreinte def test_imitation_garde_chaque_redirection(monkeypatch):