We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using base64 strings in urls or http cookies we need to:
I've implemented encode_base64_url/1 and decode_base64_url/1 which return binary. Will you consider adding it?
encode_base64_url(Url) -> Url1 = base64:encode(Url), Url2 = re:replace(Url1, <<"=+$">>, <<"">>, [{return, binary}]), Url3 = binary:replace(Url2, <<"/">>, <<"_">>, [global]), binary:replace(Url3, <<"+">>, <<"-">>, [global]). decode_base64_url(Url64) when is_list(Url64) -> decode_base64_url(list_to_binary(Url64)); decode_base64_url(Url64) -> Url1 = binary:replace(Url64, <<"-">>, <<"+">>, [global]), Url2 = binary:replace(Url1, <<"_">>, <<"/">>, [global]), Padding = case byte_size(Url2) rem 4 of 2 -> <<"==">>; 3 -> <<"=">>; _ -> <<"">> end, base64:decode(<<Url2/binary, Padding/binary>>).
The text was updated successfully, but these errors were encountered:
+1 ... I'd like to see something like this added as well (I'm having to deal w/ base64 cookie values).
Sorry, something went wrong.
+1
+1 it fix my problem, tks.
Did you even look? This has been available since mochiweb 2.5.0 in the mochiweb_base64url module.
No branches or pull requests
When using base64 strings in urls or http cookies we need to:
http://en.wikipedia.org/wiki/Base64#URL_applications
I've implemented encode_base64_url/1 and decode_base64_url/1 which return binary.
Will you consider adding it?
The text was updated successfully, but these errors were encountered: