Skip to content

fix(parser): handle StreamingChecksumBody in generic error response detection#3680

Open
armorbreak001 wants to merge 1 commit intoboto:developfrom
armorbreak001:fix/streaming-checksum-body-strip-error
Open

fix(parser): handle StreamingChecksumBody in generic error response detection#3680
armorbreak001 wants to merge 1 commit intoboto:developfrom
armorbreak001:fix/streaming-checksum-body-strip-error

Conversation

@armorbreak001
Copy link
Copy Markdown

Summary

When response checksums are enabled (e.g. FlexibleChecksumStrategy), the response body is wrapped in a StreamingChecksumBody object. This object extends StreamingBody and does not have a strip() method.

```_is_generic_error_response()`` calls response['body'].strip() unconditionally, which raises:

AttributeError: 'StreamingChecksumBody' object has no attribute 'strip'

Changes

Read the body via .read() first when it lacks a strip() method before calling .strip(). This is safe for error responses (status >= 500) where the body is only needed to detect generic HTML error pages.

Fixes boto/boto3#4754
Related: boto/boto3#4765

…etection

When response checksums are enabled, response body is wrapped in
StreamingChecksumBody which lacks a strip() method. Read the body
first before calling strip() to avoid AttributeError.

Fixes #4754
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: 'StreamingChecksumBody' object has no attribute 'strip'

1 participant