Sha256: b2b30c9ee69b0559d218125b868954bf7c35febce9aa4b2f4342a0e95e5d4b3f

Contents?: true

Size: 464 Bytes

Versions: 27

Compression:

Stored size: 464 Bytes

Contents

# frozen_string_literal: true

require "base64"

module HTTPX
  module Plugins
    module Authentication
      class Socks5
        def initialize(user, password, **)
          @user = user
          @password = password
        end

        def can_authenticate?(*)
          @user && @password
        end

        def authenticate(*)
          [0x01, @user.bytesize, @user, @password.bytesize, @password].pack("CCA*CA*")
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
httpx-0.24.7 lib/httpx/plugins/authentication/socks5.rb
httpx-0.24.6 lib/httpx/plugins/authentication/socks5.rb
httpx-0.24.5 lib/httpx/plugins/authentication/socks5.rb
httpx-0.24.4 lib/httpx/plugins/authentication/socks5.rb
httpx-0.24.3 lib/httpx/plugins/authentication/socks5.rb
httpx-0.24.2 lib/httpx/plugins/authentication/socks5.rb
httpx-0.24.1 lib/httpx/plugins/authentication/socks5.rb
httpx-0.24.0 lib/httpx/plugins/authentication/socks5.rb
httpx-0.23.4 lib/httpx/plugins/authentication/socks5.rb
httpx-0.23.3 lib/httpx/plugins/authentication/socks5.rb
httpx-0.23.2 lib/httpx/plugins/authentication/socks5.rb
httpx-0.23.1 lib/httpx/plugins/authentication/socks5.rb
httpx-0.23.0 lib/httpx/plugins/authentication/socks5.rb
httpx-0.22.5 lib/httpx/plugins/authentication/socks5.rb
httpx-0.22.4 lib/httpx/plugins/authentication/socks5.rb
httpx-0.22.3 lib/httpx/plugins/authentication/socks5.rb
httpx-0.22.2 lib/httpx/plugins/authentication/socks5.rb
httpx-0.22.1 lib/httpx/plugins/authentication/socks5.rb
httpx-0.22.0 lib/httpx/plugins/authentication/socks5.rb
httpx-0.21.1 lib/httpx/plugins/authentication/socks5.rb