From ec0ef566f69bd66cc2cebd580d038d219e0b9fa6 Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Mon, 4 Dec 2023 19:32:39 +0100
Subject: [PATCH] FIX: Header too long

---
 CHANGELOG.md                           | 1 +
 src/linkahead/connection/connection.py | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 62b74939..c73d60f9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Fixed ###
 
 - [#113](https://gitlab.com/linkahead/linkahead-pylib/-/issues/113) Container could fail to delete when there were reference properties.
+- HTTP status 431 (Headers too long) now also raises an URI too long exception.
 
 ### Security ###
 
diff --git a/src/linkahead/connection/connection.py b/src/linkahead/connection/connection.py
index db6b66f1..91b4a01d 100644
--- a/src/linkahead/connection/connection.py
+++ b/src/linkahead/connection/connection.py
@@ -509,7 +509,8 @@ def _handle_response_status(http_response):
         raise LoginFailedError(standard_message)
     elif status == 403:
         raise HTTPForbiddenError(standard_message)
-    elif status in (413, 414):
+    elif status in (413, 414, 431):
+        # Content (413), URI (414) or complete HTTP headers (URI+headers) (431) too long
         raise HTTPURITooLongError(standard_message)
     elif 399 < status < 500:
         raise HTTPClientError(msg=standard_message, status=status, body=body)
-- 
GitLab