ronin-support 0.1.0 → 0.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +24 -0
- data/Gemfile +9 -1
- data/README.md +6 -3
- data/gemspec.yml +3 -1
- data/lib/ronin/extensions.rb +2 -1
- data/lib/ronin/extensions/file.rb +4 -0
- data/lib/ronin/extensions/ip_addr.rb +8 -0
- data/lib/ronin/extensions/kernel.rb +2 -0
- data/lib/ronin/extensions/string.rb +50 -11
- data/lib/ronin/formatting/extensions/binary.rb +2 -0
- data/lib/ronin/formatting/extensions/binary/file.rb +12 -1
- data/lib/ronin/formatting/extensions/binary/integer.rb +6 -0
- data/lib/ronin/formatting/extensions/binary/string.rb +20 -0
- data/lib/ronin/formatting/extensions/digest/file.rb +14 -0
- data/lib/ronin/formatting/extensions/digest/string.rb +8 -0
- data/lib/ronin/formatting/extensions/html.rb +21 -0
- data/lib/ronin/formatting/extensions/html/integer.rb +126 -0
- data/lib/ronin/formatting/extensions/html/string.rb +184 -0
- data/lib/ronin/formatting/extensions/http/integer.rb +7 -1
- data/lib/ronin/formatting/extensions/http/string.rb +10 -0
- data/lib/ronin/formatting/extensions/text.rb +2 -0
- data/lib/ronin/formatting/extensions/text/array.rb +10 -0
- data/lib/ronin/formatting/extensions/text/string.rb +44 -12
- data/lib/ronin/formatting/html.rb +20 -0
- data/lib/ronin/mixin.rb +89 -0
- data/lib/ronin/network/extensions/esmtp/net.rb +6 -0
- data/lib/ronin/network/extensions/http/net.rb +124 -51
- data/lib/ronin/network/extensions/imap/net.rb +4 -0
- data/lib/ronin/network/extensions/pop3/net.rb +4 -0
- data/lib/ronin/network/extensions/smtp/net.rb +73 -2
- data/lib/ronin/network/extensions/ssl/net.rb +4 -0
- data/lib/ronin/network/extensions/tcp/net.rb +16 -0
- data/lib/ronin/network/extensions/telnet/net.rb +4 -0
- data/lib/ronin/network/extensions/udp/net.rb +12 -0
- data/lib/ronin/network/http/http.rb +50 -29
- data/lib/ronin/network/http/proxy.rb +26 -0
- data/lib/ronin/network/imap.rb +4 -0
- data/lib/ronin/network/network.rb +2 -0
- data/lib/ronin/network/pop3.rb +4 -0
- data/lib/ronin/network/smtp/email.rb +43 -14
- data/lib/ronin/network/smtp/smtp.rb +6 -0
- data/lib/ronin/network/ssl.rb +2 -0
- data/lib/ronin/network/telnet.rb +16 -0
- data/lib/ronin/path.rb +6 -0
- data/lib/ronin/support/inflector.rb +3 -1
- data/lib/ronin/support/version.rb +1 -1
- data/lib/ronin/templates/erb.rb +4 -0
- data/lib/ronin/templates/template.rb +10 -0
- data/spec/extensions/string_spec.rb +4 -4
- data/spec/formatting/html/integer_spec.rb +66 -0
- data/spec/formatting/html/string_spec.rb +103 -0
- data/spec/formatting/http/string_spec.rb +1 -1
- data/spec/formatting/text/string_spec.rb +18 -66
- data/spec/mixin_spec.rb +53 -0
- data/spec/network/http/http_spec.rb +0 -7
- data/spec/network/http/proxy_spec.rb +2 -2
- data/spec/network/smtp/email_spec.rb +100 -0
- data/spec/path_spec.rb +13 -13
- data/spec/templates/helpers/data.rb +1 -1
- metadata +52 -33
@@ -34,6 +34,8 @@ class Array
|
|
34
34
|
# ['A', 'BB', 0x90].bytes
|
35
35
|
# # => [0x41, 0x42, 0x42, 0x90]
|
36
36
|
#
|
37
|
+
# @api public
|
38
|
+
#
|
37
39
|
def bytes
|
38
40
|
self.inject([]) do |accum,elem|
|
39
41
|
if elem.kind_of?(Integer)
|
@@ -57,6 +59,8 @@ class Array
|
|
57
59
|
# [0x41, 0x41, 0x20].chars
|
58
60
|
# # => ["A", "A", " "]
|
59
61
|
#
|
62
|
+
# @api public
|
63
|
+
#
|
60
64
|
def chars
|
61
65
|
array_bytes = self.bytes
|
62
66
|
|
@@ -72,6 +76,8 @@ class Array
|
|
72
76
|
# [0x41, 0x41, 0x20].char_string
|
73
77
|
# # => "AA "
|
74
78
|
#
|
79
|
+
# @api public
|
80
|
+
#
|
75
81
|
def char_string
|
76
82
|
chars.join
|
77
83
|
end
|
@@ -91,6 +97,8 @@ class Array
|
|
91
97
|
# ['A', 'BB', 0x90].bytes
|
92
98
|
# # => ['\x41', '\x42', '\x42', '\x90']
|
93
99
|
#
|
100
|
+
# @api public
|
101
|
+
#
|
94
102
|
def hex_chars
|
95
103
|
array_bytes = self.bytes
|
96
104
|
|
@@ -113,6 +121,8 @@ class Array
|
|
113
121
|
# ['A', 'BB', 0x90].bytes
|
114
122
|
# # => ['0x41', '0x42', '0x42', '0x90']
|
115
123
|
#
|
124
|
+
# @api public
|
125
|
+
#
|
116
126
|
def hex_integers
|
117
127
|
array_bytes = self.bytes
|
118
128
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# along with Ronin Support. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
|
-
require '
|
20
|
+
require 'set'
|
21
21
|
|
22
22
|
class String
|
23
23
|
|
@@ -27,10 +27,10 @@ class String
|
|
27
27
|
# @param [Hash] options
|
28
28
|
# Additional options.
|
29
29
|
#
|
30
|
-
# @option options [
|
30
|
+
# @option options [#include?] :include (0x00..0xff)
|
31
31
|
# The bytes to format.
|
32
32
|
#
|
33
|
-
# @option options [
|
33
|
+
# @option options [#include?] :exclude
|
34
34
|
# The bytes not to format.
|
35
35
|
#
|
36
36
|
# @yield [byte]
|
@@ -43,17 +43,16 @@ class String
|
|
43
43
|
# @return [String]
|
44
44
|
# The formatted version of the String.
|
45
45
|
#
|
46
|
+
# @api public
|
47
|
+
#
|
46
48
|
def format_bytes(options={})
|
47
|
-
included = (
|
48
|
-
excluded = (
|
49
|
+
included = options.fetch(:include,(0x00..0xff))
|
50
|
+
excluded = options.fetch(:exclude,Set[])
|
49
51
|
|
50
52
|
formatted = ''
|
51
53
|
|
52
54
|
self.each_byte do |b|
|
53
|
-
|
54
|
-
|
55
|
-
if ((included.include?(b) || included.include?(c)) \
|
56
|
-
&& !(excluded.include?(b) || excluded.include?(c)))
|
55
|
+
if (included.include?(b) && !excluded.include?(b))
|
57
56
|
formatted << yield(b)
|
58
57
|
else
|
59
58
|
formatted << b
|
@@ -69,10 +68,10 @@ class String
|
|
69
68
|
# @param [Hash] options
|
70
69
|
# Additional options.
|
71
70
|
#
|
72
|
-
# @option options [
|
71
|
+
# @option options [#include?, Regexp] :include (/./m)
|
73
72
|
# The bytes to format.
|
74
73
|
#
|
75
|
-
# @option options [
|
74
|
+
# @option options [#include?, Regexp] :exclude
|
76
75
|
# The bytes not to format.
|
77
76
|
#
|
78
77
|
# @yield [char]
|
@@ -85,8 +84,33 @@ class String
|
|
85
84
|
# @return [String]
|
86
85
|
# The formatted version of the String.
|
87
86
|
#
|
87
|
+
# @api public
|
88
|
+
#
|
88
89
|
def format_chars(options={})
|
89
|
-
|
90
|
+
included = options.fetch(:include,/./m)
|
91
|
+
excluded = options.fetch(:exclude,Set[])
|
92
|
+
|
93
|
+
formatted = ''
|
94
|
+
|
95
|
+
matches = lambda { |filter,c|
|
96
|
+
if filter.respond_to?(:include?)
|
97
|
+
filter.include?(c)
|
98
|
+
elsif filter.kind_of?(Regexp)
|
99
|
+
c =~ filter
|
100
|
+
else
|
101
|
+
false
|
102
|
+
end
|
103
|
+
}
|
104
|
+
|
105
|
+
self.each_char do |c|
|
106
|
+
if (matches[included,c] && !matches[excluded,c])
|
107
|
+
formatted << yield(c)
|
108
|
+
else
|
109
|
+
formatted << c
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
return formatted
|
90
114
|
end
|
91
115
|
|
92
116
|
#
|
@@ -109,6 +133,8 @@ class String
|
|
109
133
|
# "get out your checkbook".random_case
|
110
134
|
# # => "gEt Out YOur CHEckbook"
|
111
135
|
#
|
136
|
+
# @api public
|
137
|
+
#
|
112
138
|
def random_case(options={})
|
113
139
|
prob = (options[:probability] || 0.5)
|
114
140
|
|
@@ -133,6 +159,8 @@ class String
|
|
133
159
|
# @return [String]
|
134
160
|
# The new modified String.
|
135
161
|
#
|
162
|
+
# @api public
|
163
|
+
#
|
136
164
|
def insert_before(pattern,data)
|
137
165
|
string = self.dup
|
138
166
|
index = string.index(pattern)
|
@@ -153,6 +181,8 @@ class String
|
|
153
181
|
# @return [String]
|
154
182
|
# The new modified String.
|
155
183
|
#
|
184
|
+
# @api public
|
185
|
+
#
|
156
186
|
def insert_after(pattern,data)
|
157
187
|
string = self.dup
|
158
188
|
match = string.match(pattern)
|
@@ -183,6 +213,8 @@ class String
|
|
183
213
|
# "hello".pad('A',50)
|
184
214
|
# # => "helloAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
185
215
|
#
|
216
|
+
# @api public
|
217
|
+
#
|
186
218
|
def pad(padding,max_length=self.length)
|
187
219
|
padding = padding.to_s
|
188
220
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
#
|
4
|
+
# This file is part of Ronin Support.
|
5
|
+
#
|
6
|
+
# Ronin Support is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# Ronin Support is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Lesser General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
17
|
+
# along with Ronin Support. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'ronin/formatting/extensions/html'
|
data/lib/ronin/mixin.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
#
|
4
|
+
# This file is part of Ronin.
|
5
|
+
#
|
6
|
+
# Ronin is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# Ronin is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#
|
19
|
+
|
20
|
+
module Ronin
|
21
|
+
#
|
22
|
+
# A base Module for all other Mixin modules. Adds a `mixin` method
|
23
|
+
# which includes/extends other Modules and evaluates a block of
|
24
|
+
# code, within any Classes/Objects it is included/extended into.
|
25
|
+
#
|
26
|
+
# module MyMixin
|
27
|
+
# include Mixin
|
28
|
+
#
|
29
|
+
# mixin Paremters
|
30
|
+
#
|
31
|
+
# mixin do
|
32
|
+
# parameter :user, :default => 'admin'
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# @since 0.2.0
|
37
|
+
#
|
38
|
+
module Mixin
|
39
|
+
#
|
40
|
+
# Defines the `mixin` method when included.
|
41
|
+
#
|
42
|
+
# @since 0.2.0
|
43
|
+
#
|
44
|
+
def self.included(base)
|
45
|
+
base.module_eval do
|
46
|
+
protected
|
47
|
+
|
48
|
+
#
|
49
|
+
# Mixins in the modules or code block into other modules that the
|
50
|
+
# module might be included or extended into.
|
51
|
+
#
|
52
|
+
# @param [Array<Module>] modules
|
53
|
+
# Other modules to mixin.
|
54
|
+
#
|
55
|
+
# @yield []
|
56
|
+
# The given code block will be evaluated into the modules
|
57
|
+
# the module is included or extended into.
|
58
|
+
#
|
59
|
+
# @since 0.2.0
|
60
|
+
#
|
61
|
+
# @api semipublic
|
62
|
+
#
|
63
|
+
def self.mixin(*modules,&block)
|
64
|
+
unless modules.empty?
|
65
|
+
@mixin_modules = modules
|
66
|
+
end
|
67
|
+
|
68
|
+
@mixin_block = block if block
|
69
|
+
|
70
|
+
def self.included(base)
|
71
|
+
if @mixin_modules
|
72
|
+
base.send(:include,*@mixin_modules)
|
73
|
+
end
|
74
|
+
|
75
|
+
base.module_eval(&@mixin_block) if @mixin_block
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.extended(base)
|
79
|
+
if @mixin_modules
|
80
|
+
base.send(:extend,*@mixin_modules)
|
81
|
+
end
|
82
|
+
|
83
|
+
base.instance_eval(&@mixin_block) if @mixin_block
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -23,6 +23,8 @@ module Net
|
|
23
23
|
#
|
24
24
|
# @see Ronin::Network::SMTP.message
|
25
25
|
#
|
26
|
+
# @api public
|
27
|
+
#
|
26
28
|
def Net.esmtp_message(options={},&block)
|
27
29
|
Net.smtp_message(options,&block)
|
28
30
|
end
|
@@ -62,6 +64,8 @@ module Net
|
|
62
64
|
# @return [Net::SMTP]
|
63
65
|
# The ESMTP enabled session.
|
64
66
|
#
|
67
|
+
# @api public
|
68
|
+
#
|
65
69
|
def Net.esmtp_connect(host,options={})
|
66
70
|
session = Net.smtp_connect(host,options)
|
67
71
|
session.esmtp = true
|
@@ -88,6 +92,8 @@ module Net
|
|
88
92
|
#
|
89
93
|
# @see Net.esmtp_connect
|
90
94
|
#
|
95
|
+
# @api public
|
96
|
+
#
|
91
97
|
def Net.esmtp_session(host,options={})
|
92
98
|
Net.smtp_session(host,options) do |session|
|
93
99
|
session.esmtp = true
|
@@ -69,6 +69,8 @@ module Net
|
|
69
69
|
# @return [Net::HTTP]
|
70
70
|
# The HTTP session object.
|
71
71
|
#
|
72
|
+
# @api public
|
73
|
+
#
|
72
74
|
def Net.http_connect(options={},&block)
|
73
75
|
options = Ronin::Network::HTTP.expand_options(options)
|
74
76
|
|
@@ -145,6 +147,8 @@ module Net
|
|
145
147
|
#
|
146
148
|
# @see Net.http_connect
|
147
149
|
#
|
150
|
+
# @api public
|
151
|
+
#
|
148
152
|
def Net.http_session(options={},&block)
|
149
153
|
Net.http_connect(options) do |sess,expanded_options|
|
150
154
|
if block
|
@@ -193,6 +197,8 @@ module Net
|
|
193
197
|
#
|
194
198
|
# @see http_session
|
195
199
|
#
|
200
|
+
# @api public
|
201
|
+
#
|
196
202
|
def Net.http_request(options={},&block)
|
197
203
|
resp = nil
|
198
204
|
|
@@ -213,6 +219,94 @@ module Net
|
|
213
219
|
return resp
|
214
220
|
end
|
215
221
|
|
222
|
+
#
|
223
|
+
# Returns the Status Code of the Response.
|
224
|
+
#
|
225
|
+
# @param [Hash] options
|
226
|
+
# Additional options.
|
227
|
+
#
|
228
|
+
# @option options [Symbol, String] :method (:head)
|
229
|
+
# The method to use for the request.
|
230
|
+
#
|
231
|
+
# @return [Integer]
|
232
|
+
# The HTTP Response Status.
|
233
|
+
#
|
234
|
+
# @see http_request
|
235
|
+
#
|
236
|
+
# @since 0.2.0
|
237
|
+
#
|
238
|
+
# @api public
|
239
|
+
#
|
240
|
+
def Net.http_status(options={})
|
241
|
+
options = {:method => :head}.merge(options)
|
242
|
+
|
243
|
+
return Net.http_request(options).code.to_i
|
244
|
+
end
|
245
|
+
|
246
|
+
#
|
247
|
+
# Checks if the response has an HTTP OK status code.
|
248
|
+
#
|
249
|
+
# @param [Hash] options
|
250
|
+
# Additional options.
|
251
|
+
#
|
252
|
+
# @option options [Symbol, String] :method (:head)
|
253
|
+
# The method to use for the request.
|
254
|
+
#
|
255
|
+
# @return [Boolean]
|
256
|
+
# Specifies wether the response had an HTTP OK status code or not.
|
257
|
+
#
|
258
|
+
# @see http_status
|
259
|
+
#
|
260
|
+
# @api public
|
261
|
+
#
|
262
|
+
def Net.http_ok?(options={})
|
263
|
+
Net.http_status(options) == 200
|
264
|
+
end
|
265
|
+
|
266
|
+
#
|
267
|
+
# Sends a HTTP Head request and returns the HTTP Server header.
|
268
|
+
#
|
269
|
+
# @param [Hash] options
|
270
|
+
# Additional options.
|
271
|
+
#
|
272
|
+
# @option options [Symbol, String] :method (:head)
|
273
|
+
# The method to use for the request.
|
274
|
+
#
|
275
|
+
# @return [String]
|
276
|
+
# The HTTP `Server` header.
|
277
|
+
#
|
278
|
+
# @see http_request
|
279
|
+
#
|
280
|
+
# @api public
|
281
|
+
#
|
282
|
+
def Net.http_server(options={})
|
283
|
+
options = {:method => :head}.merge(options)
|
284
|
+
|
285
|
+
return Net.http_request(options)['server']
|
286
|
+
end
|
287
|
+
|
288
|
+
#
|
289
|
+
# Sends an HTTP Head request and returns the HTTP X-Powered-By header.
|
290
|
+
#
|
291
|
+
# @param [Hash] options
|
292
|
+
# Additional options.
|
293
|
+
#
|
294
|
+
# @option options [Symbol, String] :method (:get)
|
295
|
+
# The method to use for the request.
|
296
|
+
#
|
297
|
+
# @return [String]
|
298
|
+
# The HTTP `X-Powered-By` header.
|
299
|
+
#
|
300
|
+
# @see http_request
|
301
|
+
#
|
302
|
+
# @api public
|
303
|
+
#
|
304
|
+
def Net.http_powered_by(options={})
|
305
|
+
options = {:method => :get}.merge(options)
|
306
|
+
|
307
|
+
return Net.http_request(options)['x-powered-by']
|
308
|
+
end
|
309
|
+
|
216
310
|
#
|
217
311
|
# Performs an HTTP Copy request.
|
218
312
|
#
|
@@ -231,6 +325,8 @@ module Net
|
|
231
325
|
#
|
232
326
|
# @see http_request
|
233
327
|
#
|
328
|
+
# @api public
|
329
|
+
#
|
234
330
|
def Net.http_copy(options={})
|
235
331
|
resp = Net.http_request(options.merge(:method => :copy))
|
236
332
|
|
@@ -256,6 +352,8 @@ module Net
|
|
256
352
|
#
|
257
353
|
# @see http_request
|
258
354
|
#
|
355
|
+
# @api public
|
356
|
+
#
|
259
357
|
def Net.http_delete(options={},&block)
|
260
358
|
original_headers = options[:headers]
|
261
359
|
|
@@ -290,6 +388,8 @@ module Net
|
|
290
388
|
#
|
291
389
|
# @see http_request
|
292
390
|
#
|
391
|
+
# @api public
|
392
|
+
#
|
293
393
|
def Net.http_get(options={},&block)
|
294
394
|
resp = Net.http_request(options.merge(:method => :get))
|
295
395
|
|
@@ -315,6 +415,8 @@ module Net
|
|
315
415
|
#
|
316
416
|
# @see http_request
|
317
417
|
#
|
418
|
+
# @api public
|
419
|
+
#
|
318
420
|
def Net.http_get_body(options={},&block)
|
319
421
|
Net.http_get(options,&block).body
|
320
422
|
end
|
@@ -337,6 +439,8 @@ module Net
|
|
337
439
|
#
|
338
440
|
# @see http_request
|
339
441
|
#
|
442
|
+
# @api public
|
443
|
+
#
|
340
444
|
def Net.http_head(options={},&block)
|
341
445
|
resp = Net.http_request(options.merge(:method => :head))
|
342
446
|
|
@@ -344,57 +448,6 @@ module Net
|
|
344
448
|
return resp
|
345
449
|
end
|
346
450
|
|
347
|
-
#
|
348
|
-
# Checks if the response has an HTTP OK status code.
|
349
|
-
#
|
350
|
-
# @param [Hash] options
|
351
|
-
# Additional options.
|
352
|
-
#
|
353
|
-
# @return [Boolean]
|
354
|
-
# Specifies wether the response had an HTTP OK status code or not.
|
355
|
-
#
|
356
|
-
# @see http_request
|
357
|
-
#
|
358
|
-
def Net.http_ok?(options={})
|
359
|
-
Net.http_head(options).code == 200
|
360
|
-
end
|
361
|
-
|
362
|
-
#
|
363
|
-
# Sends a HTTP Head request and returns the HTTP Server header.
|
364
|
-
#
|
365
|
-
# @param [Hash] options
|
366
|
-
# Additional options.
|
367
|
-
#
|
368
|
-
# @return [String]
|
369
|
-
# The HTTP `Server` header.
|
370
|
-
#
|
371
|
-
# @see http_request
|
372
|
-
#
|
373
|
-
def Net.http_server(options={})
|
374
|
-
Net.http_head(options)['server']
|
375
|
-
end
|
376
|
-
|
377
|
-
#
|
378
|
-
# Sends an HTTP Head request and returns the HTTP X-Powered-By header.
|
379
|
-
#
|
380
|
-
# @param [Hash] options
|
381
|
-
# Additional options.
|
382
|
-
#
|
383
|
-
# @return [String]
|
384
|
-
# The HTTP `X-Powered-By` header.
|
385
|
-
#
|
386
|
-
# @see http_request
|
387
|
-
#
|
388
|
-
def Net.http_powered_by(options={})
|
389
|
-
resp = Net.http_head(options)
|
390
|
-
|
391
|
-
if resp.code != 200
|
392
|
-
resp = Net.http_get(options)
|
393
|
-
end
|
394
|
-
|
395
|
-
return resp['x-powered-by']
|
396
|
-
end
|
397
|
-
|
398
451
|
#
|
399
452
|
# Performs an HTTP Lock request.
|
400
453
|
#
|
@@ -413,6 +466,8 @@ module Net
|
|
413
466
|
#
|
414
467
|
# @see http_request
|
415
468
|
#
|
469
|
+
# @api public
|
470
|
+
#
|
416
471
|
def Net.http_lock(options={},&block)
|
417
472
|
resp = Net.http_request(options.merge(:method => :lock))
|
418
473
|
|
@@ -438,6 +493,8 @@ module Net
|
|
438
493
|
#
|
439
494
|
# @see http_request
|
440
495
|
#
|
496
|
+
# @api public
|
497
|
+
#
|
441
498
|
def Net.http_mkcol(options={},&block)
|
442
499
|
resp = Net.http_request(options.merge(:method => :mkcol))
|
443
500
|
|
@@ -463,6 +520,8 @@ module Net
|
|
463
520
|
#
|
464
521
|
# @see http_request
|
465
522
|
#
|
523
|
+
# @api public
|
524
|
+
#
|
466
525
|
def Net.http_move(options={},&block)
|
467
526
|
resp = Net.http_request(options.merge(:method => :move))
|
468
527
|
|
@@ -488,6 +547,8 @@ module Net
|
|
488
547
|
#
|
489
548
|
# @see http_request
|
490
549
|
#
|
550
|
+
# @api public
|
551
|
+
#
|
491
552
|
def Net.http_options(options={},&block)
|
492
553
|
resp = Net.http_request(options.merge(:method => :options))
|
493
554
|
|
@@ -516,6 +577,8 @@ module Net
|
|
516
577
|
#
|
517
578
|
# @see http_request
|
518
579
|
#
|
580
|
+
# @api public
|
581
|
+
#
|
519
582
|
def Net.http_post(options={},&block)
|
520
583
|
resp = Net.http_request(options.merge(:method => :post))
|
521
584
|
|
@@ -544,6 +607,8 @@ module Net
|
|
544
607
|
#
|
545
608
|
# @see http_request
|
546
609
|
#
|
610
|
+
# @api public
|
611
|
+
#
|
547
612
|
def Net.http_post_body(options={},&block)
|
548
613
|
Net.http_post(options,&block).body
|
549
614
|
end
|
@@ -566,6 +631,8 @@ module Net
|
|
566
631
|
#
|
567
632
|
# @see http_request
|
568
633
|
#
|
634
|
+
# @api public
|
635
|
+
#
|
569
636
|
def Net.http_prop_find(options={},&block)
|
570
637
|
original_headers = options[:headers]
|
571
638
|
|
@@ -600,6 +667,8 @@ module Net
|
|
600
667
|
#
|
601
668
|
# @see http_request
|
602
669
|
#
|
670
|
+
# @api public
|
671
|
+
#
|
603
672
|
def Net.http_prop_patch(options={},&block)
|
604
673
|
resp = Net.http_request(options.merge(:method => :proppatch))
|
605
674
|
|
@@ -625,6 +694,8 @@ module Net
|
|
625
694
|
#
|
626
695
|
# @see http_request
|
627
696
|
#
|
697
|
+
# @api public
|
698
|
+
#
|
628
699
|
def Net.http_trace(options={},&block)
|
629
700
|
resp = Net.http_request(options.merge(:method => :trace))
|
630
701
|
|
@@ -650,6 +721,8 @@ module Net
|
|
650
721
|
#
|
651
722
|
# @see http_request
|
652
723
|
#
|
724
|
+
# @api public
|
725
|
+
#
|
653
726
|
def Net.http_unlock(options={},&block)
|
654
727
|
resp = Net.http_request(options.merge(:method => :unlock))
|
655
728
|
|