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

Use Base64.strict_encode64 instead of Base64.encode64. #283

Merged
merged 1 commit into from
Mar 26, 2015

Conversation

wtcross
Copy link
Contributor

@wtcross wtcross commented Mar 26, 2015

Currently, when encoding a basic authorization header passed as an array Base64.encode64 is used. This is fine as long as the username and password being encoded are under 60 characters combined. Base64.encode64 inserts line feeds every 60 encoded characters.

This pull request simply uses Base64.strict_encode64 anywhere that Base64.encode64 was previously used. This behaves the same way, but without the insertion of line feeds every 60 encoded characters.

- Base64.encode64 adds line feeds every 60 encoded characters
- Base64.strict_encode64 does not insert line feeds, so use it
@wtcross
Copy link
Contributor Author

wtcross commented Mar 26, 2015

Most decoders will ignore whitespace, but not all of them.

igrigorik added a commit that referenced this pull request Mar 26, 2015
Use Base64.strict_encode64 instead of Base64.encode64.
@igrigorik igrigorik merged commit 7b8d47c into igrigorik:master Mar 26, 2015
@igrigorik
Copy link
Owner

That's a fun gotcha.. Thanks for the fix!

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.

2 participants