-
Notifications
You must be signed in to change notification settings - Fork 14
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
Declare base64 as a dependency #30
Conversation
This is starting to get crazy, why not eat the dependency? |
🤷 I've made PRs to remove Removing this from ruby itself seems like a mistake. It's such basic functionality that I'm flabbergasted that there are no methods for it on I would prefer not relying on base64 for such trivial functionality in half my gems I depend on, though I have already improved the situation there in other gems already. In the end its your decision how to handle this. |
I'm not the maintainer of rack-session so it is not my decision to make here, but for the gems I maintain, I have chosen to rely on the dependency. I can see the point of inlining when it is just one or two |
@Earlopain Do you not want to have the |
I just like to have a small dependency graph. Relying on a dependency for just a single method like in racks example seems like something that I'd see in JavaScript. In my uneducated opinion security concerns are non-existant for this implementation. I understand that its a bit more complicated here and I'm somewhat happy either way if rack-session doesn't break in the future with Ruby 3.4. If so, maintainers here can feel free to close and just add it to the gemspec. There is also sidekiq/sidekiq@49389da that sidekiq did by simplifying the implementation of the urlsafe methods which would bring it closer to just being a wrapper again. Though I don't know enough about internals here to say if that is fine to do. |
I guess you aren't running Rails 7.1 yet? It will bring |
I'm aware, yes. I haven't tried make a PR there, a bit hypocritical if you ask me. Anyways, not everyone uses rails with rack so relying on that on pulling in the dependency doesn't work. They might also decide to remove it in the future. mutex_m for example has been replaced after that PR already. I added it to the gemspec here instead as well. |
Thanks for the great discussion. I don't think we want to rewrite base64 here. |
base64 will be removed from the default gems in Ruby 3.4, see rack/rack#2110
Since this uses base64 in more than just one place I created a module containing the needed methods instead. That way usage is clear and easy to follow.
Because this basically copies the whole of https://github.com/ruby/base64/blob/master/lib/base64.rb (sans docs) I have included their license in the file. I wouldn't have bothered for just the pack/unpack wrappers but the url encode/decode methods are a bit more involved.
The newrelic gem is one where I have taken the similar approach to this if you are interested: newrelic/newrelic-ruby-agent#2378. In most other gems I was just able to do the same thing as in rack itself.