Skip to content

Commit

Permalink
Fixes compatibility with Ruby apps whose Gemfile.lock depends on base64
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Dec 6, 2024
1 parent 2a6c035 commit 6738c7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release 6.0.24 (Not yet released)
* [Enterprise] Fix a memory corruption-related crash that could occur during rolling restarting.
* [Ubuntu] Add packages for Ubuntu 24.10 "oracular".
* [Ruby] Specify rackup version to avoid broken 1.0 gem. Closes GH-2559.
* Fixes compatibility with Ruby apps whose Gemfile.lock depends on base64.
* Upgrades Boost from 1.85 -> 1.86.
* Updated various library versions used in precompiled binaries (used for e.g. gem installs):
- ccache 4.10.1 -> 4.10.2
Expand Down
20 changes: 5 additions & 15 deletions src/ruby_supportlib/phusion_passenger/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

require 'base64'

module PhusionPassenger

# Utility functions.
Expand Down Expand Up @@ -182,19 +180,11 @@ def install_options_as_ivars(object, options, *keys)
end
end

if Base64.respond_to?(:strict_encode64)
def base64(data)
Base64.strict_encode64(data)
end
else
# Base64-encodes the given data. Newlines are removed.
# This is like `Base64.strict_encode64`, but also works
# on Ruby 1.8 which doesn't have that method.
def base64(data)
result = Base64.encode64(data)
result.delete!("\n")
result
end
# Returns a base64 encoded string without line breaks and padding.
# Like Base64.strict_encode64, but without a dependency on the
# 'base64' library/gem.
def base64(data)
[data].pack("m0")
end

# Returns a string which reports the backtraces for all threads,
Expand Down

0 comments on commit 6738c7b

Please sign in to comment.