Allow customizing User-Agent header (HTTP only).

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

No files matched your search

+1
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)
+1 -1
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