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

Add the file hash to the update link answer (bug 1158738) #527

Merged

Conversation

magopian
Copy link
Contributor

Fixes bug 1158738

I tried to keep the code as simple and straightforward as possible, as this service is critical and needs a high throughput. That's also why I didn't factorize with https://github.com/mozilla/olympia/pull/512/files#diff-833bbde9ea94ca5d1320b5b7e98b9994R105, and why I didn't use amo.utils.urlparams (we don't want to import that in this file).

@magopian magopian force-pushed the 1158738-add-file-hash-to-update-file-link branch from f82edd5 to f15338e Compare April 27, 2015 12:11
return posixpath.join(host, str(id), row['filename'])
url = posixpath.join(host, str(id), row['filename'])
params = urllib.urlencode({'filehash': row['hash']})
return '{0}?{1}'.format(url, params)
Copy link
Member

Choose a reason for hiding this comment

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

Is this just for cache busting? Or also for security checks? For cache busting it seems heavy to include the full sha and prefix? It's fine, computers don't mind, but the URL ends up being quite ugly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only for cache busting, the security is done elsewhere. What would you recommend?

Copy link
Member

Choose a reason for hiding this comment

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

You could truncate the hash at 8 characters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have absolutely nothing against that, but what would be the benefit? It's not a public facing url, it's the one that's answered to the client (Firefox) on automatic version update checks.

Copy link
Member

Choose a reason for hiding this comment

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

That's true I guess. Ok, computers don't mind ugly URLs.

@robhudson
Copy link
Member

r+

magopian added a commit that referenced this pull request Apr 28, 2015
…-file-link

Add the file hash to the update link answer (bug 1158738)
@magopian magopian merged commit 892825c into mozilla:master Apr 28, 2015
@magopian magopian deleted the 1158738-add-file-hash-to-update-file-link branch April 28, 2015 12:13
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.

3 participants