Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to reading 0 bytes if readable is not implemented. #513

Merged
merged 1 commit into from Aug 10, 2020

Conversation

kleesc
Copy link
Member

@kleesc kleesc commented Aug 10, 2020

Gunicorn will wrap the wsgi stream in its own wrapper class (see class Body).
This class is not compliant with the file-object api from Python (missing readable).

This issue never showed up before because of
https://github.com/quay/quay/blob/master/storage/swift.py#L418 always evaluating to False in Python2 which
was fixed by #508.

Issue: https://issues.redhat.com/browse/PROJQUAY-941

Changelog:

Docs:

Testing:

Details:

fileobj = BytesIO(b"this will not really be a real fileobj")
body = Body(fileobj)
ls = LimitingStream(body)
assert ls.readable()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execute a read as well, and ensure it finds the correct data and is limited

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Gunicorn will wrap the wsgi stream in its own wrapper class (see `class Body`).
This class is not compliant with the file-object api from Python (missing `readable`).

This issue never showed up before because of
https://github.com/quay/quay/blob/master/storage/swift.py#L418 always
evaluating to False in Python2, which was fixed by
quay#508.
@kleesc kleesc force-pushed the filelike-for-gunicorn-wsgi-wrap branch from baae1e9 to 3eea33d Compare August 10, 2020 17:41
Copy link
Contributor

@josephschorr josephschorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kleesc kleesc merged commit 4f58a2e into quay:master Aug 10, 2020
@kleesc kleesc deleted the filelike-for-gunicorn-wsgi-wrap branch August 10, 2020 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants