File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ Gem::Specification.new do |gem|
28
28
gem . required_ruby_version = ">= 3.0"
29
29
30
30
gem . add_runtime_dependency "addressable" , "~> 2.8"
31
- gem . add_runtime_dependency "base64" , "~> 0.2"
32
31
gem . add_runtime_dependency "http-cookie" , "~> 1.0"
33
32
gem . add_runtime_dependency "http-form_data" , "~> 2.2"
34
33
gem . add_runtime_dependency "llhttp-ffi" , "~> 0.5.0"
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ module HTTP
4
+ module Base64
5
+ module_function
6
+
7
+ # Equivalent to Base64.strict_encode64
8
+ def encode64 ( input )
9
+ [ input ] . pack ( "m0" )
10
+ end
11
+ end
12
+ end
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- require "base64"
4
-
3
+ require "http/base64"
5
4
require "http/headers"
6
5
7
6
module HTTP
8
7
module Chainable
8
+ include HTTP ::Base64
9
+
9
10
# Request a get sans response body
10
11
# @param uri
11
12
# @option options [Hash]
@@ -215,7 +216,7 @@ def basic_auth(opts)
215
216
pass = opts . fetch ( :pass )
216
217
creds = "#{ user } :#{ pass } "
217
218
218
- auth ( "Basic #{ Base64 . strict_encode64 ( creds ) } " )
219
+ auth ( "Basic #{ encode64 ( creds ) } " )
219
220
end
220
221
221
222
# Get options for HTTP
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
require "forwardable"
4
- require "base64"
5
4
require "time"
6
5
6
+ require "http/base64"
7
7
require "http/errors"
8
8
require "http/headers"
9
9
require "http/request/body"
@@ -15,6 +15,7 @@ module HTTP
15
15
class Request
16
16
extend Forwardable
17
17
18
+ include HTTP ::Base64
18
19
include HTTP ::Headers ::Mixin
19
20
20
21
# The method given was not understood
@@ -159,7 +160,7 @@ def include_proxy_authorization_header
159
160
end
160
161
161
162
def proxy_authorization_header
162
- digest = Base64 . strict_encode64 ( "#{ proxy [ :proxy_username ] } :#{ proxy [ :proxy_password ] } " )
163
+ digest = encode64 ( "#{ proxy [ :proxy_username ] } :#{ proxy [ :proxy_password ] } " )
163
164
"Basic #{ digest } "
164
165
end
165
166
You can’t perform that action at this time.
0 commit comments