ronin 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +95 -0
- data/Manifest.txt +55 -25
- data/README.txt +64 -52
- data/Rakefile +21 -14
- data/bin/ronin +1 -1
- data/bin/ronin-add +1 -1
- data/bin/ronin-console +1 -1
- data/bin/ronin-help +1 -1
- data/bin/ronin-install +1 -1
- data/bin/ronin-list +1 -1
- data/bin/ronin-remove +1 -1
- data/bin/ronin-uninstall +1 -1
- data/bin/ronin-update +1 -1
- data/lib/ronin.rb +2 -4
- data/lib/ronin/arch.rb +66 -21
- data/lib/ronin/author.rb +27 -18
- data/lib/ronin/cacheable.rb +63 -23
- data/lib/ronin/code/emittable.rb +1 -4
- data/lib/ronin/code/reference.rb +2 -5
- data/lib/ronin/code/symbol_table.rb +1 -4
- data/lib/ronin/code/token.rb +1 -4
- data/lib/ronin/config.rb +31 -10
- data/lib/ronin/database.rb +1 -4
- data/lib/ronin/database/database.rb +42 -23
- data/lib/ronin/database/exceptions.rb +1 -4
- data/lib/ronin/database/exceptions/invalid_config.rb +1 -4
- data/lib/ronin/environment.rb +1 -5
- data/lib/ronin/extensions.rb +1 -5
- data/lib/ronin/extensions/array.rb +8 -6
- data/lib/ronin/extensions/file.rb +9 -4
- data/lib/ronin/extensions/ip_addr.rb +33 -13
- data/lib/ronin/extensions/kernel.rb +44 -9
- data/lib/ronin/extensions/meta.rb +1 -4
- data/lib/ronin/extensions/string.rb +8 -7
- data/lib/ronin/extensions/uri.rb +1 -4
- data/lib/ronin/extensions/uri/http.rb +1 -48
- data/lib/ronin/extensions/uri/query_params.rb +27 -8
- data/lib/ronin/formatting.rb +1 -4
- data/lib/ronin/formatting/binary.rb +1 -4
- data/lib/ronin/formatting/digest.rb +1 -4
- data/lib/ronin/formatting/extensions.rb +1 -4
- data/lib/ronin/formatting/extensions/binary.rb +1 -4
- data/lib/ronin/formatting/extensions/binary/file.rb +3 -28
- data/lib/ronin/formatting/extensions/binary/integer.rb +31 -12
- data/lib/ronin/formatting/extensions/binary/string.rb +59 -36
- data/lib/ronin/formatting/extensions/digest.rb +1 -4
- data/lib/ronin/formatting/extensions/digest/string.rb +31 -9
- data/lib/ronin/formatting/extensions/http.rb +1 -4
- data/lib/ronin/formatting/extensions/http/string.rb +16 -9
- data/lib/ronin/formatting/extensions/text.rb +1 -4
- data/lib/ronin/formatting/extensions/text/array.rb +17 -7
- data/lib/ronin/formatting/extensions/text/string.rb +70 -27
- data/lib/ronin/formatting/http.rb +1 -4
- data/lib/ronin/formatting/text.rb +1 -4
- data/lib/ronin/license.rb +72 -65
- data/lib/ronin/model.rb +1 -4
- data/lib/ronin/model/has_description.rb +37 -8
- data/lib/ronin/model/has_license.rb +12 -8
- data/lib/ronin/model/has_name.rb +10 -7
- data/lib/ronin/model/has_version.rb +14 -4
- data/lib/ronin/model/model.rb +71 -14
- data/lib/ronin/network.rb +1 -4
- data/lib/ronin/network/esmtp.rb +1 -4
- data/lib/ronin/network/extensions.rb +1 -4
- data/lib/ronin/network/extensions/esmtp.rb +1 -4
- data/lib/ronin/network/extensions/esmtp/net.rb +49 -21
- data/lib/ronin/network/extensions/http.rb +1 -4
- data/lib/ronin/network/extensions/http/net.rb +319 -531
- data/lib/ronin/network/extensions/imap.rb +1 -4
- data/lib/ronin/network/extensions/imap/net.rb +50 -23
- data/lib/ronin/network/extensions/pop3.rb +1 -4
- data/lib/ronin/network/extensions/pop3/net.rb +40 -17
- data/lib/ronin/network/extensions/smtp.rb +1 -4
- data/lib/ronin/network/extensions/smtp/net.rb +49 -21
- data/lib/ronin/network/extensions/tcp.rb +1 -4
- data/lib/ronin/network/extensions/tcp/net.rb +234 -31
- data/lib/ronin/network/extensions/telnet.rb +1 -4
- data/lib/ronin/network/extensions/telnet/net.rb +83 -51
- data/lib/ronin/network/extensions/udp.rb +1 -4
- data/lib/ronin/network/extensions/udp/net.rb +164 -27
- data/lib/ronin/{sessions.rb → network/helpers.rb} +10 -13
- data/lib/ronin/network/helpers/esmtp.rb +129 -0
- data/lib/ronin/{sessions/session.rb → network/helpers/helper.rb} +25 -17
- data/lib/ronin/network/helpers/http.rb +444 -0
- data/lib/ronin/network/helpers/imap.rb +115 -0
- data/lib/ronin/network/helpers/pop3.rb +110 -0
- data/lib/ronin/network/helpers/smtp.rb +123 -0
- data/lib/ronin/network/helpers/tcp.rb +309 -0
- data/lib/ronin/network/helpers/telnet.rb +158 -0
- data/lib/ronin/network/helpers/udp.rb +197 -0
- data/lib/ronin/network/http.rb +3 -156
- data/lib/ronin/network/http/exceptions.rb +1 -4
- data/lib/ronin/network/http/exceptions/unknown_request.rb +1 -4
- data/lib/ronin/network/http/http.rb +214 -0
- data/lib/ronin/network/http/proxy.rb +308 -0
- data/lib/ronin/network/imap.rb +7 -6
- data/lib/ronin/network/pop3.rb +7 -6
- data/lib/ronin/network/smtp.rb +1 -4
- data/lib/ronin/network/smtp/email.rb +34 -18
- data/lib/ronin/network/smtp/smtp.rb +19 -7
- data/lib/ronin/network/tcp.rb +1 -4
- data/lib/ronin/network/telnet.rb +25 -12
- data/lib/ronin/network/udp.rb +1 -4
- data/lib/ronin/os.rb +43 -21
- data/lib/ronin/path.rb +29 -9
- data/lib/ronin/platform.rb +1 -4
- data/lib/ronin/platform/exceptions.rb +1 -4
- data/lib/ronin/platform/exceptions/extension_not_found.rb +1 -4
- data/lib/ronin/platform/exceptions/overlay_cached.rb +1 -4
- data/lib/ronin/platform/exceptions/overlay_not_found.rb +1 -4
- data/lib/ronin/platform/extension.rb +195 -52
- data/lib/ronin/platform/extension_cache.rb +60 -24
- data/lib/ronin/platform/maintainer.rb +15 -8
- data/lib/ronin/platform/object_cache.rb +29 -8
- data/lib/ronin/platform/overlay.rb +82 -26
- data/lib/ronin/platform/overlay_cache.rb +179 -56
- data/lib/ronin/platform/platform.rb +154 -58
- data/lib/ronin/platform/ronin.rb +38 -11
- data/lib/ronin/product.rb +17 -17
- data/lib/ronin/rpc.rb +1 -4
- data/lib/ronin/rpc/call.rb +1 -4
- data/lib/ronin/rpc/client.rb +1 -4
- data/lib/ronin/rpc/console.rb +1 -4
- data/lib/ronin/rpc/exceptions.rb +1 -4
- data/lib/ronin/rpc/exceptions/not_implemented.rb +1 -4
- data/lib/ronin/rpc/exceptions/response_missing.rb +1 -4
- data/lib/ronin/rpc/response.rb +1 -4
- data/lib/ronin/rpc/service.rb +1 -4
- data/lib/ronin/rpc/shell.rb +1 -4
- data/lib/ronin/scanners.rb +1 -4
- data/lib/ronin/scanners/exceptions.rb +1 -4
- data/lib/ronin/scanners/exceptions/unknown_category.rb +1 -4
- data/lib/ronin/scanners/scanner.rb +82 -26
- data/lib/ronin/static.rb +1 -4
- data/lib/ronin/static/finders.rb +1 -4
- data/lib/ronin/static/static.rb +16 -7
- data/lib/ronin/templates.rb +2 -4
- data/lib/ronin/templates/erb.rb +24 -10
- data/lib/ronin/templates/template.rb +130 -0
- data/lib/ronin/ui.rb +2 -6
- data/lib/ronin/ui/command_line.rb +1 -4
- data/lib/ronin/ui/command_line/command.rb +137 -68
- data/lib/ronin/ui/command_line/command_line.rb +52 -29
- data/lib/ronin/ui/command_line/commands/add.rb +39 -67
- data/lib/ronin/ui/command_line/commands/console.rb +23 -27
- data/lib/ronin/ui/command_line/commands/help.rb +10 -29
- data/lib/ronin/ui/command_line/commands/install.rb +31 -56
- data/lib/ronin/ui/command_line/commands/list.rb +34 -52
- data/lib/ronin/ui/command_line/commands/remove.rb +12 -32
- data/lib/ronin/ui/command_line/commands/uninstall.rb +11 -31
- data/lib/ronin/ui/command_line/commands/update.rb +15 -35
- data/lib/ronin/ui/command_line/exceptions.rb +1 -4
- data/lib/ronin/ui/command_line/exceptions/unknown_command.rb +1 -4
- data/lib/ronin/ui/console.rb +54 -23
- data/lib/ronin/ui/hexdump.rb +1 -4
- data/lib/ronin/ui/hexdump/extensions.rb +1 -4
- data/lib/ronin/ui/hexdump/extensions/file.rb +8 -6
- data/lib/ronin/ui/hexdump/extensions/kernel.rb +4 -5
- data/lib/ronin/ui/hexdump/hexdump.rb +8 -5
- data/lib/ronin/{sessions/exceptions.rb → ui/output.rb} +3 -5
- data/lib/ronin/ui/output/handler.rb +121 -0
- data/lib/ronin/ui/output/helpers.rb +110 -0
- data/lib/ronin/ui/output/output.rb +144 -0
- data/lib/ronin/ui/shell.rb +38 -12
- data/lib/ronin/version.rb +2 -5
- data/lib/ronin/{sessions/exceptions/variable_missing.rb → yard.rb} +2 -10
- data/lib/ronin/{ronin.rb → yard/handlers.rb} +5 -15
- data/lib/ronin/yard/handlers/ruby.rb +27 -0
- data/lib/ronin/yard/handlers/ruby/base.rb +27 -0
- data/lib/ronin/yard/handlers/ruby/belongs_to_handler.rb +45 -0
- data/lib/ronin/yard/handlers/ruby/eval_block_handler.rb +18 -0
- data/lib/ronin/yard/handlers/ruby/has_handler.rb +49 -0
- data/lib/ronin/yard/handlers/ruby/legacy.rb +26 -0
- data/lib/ronin/yard/handlers/ruby/legacy/belongs_to_handler.rb +41 -0
- data/lib/ronin/yard/handlers/ruby/legacy/eval_block_handler.rb +19 -0
- data/lib/ronin/yard/handlers/ruby/legacy/has_handler.rb +34 -0
- data/lib/ronin/yard/handlers/ruby/legacy/metaclass_eval_handler.rb +21 -0
- data/lib/ronin/yard/handlers/ruby/legacy/property_handler.rb +41 -0
- data/lib/ronin/yard/handlers/ruby/legacy/scanner_handler.rb +61 -0
- data/lib/ronin/yard/handlers/ruby/metaclass_eval_handler.rb +18 -0
- data/lib/ronin/yard/handlers/ruby/property_handler.rb +45 -0
- data/lib/ronin/yard/handlers/ruby/scanner_handler.rb +66 -0
- data/spec/author_spec.rb +3 -3
- data/spec/extensions/classes/some_class.rb +2 -0
- data/spec/extensions/kernel_spec.rb +17 -0
- data/spec/extensions/uri/http_spec.rb +0 -31
- data/spec/formatting/binary/integer_spec.rb +4 -0
- data/spec/formatting/text/string_spec.rb +96 -0
- data/spec/license_spec.rb +6 -6
- data/spec/model/classes/basic_model.rb +13 -0
- data/spec/model/classes/custom_model.rb +17 -0
- data/spec/model/classes/described_model.rb +10 -0
- data/spec/model/has_description_spec.rb +42 -0
- data/spec/model/has_license_spec.rb +18 -4
- data/spec/model/model_spec.rb +68 -0
- data/spec/network/helpers/classes/test_helper.rb +11 -0
- data/spec/network/helpers/classes/uses_test_helper.rb +10 -0
- data/spec/network/helpers/helper_spec.rb +25 -0
- data/spec/network/{http_spec.rb → http/http_spec.rb} +0 -0
- data/spec/network/http/proxy_spec.rb +116 -0
- data/spec/os_spec.rb +4 -4
- data/spec/platform/extension_cache_spec.rb +14 -0
- data/spec/platform/extension_spec.rb +11 -0
- data/spec/platform/platform_spec.rb +8 -0
- data/spec/product_spec.rb +9 -9
- data/spec/spec_helper.rb +1 -1
- data/spec/templates/classes/{uses_erb.rb → example_erb.rb} +1 -1
- data/spec/templates/classes/example_template.rb +21 -0
- data/spec/templates/erb_spec.rb +2 -2
- data/spec/templates/helpers/static.rb +5 -0
- data/spec/templates/helpers/static/templates/_relative.erb +1 -0
- data/spec/templates/helpers/static/templates/example.erb +1 -0
- data/spec/templates/template_spec.rb +41 -0
- data/spec/ui/command_line/classes/test_command.rb +23 -0
- data/spec/ui/command_line/command_spec.rb +31 -0
- data/spec/ui/output_spec.rb +29 -0
- data/static/ronin/platform/overlay.xsl +135 -114
- data/tasks/spec.rb +1 -0
- data/tasks/yard.rb +18 -0
- metadata +98 -59
- metadata.gz.sig +0 -0
- data/TODO.txt +0 -15
- data/lib/ronin/extensions/hash.rb +0 -62
- data/lib/ronin/sessions/esmtp.rb +0 -57
- data/lib/ronin/sessions/http.rb +0 -678
- data/lib/ronin/sessions/imap.rb +0 -54
- data/lib/ronin/sessions/pop3.rb +0 -52
- data/lib/ronin/sessions/smtp.rb +0 -57
- data/lib/ronin/sessions/tcp.rb +0 -100
- data/lib/ronin/sessions/telnet.rb +0 -55
- data/lib/ronin/sessions/udp.rb +0 -73
- data/lib/ronin/ui/command_line/options.rb +0 -136
- data/lib/ronin/ui/diagnostics.rb +0 -66
- data/lib/ronin/ui/verbose.rb +0 -58
- data/spec/extensions/hash_spec.rb +0 -38
- data/spec/sessions/classes/test_session.rb +0 -11
- data/spec/sessions/classes/uses_test_session.rb +0 -10
- data/spec/sessions/session_spec.rb +0 -25
- data/spec/ui/verbose_spec.rb +0 -17
data/lib/ronin/network.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/tcp'
|
data/lib/ronin/network/esmtp.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/extensions/esmtp'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/extensions/tcp'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/extensions/esmtp/net'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,33 +16,51 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/extensions/smtp'
|
25
22
|
|
26
23
|
module Net
|
27
24
|
#
|
28
|
-
#
|
25
|
+
# @see Ronin::Network::SMTP.message
|
29
26
|
#
|
30
27
|
def Net.esmtp_message(options={},&block)
|
31
28
|
Net.smtp_message(options,&block)
|
32
29
|
end
|
33
30
|
|
34
31
|
#
|
35
|
-
#
|
36
|
-
# _options_. If a _block_ is given it will be passed the newly created
|
37
|
-
# <tt>Net::SMTP</tt> object.
|
32
|
+
# Creates a connection to the ESMTP server.
|
38
33
|
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
34
|
+
# @param [String] host
|
35
|
+
# The host to connect to.
|
36
|
+
#
|
37
|
+
# @param [Hash] options
|
38
|
+
# Additional options.
|
39
|
+
#
|
40
|
+
# @option options [Integer] :port (Ronin::Network::SMTP.default_port)
|
41
|
+
# The port to connect to.
|
42
|
+
#
|
43
|
+
# @option options [String] :helo
|
44
|
+
# The HELO domain.
|
45
|
+
#
|
46
|
+
# @option options [Symbol] :auth
|
47
|
+
# The type of authentication to use. Can be either +:login+, +:plain+,
|
48
|
+
# or +:cram_md5+.
|
49
|
+
#
|
50
|
+
# @option options [String] :user
|
51
|
+
# The user-name to authenticate with.
|
52
|
+
#
|
53
|
+
# @option options [String] :password
|
54
|
+
# The password to authenticate with.
|
55
|
+
#
|
56
|
+
# @yield [session]
|
57
|
+
# If a block is given, it will be passed an ESMTP enabled session object.
|
58
|
+
#
|
59
|
+
# @yieldparam [Net::SMTP] session
|
60
|
+
# The ESMTP session.
|
61
|
+
#
|
62
|
+
# @return [Net::SMTP]
|
63
|
+
# The ESMTP enabled session.
|
48
64
|
#
|
49
65
|
def Net.esmtp_connect(host,options={},&block)
|
50
66
|
Net.smtp_connect(host,options) do |sess|
|
@@ -54,10 +70,22 @@ module Net
|
|
54
70
|
end
|
55
71
|
|
56
72
|
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
73
|
+
# Starts an ESMTP session with the ESMTP enabled server.
|
74
|
+
#
|
75
|
+
# @param [String] host
|
76
|
+
# The host to connect to.
|
77
|
+
#
|
78
|
+
# @param [Hash] options
|
79
|
+
# Additional options.
|
80
|
+
#
|
81
|
+
# @yield [session]
|
82
|
+
# If a block is given, it will be passed an ESMTP enabled session
|
83
|
+
# object. After the block has returned, the session will be closed.
|
84
|
+
#
|
85
|
+
# @yieldparam [Net::SMTP] session
|
86
|
+
# The ESMTP session.
|
87
|
+
#
|
88
|
+
# @see Net.esmtp_connect
|
61
89
|
#
|
62
90
|
def Net.esmtp_session(host,options={},&block)
|
63
91
|
Net.smtp_session(host,options) do |sess|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/extensions/http/net'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/http'
|
@@ -28,30 +25,41 @@ require 'net/http'
|
|
28
25
|
|
29
26
|
module Net
|
30
27
|
#
|
31
|
-
# Connects to the HTTP server using the given _options_.
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
28
|
+
# Connects to the HTTP server using the given _options_.
|
29
|
+
#
|
30
|
+
# @param [Hash] options
|
31
|
+
# Additional options
|
32
|
+
#
|
33
|
+
# @option options [String, URI::HTTP] :url
|
34
|
+
# The full URL to request.
|
35
|
+
#
|
36
|
+
# @option options [String] :user
|
37
|
+
# The user to authenticate with when connecting to the HTTP server.
|
38
|
+
#
|
39
|
+
# @option options [String] :password
|
40
|
+
# The password to authenticate with when connecting to the HTTP server.
|
41
|
+
#
|
42
|
+
# @option options [String] :host
|
43
|
+
# The host the HTTP server is running on.
|
44
|
+
#
|
45
|
+
# @option options [Integer] :port (Net::HTTP.default_port)
|
46
|
+
# The port the HTTP server is listening on.
|
47
|
+
#
|
48
|
+
# @option options [String] :path
|
49
|
+
# The path to request from the HTTP server.
|
50
|
+
#
|
51
|
+
# @option options [String, Hash] :proxy (Ronin::Network::HTTP.proxy)
|
52
|
+
# A Hash of proxy settings to use when connecting to the HTTP server.
|
53
|
+
#
|
54
|
+
# @yield [session]
|
55
|
+
# If a block is given, it will be passed the newly created HTTP
|
56
|
+
# session object.
|
57
|
+
#
|
58
|
+
# @yieldparam [Net::HTTP] session
|
59
|
+
# The newly created HTTP session.
|
60
|
+
#
|
61
|
+
# @return [Net::HTTP]
|
62
|
+
# The HTTP session object.
|
55
63
|
#
|
56
64
|
def Net.http_session(options={},&block)
|
57
65
|
options = Ronin::Network::HTTP.expand_options(options)
|
@@ -76,33 +84,33 @@ module Net
|
|
76
84
|
#
|
77
85
|
# Connects to the HTTP server and sends an HTTP Request using the given
|
78
86
|
# _options_. If a _block_ is given it will be passed the newly created
|
79
|
-
# HTTP Request object.
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
87
|
+
# HTTP Request object.
|
88
|
+
#
|
89
|
+
# @param [Hash] options
|
90
|
+
# Additional options.
|
91
|
+
#
|
92
|
+
# @option options [Symbol, String] :method
|
93
|
+
# The HTTP method to use in the request.
|
94
|
+
#
|
95
|
+
# @option options [Hash] :headers
|
96
|
+
# The Hash of the HTTP headers to send with the request.
|
97
|
+
# May contain either Strings or Symbols, lower-case or camel-case keys.
|
98
|
+
#
|
99
|
+
# @yield [request, (options)]
|
100
|
+
# If a block is given, it will be passed the HTTP request object.
|
101
|
+
# If the block has an arity of 2, it will also be passed the expanded
|
102
|
+
# version of the given _options_.
|
103
|
+
#
|
104
|
+
# @yieldparam [Net::HTTP::Request] request
|
105
|
+
# The HTTP request object to use in the request.
|
106
|
+
#
|
107
|
+
# @yieldparam [Hash] options
|
108
|
+
# The expanded version of the given _options_.
|
109
|
+
#
|
110
|
+
# @return [Net::HTTP::Response]
|
111
|
+
# The response of the HTTP request.
|
112
|
+
#
|
113
|
+
# @see http_session
|
106
114
|
#
|
107
115
|
def Net.http_request(options={},&block)
|
108
116
|
resp = nil
|
@@ -129,32 +137,21 @@ module Net
|
|
129
137
|
#
|
130
138
|
# Performes an HTTP Copy request with the given _options_. If a _block_
|
131
139
|
# is given, it will be passed the response from the HTTP server.
|
132
|
-
#
|
133
|
-
#
|
134
|
-
#
|
135
|
-
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
#
|
145
|
-
#
|
146
|
-
#
|
147
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
148
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
149
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
150
|
-
# <tt>:user</tt>:: The user to authenticate with
|
151
|
-
# when connecting to the HTTP proxy.
|
152
|
-
# <tt>:password</tt>:: The password to authenticate with
|
153
|
-
# when connecting to the HTTP
|
154
|
-
# proxy.
|
155
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
156
|
-
# Copy request. May use Strings or Symbols for the
|
157
|
-
# keys of the Hash.
|
140
|
+
#
|
141
|
+
# @param [Hash] options
|
142
|
+
# Additional options.
|
143
|
+
#
|
144
|
+
# @yield [response]
|
145
|
+
# If a block is given, it will be passed the response received
|
146
|
+
# from the request.
|
147
|
+
#
|
148
|
+
# @yieldparam [Net::HTTP::Response] response
|
149
|
+
# The HTTP response object.
|
150
|
+
#
|
151
|
+
# @return [Net::HTTP::Response]
|
152
|
+
# The response of the HTTP request.
|
153
|
+
#
|
154
|
+
# @see http_request
|
158
155
|
#
|
159
156
|
def Net.http_copy(options={},&block)
|
160
157
|
resp = Net.http_request(options.merge(:method => :copy))
|
@@ -166,32 +163,21 @@ module Net
|
|
166
163
|
#
|
167
164
|
# Performes an HTTP Delete request with the given _options_. If a _block_
|
168
165
|
# is given, it will be passed the response from the HTTP server.
|
169
|
-
#
|
170
|
-
#
|
171
|
-
#
|
172
|
-
#
|
173
|
-
#
|
174
|
-
#
|
175
|
-
#
|
176
|
-
#
|
177
|
-
#
|
178
|
-
#
|
179
|
-
#
|
180
|
-
#
|
181
|
-
#
|
182
|
-
#
|
183
|
-
#
|
184
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
185
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
186
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
187
|
-
# <tt>:user</tt>:: The user to authenticate with
|
188
|
-
# when connecting to the HTTP proxy.
|
189
|
-
# <tt>:password</tt>:: The password to authenticate with
|
190
|
-
# when connecting to the HTTP
|
191
|
-
# proxy.
|
192
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
193
|
-
# Delete request. May use Strings or Symbols for the
|
194
|
-
# keys of the Hash.
|
166
|
+
#
|
167
|
+
# @param [Hash] options
|
168
|
+
# Additional options.
|
169
|
+
#
|
170
|
+
# @yield [response]
|
171
|
+
# If a block is given, it will be passed the response received from
|
172
|
+
# the request.
|
173
|
+
#
|
174
|
+
# @yieldparam [Net::HTTP::Response] response
|
175
|
+
# The HTTP response object.
|
176
|
+
#
|
177
|
+
# @return [Net::HTTP::Response]
|
178
|
+
# The response of the HTTP request.
|
179
|
+
#
|
180
|
+
# @see http_request
|
195
181
|
#
|
196
182
|
def Net.http_delete(options={},&block)
|
197
183
|
original_headers = options[:headers]
|
@@ -212,32 +198,21 @@ module Net
|
|
212
198
|
#
|
213
199
|
# Performes an HTTP Get request with the given _options_. If a _block_
|
214
200
|
# is given, it will be passed the response from the HTTP server.
|
215
|
-
#
|
216
|
-
#
|
217
|
-
#
|
218
|
-
#
|
219
|
-
#
|
220
|
-
#
|
221
|
-
#
|
222
|
-
#
|
223
|
-
#
|
224
|
-
#
|
225
|
-
#
|
226
|
-
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
#
|
230
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
231
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
232
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
233
|
-
# <tt>:user</tt>:: The user to authenticate with
|
234
|
-
# when connecting to the HTTP proxy.
|
235
|
-
# <tt>:password</tt>:: The password to authenticate with
|
236
|
-
# when connecting to the HTTP
|
237
|
-
# proxy.
|
238
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
239
|
-
# Get request. May use Strings or Symbols for the
|
240
|
-
# keys of the Hash.
|
201
|
+
#
|
202
|
+
# @param [Hash] options
|
203
|
+
# Additional options.
|
204
|
+
#
|
205
|
+
# @yield [response]
|
206
|
+
# If a block is given, it will be passed the response received from
|
207
|
+
# the request.
|
208
|
+
#
|
209
|
+
# @yieldparam [Net::HTTP::Response] response
|
210
|
+
# The HTTP response object.
|
211
|
+
#
|
212
|
+
# @return [Net::HTTP::Response]
|
213
|
+
# The response of the HTTP request.
|
214
|
+
#
|
215
|
+
# @see http_request
|
241
216
|
#
|
242
217
|
def Net.http_get(options={},&block)
|
243
218
|
resp = Net.http_request(options.merge(:method => :get))
|
@@ -249,32 +224,21 @@ module Net
|
|
249
224
|
#
|
250
225
|
# Performes an HTTP Get request with the given _options_. If a _block_
|
251
226
|
# is given, it will be passed the response body from the HTTP server.
|
252
|
-
#
|
253
|
-
#
|
254
|
-
#
|
255
|
-
#
|
256
|
-
#
|
257
|
-
#
|
258
|
-
#
|
259
|
-
#
|
260
|
-
#
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
264
|
-
#
|
265
|
-
#
|
266
|
-
#
|
267
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
268
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
269
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
270
|
-
# <tt>:user</tt>:: The user to authenticate with
|
271
|
-
# when connecting to the HTTP proxy.
|
272
|
-
# <tt>:password</tt>:: The password to authenticate with
|
273
|
-
# when connecting to the HTTP
|
274
|
-
# proxy.
|
275
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
276
|
-
# Get request. May use Strings or Symbols for the
|
277
|
-
# keys of the Hash.
|
227
|
+
#
|
228
|
+
# @param [Hash] options
|
229
|
+
# Additional options.
|
230
|
+
#
|
231
|
+
# @yield [response]
|
232
|
+
# If a block is given, it will be passed the response received from
|
233
|
+
# the request.
|
234
|
+
#
|
235
|
+
# @yieldparam [Net::HTTP::Response] response
|
236
|
+
# The HTTP response object.
|
237
|
+
#
|
238
|
+
# @return [String]
|
239
|
+
# The body of the HTTP response.
|
240
|
+
#
|
241
|
+
# @see http_request
|
278
242
|
#
|
279
243
|
def Net.http_get_body(options={},&block)
|
280
244
|
Net.http_get(options,&block).body
|
@@ -283,32 +247,21 @@ module Net
|
|
283
247
|
#
|
284
248
|
# Performes an HTTP Head request with the given _options_. If a _block_
|
285
249
|
# is given, it will be passed the response from the HTTP server.
|
286
|
-
#
|
287
|
-
#
|
288
|
-
#
|
289
|
-
#
|
290
|
-
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
#
|
294
|
-
#
|
295
|
-
#
|
296
|
-
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
300
|
-
#
|
301
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
302
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
303
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
304
|
-
# <tt>:user</tt>:: The user to authenticate with
|
305
|
-
# when connecting to the HTTP proxy.
|
306
|
-
# <tt>:password</tt>:: The password to authenticate with
|
307
|
-
# when connecting to the HTTP
|
308
|
-
# proxy.
|
309
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
310
|
-
# Head request. May use Strings or Symbols for the
|
311
|
-
# keys of the Hash.
|
250
|
+
#
|
251
|
+
# @param [Hash] options
|
252
|
+
# Additional options.
|
253
|
+
#
|
254
|
+
# @yield [response]
|
255
|
+
# If a block is given, it will be passed the response received from
|
256
|
+
# the request.
|
257
|
+
#
|
258
|
+
# @yieldparam [Net::HTTP::Response] response
|
259
|
+
# The HTTP response object.
|
260
|
+
#
|
261
|
+
# @return [Net::HTTP::Response]
|
262
|
+
# The response of the HTTP request.
|
263
|
+
#
|
264
|
+
# @see http_request
|
312
265
|
#
|
313
266
|
def Net.http_head(options={},&block)
|
314
267
|
resp = Net.http_request(options.merge(:method => :head))
|
@@ -318,34 +271,15 @@ module Net
|
|
318
271
|
end
|
319
272
|
|
320
273
|
#
|
321
|
-
#
|
322
|
-
#
|
323
|
-
#
|
324
|
-
#
|
325
|
-
# <tt>:url</tt>:: The full URL to request.
|
326
|
-
# <tt>:user</tt>:: The user to authenticate with when connecting to the
|
327
|
-
# HTTP server.
|
328
|
-
# <tt>:password</tt>:: The password to authenticate with when connecting
|
329
|
-
# to the HTTP server.
|
330
|
-
# <tt>:host</tt>:: The host the HTTP server is running on.
|
331
|
-
# <tt>:port</tt>:: The port the HTTP server is running on. Defaults to
|
332
|
-
# <tt>Net::HTTP.default_port</tt>.
|
333
|
-
# <tt>:path</tt>:: The path to request from the HTTP server.
|
334
|
-
# <tt>:proxy</tt>:: A Hash of proxy settings to use when connecting to
|
335
|
-
# the HTTP server. Defaults to
|
336
|
-
# <tt>Ronin::Network::HTTP.proxy</tt>.
|
337
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
338
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
339
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
340
|
-
# <tt>:user</tt>:: The user to authenticate with
|
341
|
-
# when connecting to the HTTP proxy.
|
342
|
-
# <tt>:password</tt>:: The password to authenticate with
|
343
|
-
# when connecting to the HTTP
|
344
|
-
# proxy.
|
345
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
346
|
-
# Head request. May use Strings or Symbols for the
|
347
|
-
# keys of the Hash.
|
274
|
+
# Checks if the response has an HTTP OK status code.
|
275
|
+
#
|
276
|
+
# @param [Hash] options
|
277
|
+
# Additional options.
|
348
278
|
#
|
279
|
+
# @return [Boolean]
|
280
|
+
# Specifies wether the response had an HTTP OK status code or not.
|
281
|
+
#
|
282
|
+
# @see http_request
|
349
283
|
#
|
350
284
|
def Net.http_ok?(options={})
|
351
285
|
Net.http_head(options).code == 200
|
@@ -355,34 +289,13 @@ module Net
|
|
355
289
|
# Sends a HTTP Head request using the given _options_ and returns the
|
356
290
|
# HTTP Server header.
|
357
291
|
#
|
358
|
-
#
|
359
|
-
#
|
360
|
-
#
|
361
|
-
#
|
362
|
-
#
|
363
|
-
#
|
364
|
-
#
|
365
|
-
# <tt>:port</tt>:: The port the HTTP server is running on. Defaults to
|
366
|
-
# <tt>Net::HTTP.default_port</tt>.
|
367
|
-
# <tt>:path</tt>:: The path to request from the HTTP server.
|
368
|
-
# <tt>:proxy</tt>:: A Hash of proxy settings to use when connecting to
|
369
|
-
# the HTTP server. Defaults to
|
370
|
-
# <tt>Ronin::Network::HTTP.proxy</tt>.
|
371
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
372
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
373
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
374
|
-
# <tt>:user</tt>:: The user to authenticate with
|
375
|
-
# when connecting to the HTTP proxy.
|
376
|
-
# <tt>:password</tt>:: The password to authenticate with
|
377
|
-
# when connecting to the HTTP
|
378
|
-
# proxy.
|
379
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
380
|
-
# Head request. May use Strings or Symbols for the
|
381
|
-
# keys of the Hash.
|
382
|
-
#
|
383
|
-
# Net.http_server(:url => 'http://www.darkc0de.com/)
|
384
|
-
# # => "Apache/2.2.11 (Unix) PHP/4.4.9 mod_ssl/2.2.11 OpenSSL/0.9.8c
|
385
|
-
# mod_fastcgi/2.4.6 Phusion_Passenger/2.1.2 DAV/2 SVN/1.4.2"
|
292
|
+
# @param [Hash] options
|
293
|
+
# Additional options.
|
294
|
+
#
|
295
|
+
# @return [String]
|
296
|
+
# The HTTP +Server+ header.
|
297
|
+
#
|
298
|
+
# @see http_request
|
386
299
|
#
|
387
300
|
def Net.http_server(options={})
|
388
301
|
Net.http_head(options)['server']
|
@@ -392,33 +305,13 @@ module Net
|
|
392
305
|
# Sends an HTTP Head request using the given _options_ and returns the
|
393
306
|
# HTTP X-Powered-By header.
|
394
307
|
#
|
395
|
-
#
|
396
|
-
#
|
397
|
-
#
|
398
|
-
#
|
399
|
-
#
|
400
|
-
#
|
401
|
-
#
|
402
|
-
# <tt>:port</tt>:: The port the HTTP server is running on. Defaults to
|
403
|
-
# <tt>Net::HTTP.default_port</tt>.
|
404
|
-
# <tt>:path</tt>:: The path to request from the HTTP server.
|
405
|
-
# <tt>:proxy</tt>:: A Hash of proxy settings to use when connecting to
|
406
|
-
# the HTTP server. Defaults to
|
407
|
-
# <tt>Ronin::Network::HTTP.proxy</tt>.
|
408
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
409
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
410
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
411
|
-
# <tt>:user</tt>:: The user to authenticate with
|
412
|
-
# when connecting to the HTTP proxy.
|
413
|
-
# <tt>:password</tt>:: The password to authenticate with
|
414
|
-
# when connecting to the HTTP
|
415
|
-
# proxy.
|
416
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
417
|
-
# Head request. May use Strings or Symbols for the
|
418
|
-
# keys of the Hash.
|
419
|
-
#
|
420
|
-
# Net.http_powered_by(:url => 'http://www.stalkdaily.com/')
|
421
|
-
# # => "PHP/5.2.9"
|
308
|
+
# @param [Hash] options
|
309
|
+
# Additional options.
|
310
|
+
#
|
311
|
+
# @return [String]
|
312
|
+
# The HTTP +X-Powered-By+ header.
|
313
|
+
#
|
314
|
+
# @see http_request
|
422
315
|
#
|
423
316
|
def Net.http_powered_by(options={})
|
424
317
|
resp = Net.http_head(options)
|
@@ -433,32 +326,21 @@ module Net
|
|
433
326
|
#
|
434
327
|
# Performes an HTTP Lock request with the given _options_. If a _block_
|
435
328
|
# is given, it will be passed the response from the HTTP server.
|
436
|
-
#
|
437
|
-
#
|
438
|
-
#
|
439
|
-
#
|
440
|
-
#
|
441
|
-
#
|
442
|
-
#
|
443
|
-
#
|
444
|
-
#
|
445
|
-
#
|
446
|
-
#
|
447
|
-
#
|
448
|
-
#
|
449
|
-
#
|
450
|
-
#
|
451
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
452
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
453
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
454
|
-
# <tt>:user</tt>:: The user to authenticate with
|
455
|
-
# when connecting to the HTTP proxy.
|
456
|
-
# <tt>:password</tt>:: The password to authenticate with
|
457
|
-
# when connecting to the HTTP
|
458
|
-
# proxy.
|
459
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
460
|
-
# Lock request. May use Strings or Symbols for the
|
461
|
-
# keys of the Hash.
|
329
|
+
#
|
330
|
+
# @param [Hash] options
|
331
|
+
# Additional options.
|
332
|
+
#
|
333
|
+
# @yield [response]
|
334
|
+
# If a block is given, it will be passed the response received from
|
335
|
+
# the request.
|
336
|
+
#
|
337
|
+
# @yieldparam [Net::HTTP::Response] response
|
338
|
+
# The HTTP response object.
|
339
|
+
#
|
340
|
+
# @return [Net::HTTP::Response]
|
341
|
+
# The response of the HTTP request.
|
342
|
+
#
|
343
|
+
# @see http_request
|
462
344
|
#
|
463
345
|
def Net.http_lock(options={},&block)
|
464
346
|
resp = Net.http_request(options.merge(:method => :lock))
|
@@ -470,32 +352,21 @@ module Net
|
|
470
352
|
#
|
471
353
|
# Performes an HTTP Mkcol request with the given _options_. If a _block_
|
472
354
|
# is given, it will be passed the response from the HTTP server.
|
473
|
-
#
|
474
|
-
#
|
475
|
-
#
|
476
|
-
#
|
477
|
-
#
|
478
|
-
#
|
479
|
-
#
|
480
|
-
#
|
481
|
-
#
|
482
|
-
#
|
483
|
-
#
|
484
|
-
#
|
485
|
-
#
|
486
|
-
#
|
487
|
-
#
|
488
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
489
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
490
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
491
|
-
# <tt>:user</tt>:: The user to authenticate with
|
492
|
-
# when connecting to the HTTP proxy.
|
493
|
-
# <tt>:password</tt>:: The password to authenticate with
|
494
|
-
# when connecting to the HTTP
|
495
|
-
# proxy.
|
496
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
497
|
-
# Mkcol request. May use Strings or Symbols for the
|
498
|
-
# keys of the Hash.
|
355
|
+
#
|
356
|
+
# @param [Hash] options
|
357
|
+
# Additional options.
|
358
|
+
#
|
359
|
+
# @yield [response]
|
360
|
+
# If a block is given, it will be passed the response received from
|
361
|
+
# the request.
|
362
|
+
#
|
363
|
+
# @yieldparam [Net::HTTP::Response] response
|
364
|
+
# The HTTP response object.
|
365
|
+
#
|
366
|
+
# @return [Net::HTTP::Response]
|
367
|
+
# The response of the HTTP request.
|
368
|
+
#
|
369
|
+
# @see http_request
|
499
370
|
#
|
500
371
|
def Net.http_mkcol(options={},&block)
|
501
372
|
resp = Net.http_request(options.merge(:method => :mkcol))
|
@@ -507,32 +378,21 @@ module Net
|
|
507
378
|
#
|
508
379
|
# Performes an HTTP Move request with the given _options_. If a _block_
|
509
380
|
# is given, it will be passed the response from the HTTP server.
|
510
|
-
#
|
511
|
-
#
|
512
|
-
#
|
513
|
-
#
|
514
|
-
#
|
515
|
-
#
|
516
|
-
#
|
517
|
-
#
|
518
|
-
#
|
519
|
-
#
|
520
|
-
#
|
521
|
-
#
|
522
|
-
#
|
523
|
-
#
|
524
|
-
#
|
525
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
526
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
527
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
528
|
-
# <tt>:user</tt>:: The user to authenticate with
|
529
|
-
# when connecting to the HTTP proxy.
|
530
|
-
# <tt>:password</tt>:: The password to authenticate with
|
531
|
-
# when connecting to the HTTP
|
532
|
-
# proxy.
|
533
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
534
|
-
# Move request. May use Strings or Symbols for the
|
535
|
-
# keys of the Hash.
|
381
|
+
#
|
382
|
+
# @param [Hash] options
|
383
|
+
# Additional options.
|
384
|
+
#
|
385
|
+
# @yield [response]
|
386
|
+
# If a block is given, it will be passed the response received from
|
387
|
+
# the request.
|
388
|
+
#
|
389
|
+
# @yieldparam [Net::HTTP::Response] response
|
390
|
+
# The HTTP response object.
|
391
|
+
#
|
392
|
+
# @return [Net::HTTP::Response]
|
393
|
+
# The response of the HTTP request.
|
394
|
+
#
|
395
|
+
# @see http_request
|
536
396
|
#
|
537
397
|
def Net.http_move(options={},&block)
|
538
398
|
resp = Net.http_request(options.merge(:method => :move))
|
@@ -544,32 +404,21 @@ module Net
|
|
544
404
|
#
|
545
405
|
# Performes an HTTP Options request with the given _options_. If a _block_
|
546
406
|
# is given, it will be passed the response from the HTTP server.
|
547
|
-
#
|
548
|
-
#
|
549
|
-
#
|
550
|
-
#
|
551
|
-
#
|
552
|
-
#
|
553
|
-
#
|
554
|
-
#
|
555
|
-
#
|
556
|
-
#
|
557
|
-
#
|
558
|
-
#
|
559
|
-
#
|
560
|
-
#
|
561
|
-
#
|
562
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
563
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
564
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
565
|
-
# <tt>:user</tt>:: The user to authenticate with
|
566
|
-
# when connecting to the HTTP proxy.
|
567
|
-
# <tt>:password</tt>:: The password to authenticate with
|
568
|
-
# when connecting to the HTTP
|
569
|
-
# proxy.
|
570
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
571
|
-
# Options request. May use Strings or Symbols for
|
572
|
-
# the keys of the Hash.
|
407
|
+
#
|
408
|
+
# @param [Hash] options
|
409
|
+
# Additional options.
|
410
|
+
#
|
411
|
+
# @yield [response]
|
412
|
+
# If a block is given, it will be passed the response received from
|
413
|
+
# the request.
|
414
|
+
#
|
415
|
+
# @yieldparam [Net::HTTP::Response] response
|
416
|
+
# The HTTP response object.
|
417
|
+
#
|
418
|
+
# @return [Net::HTTP::Response]
|
419
|
+
# The response of the HTTP request.
|
420
|
+
#
|
421
|
+
# @see http_request
|
573
422
|
#
|
574
423
|
def Net.http_options(options={},&block)
|
575
424
|
resp = Net.http_request(options.merge(:method => :options))
|
@@ -581,45 +430,36 @@ module Net
|
|
581
430
|
#
|
582
431
|
# Performes an HTTP Post request with the given _options_. If a _block_
|
583
432
|
# is given, it will be passed the response from the HTTP server.
|
584
|
-
#
|
585
|
-
#
|
586
|
-
#
|
587
|
-
#
|
588
|
-
#
|
589
|
-
#
|
590
|
-
#
|
591
|
-
#
|
592
|
-
#
|
593
|
-
#
|
594
|
-
#
|
595
|
-
#
|
596
|
-
#
|
597
|
-
#
|
598
|
-
#
|
599
|
-
#
|
600
|
-
#
|
601
|
-
#
|
602
|
-
# <tt>:user</tt>:: The user to authenticate with
|
603
|
-
# when connecting to the HTTP proxy.
|
604
|
-
# <tt>:password</tt>:: The password to authenticate with
|
605
|
-
# when connecting to the HTTP
|
606
|
-
# proxy.
|
607
|
-
# <tt>:post_data</tt>:: The POSTDATA to send with the HTTP Post request.
|
608
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
609
|
-
# Post request. May use Strings or Symbols for the
|
610
|
-
# keys of the Hash.
|
433
|
+
#
|
434
|
+
# @param [Hash] options
|
435
|
+
# Additional options.
|
436
|
+
#
|
437
|
+
# @option options [String] :postdata
|
438
|
+
# The +POSTDATA+ to send with the HTTP Post request.
|
439
|
+
#
|
440
|
+
# @yield [response]
|
441
|
+
# If a block is given, it will be passed the response received from
|
442
|
+
# the request.
|
443
|
+
#
|
444
|
+
# @yieldparam [Net::HTTP::Response] response
|
445
|
+
# The HTTP response object.
|
446
|
+
#
|
447
|
+
# @return [Net::HTTP::Response]
|
448
|
+
# The response of the HTTP request.
|
449
|
+
#
|
450
|
+
# @see http_request
|
611
451
|
#
|
612
452
|
def Net.http_post(options={},&block)
|
613
453
|
options = options.merge(:method => :post)
|
614
|
-
|
454
|
+
postdata = options.delete(:postdata)
|
615
455
|
|
616
456
|
if options[:url]
|
617
457
|
url = URI(options[:url].to_s)
|
618
|
-
|
458
|
+
postdata ||= url.query_params
|
619
459
|
end
|
620
460
|
|
621
461
|
resp = Net.http_request(options) do |req,expanded_options|
|
622
|
-
req.set_form_data(
|
462
|
+
req.set_form_data(postdata) if postdata
|
623
463
|
end
|
624
464
|
|
625
465
|
block.call(resp) if block
|
@@ -629,32 +469,24 @@ module Net
|
|
629
469
|
#
|
630
470
|
# Performes an HTTP Post request with the given _options_. If a _block_
|
631
471
|
# is given, it will be passed the response body from the HTTP server.
|
632
|
-
#
|
633
|
-
#
|
634
|
-
#
|
635
|
-
#
|
636
|
-
#
|
637
|
-
#
|
638
|
-
#
|
639
|
-
#
|
640
|
-
#
|
641
|
-
#
|
642
|
-
#
|
643
|
-
#
|
644
|
-
#
|
645
|
-
#
|
646
|
-
#
|
647
|
-
#
|
648
|
-
#
|
649
|
-
#
|
650
|
-
# <tt>:user</tt>:: The user to authenticate with
|
651
|
-
# when connecting to the HTTP proxy.
|
652
|
-
# <tt>:password</tt>:: The password to authenticate with
|
653
|
-
# when connecting to the HTTP
|
654
|
-
# proxy.
|
655
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
656
|
-
# Post request. May use Strings or Symbols for the
|
657
|
-
# keys of the Hash.
|
472
|
+
#
|
473
|
+
# @param [Hash] options
|
474
|
+
# Additional options.
|
475
|
+
#
|
476
|
+
# @option options [String] :postdata
|
477
|
+
# The +POSTDATA+ to send with the HTTP Post request.
|
478
|
+
#
|
479
|
+
# @yield [response]
|
480
|
+
# If a block is given, it will be passed the response received from
|
481
|
+
# the request.
|
482
|
+
#
|
483
|
+
# @yieldparam [Net::HTTP::Response] response
|
484
|
+
# The HTTP response object.
|
485
|
+
#
|
486
|
+
# @return [String]
|
487
|
+
# The body of the HTTP response.
|
488
|
+
#
|
489
|
+
# @see http_request
|
658
490
|
#
|
659
491
|
def Net.http_post_body(options={},&block)
|
660
492
|
Net.http_post(options,&block).body
|
@@ -663,32 +495,21 @@ module Net
|
|
663
495
|
#
|
664
496
|
# Performes an HTTP Propfind request with the given _options_. If a
|
665
497
|
# _block_ is given, it will be passed the response from the HTTP server.
|
666
|
-
#
|
667
|
-
#
|
668
|
-
#
|
669
|
-
#
|
670
|
-
#
|
671
|
-
#
|
672
|
-
#
|
673
|
-
#
|
674
|
-
#
|
675
|
-
#
|
676
|
-
#
|
677
|
-
#
|
678
|
-
#
|
679
|
-
#
|
680
|
-
#
|
681
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
682
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
683
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
684
|
-
# <tt>:user</tt>:: The user to authenticate with
|
685
|
-
# when connecting to the HTTP proxy.
|
686
|
-
# <tt>:password</tt>:: The password to authenticate with
|
687
|
-
# when connecting to the HTTP
|
688
|
-
# proxy.
|
689
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
690
|
-
# Propfind request. May use Strings or Symbols for
|
691
|
-
# the keys of the Hash.
|
498
|
+
#
|
499
|
+
# @param [Hash] options
|
500
|
+
# Additional options.
|
501
|
+
#
|
502
|
+
# @yield [response]
|
503
|
+
# If a block is given, it will be passed the response received from
|
504
|
+
# the request.
|
505
|
+
#
|
506
|
+
# @yieldparam [Net::HTTP::Response] response
|
507
|
+
# The HTTP response object.
|
508
|
+
#
|
509
|
+
# @return [Net::HTTP::Response]
|
510
|
+
# The response of the HTTP request.
|
511
|
+
#
|
512
|
+
# @see http_request
|
692
513
|
#
|
693
514
|
def Net.http_prop_find(options={},&block)
|
694
515
|
original_headers = options[:headers]
|
@@ -709,32 +530,21 @@ module Net
|
|
709
530
|
#
|
710
531
|
# Performes an HTTP Proppatch request with the given _options_. If a
|
711
532
|
# _block_ is given, it will be passed the response from the HTTP server.
|
712
|
-
#
|
713
|
-
#
|
714
|
-
#
|
715
|
-
#
|
716
|
-
#
|
717
|
-
#
|
718
|
-
#
|
719
|
-
#
|
720
|
-
#
|
721
|
-
#
|
722
|
-
#
|
723
|
-
#
|
724
|
-
#
|
725
|
-
#
|
726
|
-
#
|
727
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
728
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
729
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
730
|
-
# <tt>:user</tt>:: The user to authenticate with
|
731
|
-
# when connecting to the HTTP proxy.
|
732
|
-
# <tt>:password</tt>:: The password to authenticate with
|
733
|
-
# when connecting to the HTTP
|
734
|
-
# proxy.
|
735
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
736
|
-
# Proppatch request. May use Strings or Symbols for
|
737
|
-
# the keys of the Hash.
|
533
|
+
#
|
534
|
+
# @param [Hash] options
|
535
|
+
# Additional options.
|
536
|
+
#
|
537
|
+
# @yield [response]
|
538
|
+
# If a block is given, it will be passed the response received from
|
539
|
+
# the request.
|
540
|
+
#
|
541
|
+
# @yieldparam [Net::HTTP::Response] response
|
542
|
+
# The HTTP response object.
|
543
|
+
#
|
544
|
+
# @return [Net::HTTP::Response]
|
545
|
+
# The response of the HTTP request.
|
546
|
+
#
|
547
|
+
# @see http_request
|
738
548
|
#
|
739
549
|
def Net.http_prop_patch(options={},&block)
|
740
550
|
resp = Net.http_request(options.merge(:method => :proppatch))
|
@@ -746,32 +556,21 @@ module Net
|
|
746
556
|
#
|
747
557
|
# Performes an HTTP Trace request with the given _options_. If a _block_
|
748
558
|
# is given, it will be passed the response from the HTTP server.
|
749
|
-
#
|
750
|
-
#
|
751
|
-
#
|
752
|
-
#
|
753
|
-
#
|
754
|
-
#
|
755
|
-
#
|
756
|
-
#
|
757
|
-
#
|
758
|
-
#
|
759
|
-
#
|
760
|
-
#
|
761
|
-
#
|
762
|
-
#
|
763
|
-
#
|
764
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
765
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
766
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
767
|
-
# <tt>:user</tt>:: The user to authenticate with
|
768
|
-
# when connecting to the HTTP proxy.
|
769
|
-
# <tt>:password</tt>:: The password to authenticate with
|
770
|
-
# when connecting to the HTTP
|
771
|
-
# proxy.
|
772
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
773
|
-
# Trace request. May use Strings or Symbols for the
|
774
|
-
# keys of the Hash.
|
559
|
+
#
|
560
|
+
# @param [Hash] options
|
561
|
+
# Additional options.
|
562
|
+
#
|
563
|
+
# @yield [response]
|
564
|
+
# If a block is given, it will be passed the response received from
|
565
|
+
# the request.
|
566
|
+
#
|
567
|
+
# @yieldparam [Net::HTTP::Response] response
|
568
|
+
# The HTTP response object.
|
569
|
+
#
|
570
|
+
# @return [Net::HTTP::Response]
|
571
|
+
# The response of the HTTP request.
|
572
|
+
#
|
573
|
+
# @see http_request
|
775
574
|
#
|
776
575
|
def Net.http_trace(options={},&block)
|
777
576
|
resp = Net.http_request(options.merge(:method => :trace))
|
@@ -783,32 +582,21 @@ module Net
|
|
783
582
|
#
|
784
583
|
# Performes an HTTP Unlock request with the given _options_. If a _block_
|
785
584
|
# is given, it will be passed the response from the HTTP server.
|
786
|
-
#
|
787
|
-
#
|
788
|
-
#
|
789
|
-
#
|
790
|
-
#
|
791
|
-
#
|
792
|
-
#
|
793
|
-
#
|
794
|
-
#
|
795
|
-
#
|
796
|
-
#
|
797
|
-
#
|
798
|
-
#
|
799
|
-
#
|
800
|
-
#
|
801
|
-
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
802
|
-
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
803
|
-
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
804
|
-
# <tt>:user</tt>:: The user to authenticate with
|
805
|
-
# when connecting to the HTTP proxy.
|
806
|
-
# <tt>:password</tt>:: The password to authenticate with
|
807
|
-
# when connecting to the HTTP
|
808
|
-
# proxy.
|
809
|
-
# <tt>:headers</tt>:: A Hash of the HTTP Headers to send with the HTTP
|
810
|
-
# Unlock request. May use Strings or Symbols for the
|
811
|
-
# keys of the Hash.
|
585
|
+
#
|
586
|
+
# @param [Hash] options
|
587
|
+
# Additional options.
|
588
|
+
#
|
589
|
+
# @yield [response]
|
590
|
+
# If a block is given, it will be passed the response received from
|
591
|
+
# the request.
|
592
|
+
#
|
593
|
+
# @yieldparam [Net::HTTP::Response] response
|
594
|
+
# The HTTP response object.
|
595
|
+
#
|
596
|
+
# @return [Net::HTTP::Response]
|
597
|
+
# The response of the HTTP request.
|
598
|
+
#
|
599
|
+
# @see http_request
|
812
600
|
#
|
813
601
|
def Net.http_unlock(options={},&block)
|
814
602
|
resp = Net.http_request(options.merge(:method => :unlock))
|