From 3e56e0d7e5e1a76d806a3bc1f6d5ef9070f95771 Mon Sep 17 00:00:00 2001 From: Tobias Diaz Date: Tue, 23 Aug 2016 17:13:24 +0200 Subject: Prevent MemoryError when logging response bodies Response bodies are loaded into memory prior to being logged. Loading huge response bodies may result in a MemoryError. This patch proposes that only JSON and TEXT responses be logged, i.e when the Content-Type header is application/json or application/text. Responses that do not include or have a different Content-Type header will have their body omitted. This is a sort of backport of the fix for keystoneauth sessions, see I93b6fff73368c4f58bdebf8566c4948b50980cee Co-Authored-By: Samuel de Medeiros Queiroz Closes-bug: 1616105 Change-Id: I8f43eee3a0b35041c6cf672e476f8151cf2f8d14 --- releasenotes/notes/bug-1616105-cc8b85eb056e99e2.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 releasenotes/notes/bug-1616105-cc8b85eb056e99e2.yaml (limited to 'releasenotes') diff --git a/releasenotes/notes/bug-1616105-cc8b85eb056e99e2.yaml b/releasenotes/notes/bug-1616105-cc8b85eb056e99e2.yaml new file mode 100644 index 0000000..91529c6 --- /dev/null +++ b/releasenotes/notes/bug-1616105-cc8b85eb056e99e2.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - > + [`bug 1616105 `_] + Only log the response body when the ``Content-Type`` header is set to + ``application/json`` or ``application/text``. This avoids logging large + binary objects (such as images). Other ``Content-Type`` will not be + logged. -- cgit v1.2.1