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

Fix generate_url() AttributeError when using anonymous connections #3734

Merged
merged 1 commit into from Jun 28, 2017

Conversation

Projects
None yet
2 participants
@edmorley
Copy link
Contributor

edmorley commented May 25, 2017

Previously generating a URL would fail for anonymous connections (even when using query_auth=False), with:
AttributeError: 'AnonAuthHandler' object has no attribute '_hmac_256'

That now works, and in addition the query_auth=False parameter is now optional for anonymous connections.

Fixes #1540.

Fix generate_url() AttributeError when using anonymous connections
Previously generating a URL would fail for anonymous connections
(even when using `query_auth=False`), with:
`AttributeError: 'AnonAuthHandler' object has no attribute '_hmac_256'`

That now works, and in addition the `query_auth=False` parameter
is now optional for anonymous connections.

Fixes #1540.

@edmorley edmorley force-pushed the edmorley:anon-generate_url branch from eeb5115 to 9c2fc7e May 25, 2017

@edmorley

This comment has been minimized.

Copy link
Contributor

edmorley commented Jun 28, 2017

@mfschwartz - I don't suppose you'd mind reviewing this? :-)


def test_generate_url(self):
conn = self.connection_class(
anon=True,

This comment has been minimized.

@mfschwartz

mfschwartz Jun 28, 2017

Member

Is there another test for that exercises that the non-anonymous case generates a URL as expected?

This comment has been minimized.

@edmorley

edmorley Jun 28, 2017

Contributor

Yeah, the existing tests here (since anon defaults to False):

url_enabled = conn.generate_url(86400, 'GET', bucket='examplebucket',
key='test.txt', query_auth=True)
url_disabled = conn.generate_url(86400, 'GET', bucket='examplebucket',
key='test.txt', query_auth=False)
self.assertIn('Signature=', url_enabled)
self.assertNotIn('Signature=', url_disabled)

url_enabled = conn.generate_url(86400, 'GET', bucket='examplebucket',
key='test.txt', query_auth=True)
url_disabled = conn.generate_url(86400, 'GET', bucket='examplebucket',
key='test.txt', query_auth=False)
self.assertIn('Signature=', url_enabled)
self.assertNotIn('Signature=', url_disabled)

This comment has been minimized.

@mfschwartz

mfschwartz Jun 28, 2017

Member

Ok, thanks. LGTM.

@mfschwartz mfschwartz merged commit 8348180 into boto:develop Jun 28, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@edmorley edmorley deleted the edmorley:anon-generate_url branch Jun 28, 2017

@edmorley

This comment has been minimized.

Copy link
Contributor

edmorley commented Jun 28, 2017

Many thanks! 👍

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