Allow customizing User-Agent header (HTTP only).

This commit is contained in:
rulingcom 2024-02-24 12:01:29 +08:00
parent bf1f0bee18
commit 1d9659309b
2 changed files with 2 additions and 1 deletions

View File

@ -9,6 +9,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 << "User-Agent: #{user_agent}\r\n" if user_agent
socket << "\r\n"
buffer = Net::BufferedIO.new(socket)

View File

@ -51,7 +51,7 @@ module Proxifier
@query_options ||= query ? Hash[query.split("&").map { |q| q.split("=") }] : {}
end
%w(no_proxy).each do |option|
%w(no_proxy user_agent).each do |option|
class_eval "def #{option}; options[:#{option}] end"
end