Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions lib/protocol/http/header/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# Released under the MIT License.
# Copyright, 2019-2023, by Samuel Williams.

require 'base64'

module Protocol
module HTTP
module Header
Expand All @@ -21,10 +19,10 @@ def credentials
end

def self.basic(username, password)
encoded = "#{username}:#{password}"
strict_base64_encoded = ["#{username}:#{password}"].pack('m0')

self.new(
"Basic #{Base64.strict_encode64(encoded)}"
"Basic #{strict_base64_encoded}"
)
end
end
Expand Down
2 changes: 0 additions & 2 deletions protocol-http.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ Gem::Specification.new do |spec|
spec.files = Dir.glob(['{lib}/**/*', '*.md'], File::FNM_DOTMATCH, base: __dir__)

spec.required_ruby_version = ">= 3.0"

spec.add_dependency "base64"
end