From aef6d5f76623b99aacf61957d3f4ccda7af74a85 Mon Sep 17 00:00:00 2001 From: rulingcom Date: Sat, 24 Feb 2024 12:07:49 +0800 Subject: [PATCH] Use strict Base64 encoding to prevent bad requests. --- lib/proxifier/proxies/http.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/proxifier/proxies/http.rb b/lib/proxifier/proxies/http.rb index da1cbd7..2305db9 100644 --- a/lib/proxifier/proxies/http.rb +++ b/lib/proxifier/proxies/http.rb @@ -8,7 +8,7 @@ module Proxifier socket << "CONNECT #{host}:#{port} HTTP/1.1\r\n" socket << "Host: #{host}:#{port}\r\n" - socket << "Proxy-Authorization: Basic #{["#{user}:#{password}"].pack("m").chomp}\r\n" if user + socket << "Proxy-Authorization: Basic #{Base64.strict_encode64("#{user}:#{password}").chomp}\r\n" if user socket << "User-Agent: #{user_agent}\r\n" if user_agent socket << "\r\n"