python-keystoneclient/keystoneclient
Tobias Diaz a0c67b860b Only log application/json content type
This is a combination of 2 commits. The first commit's
message is:

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 <samueldmq@gmail.com>

Closes-bug: 1616105

Change-Id: I8f43eee3a0b35041c6cf672e476f8151cf2f8d14
(cherry-picked from: 3e56e0d7e5)

Only log application/json in session to start

When whitelisting content types to debug print from session we chose
application/json and application/text. application/text is not a real
mime type, text is typically text/plain.

Rather than guess at mime types only print application/json to start
with, but make it easy for additional types to be added later.

Adapted from keystoneauth: Ica5fee076cdab8b1d5167161d28af7313fad9477
Related-Bug: 1616105

Change-Id: Ieaa8fb3ea8d25e09b89498f23b70b18c0f6153f1
(cherry-picked from: 51d16fa344)
2017-01-11 05:10:06 +00:00
..
auth Deprecate auth plugins from keystoneclient 2016-02-03 12:08:07 +11:00
common Address hacking check H405 2016-01-13 13:03:51 -08:00
contrib use positional library instead of utils 2016-01-25 01:54:35 -05:00
fixture use positional library instead of utils 2016-01-25 01:54:35 -05:00
generic Address hacking check H405 2016-01-13 13:03:51 -08:00
openstack remove oslo-incubator's memorycache 2015-12-14 00:43:04 -05:00
tests Only log application/json content type 2017-01-11 05:10:06 +00:00
v2_0 Missing defaults in the create() method in the v2 ServiceManager 2016-01-27 20:23:17 +00:00
v3 Support creation of domain specific roles 2016-02-19 11:48:27 +00:00
__init__.py Removes py26 support 2015-11-25 00:23:17 +00:00
_discover.py use positional library instead of utils 2016-01-25 01:54:35 -05:00
access.py Address hacking check H405 2016-01-13 13:03:51 -08:00
adapter.py Deprecate adapter 2016-02-03 12:08:07 +11:00
base.py Revert "Support `truncated` flag returned by identity service" 2016-02-26 21:39:00 +00:00
baseclient.py Deprecate the baseclient.Client 2015-12-17 12:04:17 +11:00
client.py Docstring: Mark optional parameter as optional. 2015-12-16 14:09:40 +05:30
discover.py use positional library instead of utils 2016-01-25 01:54:35 -05:00
exceptions.py Map keystoneclient exceptions to keystoneauth 2015-11-19 13:35:18 +11:00
httpclient.py Merge "Deprecate adapter" 2016-02-12 03:42:15 +00:00
i18n.py Change oslo.i18n to oslo_i18n 2015-02-09 20:34:49 -06:00
service_catalog.py use positional library instead of utils 2016-01-25 01:54:35 -05:00
session.py Only log application/json content type 2017-01-11 05:10:06 +00:00
shell.py Prompt for password on CLI if not provided 2015-05-02 14:09:22 +10:00
utils.py use positional library instead of utils 2016-01-25 01:54:35 -05:00