lib/ronin/web.rb in ronin-web-1.0.0.beta1 vs lib/ronin/web.rb in ronin-web-1.0.0.beta2

- old
+ new

@@ -1,9 +1,9 @@ # # ronin-web - A collection of useful web helper methods and commands. # -# Copyright (c) 2006-2022 Hal Brodigan (postmodern.mod3 at gmail.com) +# Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com) # # ronin-web is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. @@ -193,29 +193,29 @@ # # @see http://rubydoc.info/stdlib/open-uri # # @api public # - def self.open(url, proxy: Web.proxy, - user_agent: Web.user_agent, + def self.open(url, proxy: Support::Network::HTTP.proxy, + user_agent: Support::Network::HTTP.user_agent, referer: nil, cookie: nil, **kwargs) - headers = {} + options = {proxy: proxy, **kwargs} if user_agent - headers['User-Agent'] = case user_agent + options['User-Agent'] = case user_agent when Symbol Support::Network::HTTP::UserAgents[user_agent] else user_agent end end - headers['Referer'] = referer if referer - headers['Cookie'] = cookie if cookie + options['Referer'] = referer if referer + options['Cookie'] = cookie if cookie - return URI.open(url, headers, proxy: proxy, **kwargs) + return URI.open(url,options) end # # A persistent Mechanize Agent. #