Module: Ronin::Network::Mixins::HTTP
Overview
Adds HTTP convenience methods and connection parameters to a class.
Defines the following parameters:
host(String) - HTTP host.port(Integer) - HTTP port. Defaults toNet::HTTP.default_port.http_vhost(String) - HTTP Host header to send.http_user(String) - HTTP user to authenticate as.http_password(String) - HTTP password to authenticate with.http_proxy- HTTP proxy information.http_user_agent(String) - HTTP User-Agent header to send.
Class Method Summary (collapse)
-
+ (Object) host
HTTP host.
-
+ (Object) host=(value)
HTTP host.
-
+ (Object) http_password
HTTP password to authenticate with.
-
+ (Object) http_password=(value)
HTTP password to authenticate with.
-
+ (Object) http_proxy
HTTP proxy information.
-
+ (Object) http_proxy=(value)
HTTP proxy information.
-
+ (Object) http_user
HTTP user to authenticate as.
-
+ (Object) http_user=(value)
HTTP user to authenticate as.
-
+ (Object) http_user_agent
HTTP
User-Agentheader to send. -
+ (Object) http_user_agent=(value)
HTTP
User-Agentheader to send. -
+ (Object) http_vhost
HTTP
Hostheader to send. -
+ (Object) http_vhost=(value)
HTTP
Hostheader to send. -
+ (Object) port
HTTP port.
-
+ (Object) port=(value)
HTTP port.
Instance Method Summary (collapse)
-
- (Object) disable_http_proxy
protected
Resets the HTTP proxy settings.
-
- (Object) host
HTTP host.
-
- (Object) host=(value)
HTTP host.
-
- (Net::HTTP) http_connect(options = {}) {|http| ... }
protected
Starts a HTTP connection with the server.
-
- (Object) http_password
HTTP password to authenticate with.
-
- (Object) http_password=(value)
HTTP password to authenticate with.
-
- (Object) http_proxy
HTTP proxy information.
-
- (Object) http_proxy=(value)
HTTP proxy information.
-
- (Net::HTTP::Response) http_request(options = {}) {|request, (options)| ... }
protected
Connects to the HTTP server and sends an HTTP Request.
-
- (Object) http_user
HTTP user to authenticate as.
-
- (Object) http_user=(value)
HTTP user to authenticate as.
-
- (Object) http_user_agent
HTTP
User-Agentheader to send. -
- (Object) http_user_agent=(value)
HTTP
User-Agentheader to send. -
- (Object) http_vhost
HTTP
Hostheader to send. -
- (Object) http_vhost=(value)
HTTP
Hostheader to send. -
- (Object) port
HTTP port.
-
- (Object) port=(value)
HTTP port.
Methods included from Mixin
Methods included from HTTP
expand_options, expand_url, header_name, headers, #http_copy, #http_delete, #http_get, #http_get_body, #http_get_headers, #http_head, #http_lock, #http_mkcol, #http_move, #http_ok?, #http_options, #http_post, #http_post_body, #http_post_headers, #http_powered_by, #http_prop_find, #http_prop_patch, #http_put, #http_server, #http_session, #http_status, #http_trace, #http_unlock, proxy, proxy=, request, user_agent, user_agent=
Class Method Details
+ (Object) host
HTTP host
43 44 |
# File 'lib/ronin/network/mixins/http.rb', line 43 parameter :host, :type => String, :description => 'HTTP host' |
+ (Object) host=(value)
HTTP host
43 44 |
# File 'lib/ronin/network/mixins/http.rb', line 43 parameter :host, :type => String, :description => 'HTTP host' |
+ (Object) http_password
HTTP password to authenticate with
59 60 |
# File 'lib/ronin/network/mixins/http.rb', line 59 parameter :http_password, :type => String, :description => 'HTTP password to authenticate with' |
+ (Object) http_password=(value)
HTTP password to authenticate with
59 60 |
# File 'lib/ronin/network/mixins/http.rb', line 59 parameter :http_password, :type => String, :description => 'HTTP password to authenticate with' |
+ (Object) http_proxy
HTTP proxy information
63 |
# File 'lib/ronin/network/mixins/http.rb', line 63 parameter :http_proxy, :description => 'HTTP proxy information' |
+ (Object) http_proxy=(value)
HTTP proxy information
63 |
# File 'lib/ronin/network/mixins/http.rb', line 63 parameter :http_proxy, :description => 'HTTP proxy information' |
+ (Object) http_user
HTTP user to authenticate as
55 56 |
# File 'lib/ronin/network/mixins/http.rb', line 55 parameter :http_user, :type => String, :description => 'HTTP user to authenticate as' |
+ (Object) http_user=(value)
HTTP user to authenticate as
55 56 |
# File 'lib/ronin/network/mixins/http.rb', line 55 parameter :http_user, :type => String, :description => 'HTTP user to authenticate as' |
+ (Object) http_user_agent
HTTP User-Agent header to send
66 67 |
# File 'lib/ronin/network/mixins/http.rb', line 66 parameter :http_user_agent, :type => String, :description => 'HTTP User-Agent header to send' |
+ (Object) http_user_agent=(value)
HTTP User-Agent header to send
66 67 |
# File 'lib/ronin/network/mixins/http.rb', line 66 parameter :http_user_agent, :type => String, :description => 'HTTP User-Agent header to send' |
+ (Object) http_vhost
HTTP Host header to send
51 52 |
# File 'lib/ronin/network/mixins/http.rb', line 51 parameter :http_vhost, :type => String, :description => 'HTTP Host header to send' |
+ (Object) http_vhost=(value)
HTTP Host header to send
51 52 |
# File 'lib/ronin/network/mixins/http.rb', line 51 parameter :http_vhost, :type => String, :description => 'HTTP Host header to send' |
+ (Object) port
HTTP port
47 48 |
# File 'lib/ronin/network/mixins/http.rb', line 47 parameter :port, :default => Net::HTTP.default_port, :description => 'HTTP port' |
+ (Object) port=(value)
HTTP port
47 48 |
# File 'lib/ronin/network/mixins/http.rb', line 47 parameter :port, :default => Net::HTTP.default_port, :description => 'HTTP port' |
Instance Method Details
- (Object) disable_http_proxy (protected)
Resets the HTTP proxy settings.
76 77 78 |
# File 'lib/ronin/network/mixins/http.rb', line 76 def disable_http_proxy @http_proxy = nil end |
- (Object) host
HTTP host
43 44 |
# File 'lib/ronin/network/mixins/http.rb', line 43 parameter :host, :type => String, :description => 'HTTP host' |
- (Object) host=(value)
HTTP host
43 44 |
# File 'lib/ronin/network/mixins/http.rb', line 43 parameter :host, :type => String, :description => 'HTTP host' |
- (Net::HTTP) http_connect(options = {}) {|http| ... } (protected)
Starts a HTTP connection with the server.
127 128 129 |
# File 'lib/ronin/network/mixins/http.rb', line 127 def http_connect(={},&block) super((),&block) end |
- (Object) http_password
HTTP password to authenticate with
59 60 |
# File 'lib/ronin/network/mixins/http.rb', line 59 parameter :http_password, :type => String, :description => 'HTTP password to authenticate with' |
- (Object) http_password=(value)
HTTP password to authenticate with
59 60 |
# File 'lib/ronin/network/mixins/http.rb', line 59 parameter :http_password, :type => String, :description => 'HTTP password to authenticate with' |
- (Object) http_proxy
HTTP proxy information
63 |
# File 'lib/ronin/network/mixins/http.rb', line 63 parameter :http_proxy, :description => 'HTTP proxy information' |
- (Object) http_proxy=(value)
HTTP proxy information
63 |
# File 'lib/ronin/network/mixins/http.rb', line 63 parameter :http_proxy, :description => 'HTTP proxy information' |
- (Net::HTTP::Response) http_request(options = {}) {|request, (options)| ... } (protected)
Connects to the HTTP server and sends an HTTP Request.
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/ronin/network/mixins/http.rb', line 160 def http_request(={},&block) response = super() do |request,| if block if block.arity == 2 block.call(request,) else block.call(request) end end host = .fetch(:host,self.host) port = .fetch(:port,self.port) print_info "HTTP #{request.method} #{host}:#{port} #{request.path}" request.each_capitalized do |name,value| print_debug " #{name}: #{value}" end end print_info "HTTP #{response.code} #{response.}" response.each_capitalized do |name,value| print_debug " #{name}: #{value}" end return response end |
- (Object) http_user
HTTP user to authenticate as
55 56 |
# File 'lib/ronin/network/mixins/http.rb', line 55 parameter :http_user, :type => String, :description => 'HTTP user to authenticate as' |
- (Object) http_user=(value)
HTTP user to authenticate as
55 56 |
# File 'lib/ronin/network/mixins/http.rb', line 55 parameter :http_user, :type => String, :description => 'HTTP user to authenticate as' |
- (Object) http_user_agent
HTTP User-Agent header to send
66 67 |
# File 'lib/ronin/network/mixins/http.rb', line 66 parameter :http_user_agent, :type => String, :description => 'HTTP User-Agent header to send' |
- (Object) http_user_agent=(value)
HTTP User-Agent header to send
66 67 |
# File 'lib/ronin/network/mixins/http.rb', line 66 parameter :http_user_agent, :type => String, :description => 'HTTP User-Agent header to send' |
- (Object) http_vhost
HTTP Host header to send
51 52 |
# File 'lib/ronin/network/mixins/http.rb', line 51 parameter :http_vhost, :type => String, :description => 'HTTP Host header to send' |
- (Object) http_vhost=(value)
HTTP Host header to send
51 52 |
# File 'lib/ronin/network/mixins/http.rb', line 51 parameter :http_vhost, :type => String, :description => 'HTTP Host header to send' |
- (Object) port
HTTP port
47 48 |
# File 'lib/ronin/network/mixins/http.rb', line 47 parameter :port, :default => Net::HTTP.default_port, :description => 'HTTP port' |
- (Object) port=(value)
HTTP port
47 48 |
# File 'lib/ronin/network/mixins/http.rb', line 47 parameter :port, :default => Net::HTTP.default_port, :description => 'HTTP port' |