net-http 0.1.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/test.yml +3 -5
- data/.gitignore +0 -1
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/doc/net-http/examples.rdoc +30 -0
- data/lib/net/http/backward.rb +26 -12
- data/lib/net/http/exceptions.rb +27 -26
- data/lib/net/http/generic_request.rb +6 -7
- data/lib/net/http/header.rb +473 -105
- data/lib/net/http/request.rb +27 -5
- data/lib/net/http/requests.rb +296 -24
- data/lib/net/http/response.rb +303 -12
- data/lib/net/http/responses.rb +638 -223
- data/lib/net/http.rb +681 -371
- data/net-http.gemspec +0 -2
- metadata +5 -18
- data/Gemfile.lock +0 -23
data/lib/net/http/request.rb
CHANGED
@@ -1,8 +1,31 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
|
-
|
3
|
-
# This class
|
4
|
-
#
|
5
|
-
#
|
2
|
+
|
3
|
+
# This class is the base class for \Net::HTTP request classes;
|
4
|
+
# it wraps together the request path and the request headers.
|
5
|
+
#
|
6
|
+
# The class should not be used directly;
|
7
|
+
# instead you should use its subclasses.
|
8
|
+
#
|
9
|
+
# Subclasses for HTTP requests:
|
10
|
+
#
|
11
|
+
# - Net::HTTP::Get
|
12
|
+
# - Net::HTTP::Head
|
13
|
+
# - Net::HTTP::Post
|
14
|
+
# - Net::HTTP::Put
|
15
|
+
# - Net::HTTP::Delete
|
16
|
+
# - Net::HTTP::Options
|
17
|
+
# - Net::HTTP::Trace
|
18
|
+
# - Net::HTTP::Patch
|
19
|
+
#
|
20
|
+
# Subclasses for WebDAV requests:
|
21
|
+
#
|
22
|
+
# - Net::HTTP::Propfind
|
23
|
+
# - Net::HTTP::Proppatch
|
24
|
+
# - Net::HTTP::Mkcol
|
25
|
+
# - Net::HTTP::Copy
|
26
|
+
# - Net::HTTP::Move
|
27
|
+
# - Net::HTTP::Lock
|
28
|
+
# - Net::HTTP::Unlock
|
6
29
|
#
|
7
30
|
class Net::HTTPRequest < Net::HTTPGenericRequest
|
8
31
|
# Creates an HTTP request object for +path+.
|
@@ -18,4 +41,3 @@ class Net::HTTPRequest < Net::HTTPGenericRequest
|
|
18
41
|
path, initheader
|
19
42
|
end
|
20
43
|
end
|
21
|
-
|
data/lib/net/http/requests.rb
CHANGED
@@ -1,67 +1,241 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
|
-
|
2
|
+
|
3
3
|
# HTTP/1.1 methods --- RFC2616
|
4
|
-
#
|
5
4
|
|
6
|
-
#
|
7
|
-
#
|
5
|
+
# \Class for representing
|
6
|
+
# {HTTP method GET}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#GET_method]:
|
7
|
+
#
|
8
|
+
# require 'net/http'
|
9
|
+
# uri = URI('http://example.com')
|
10
|
+
# hostname = uri.hostname # => "example.com"
|
11
|
+
# req = Net::HTTP::Get.new(uri) # => #<Net::HTTP::Get GET>
|
12
|
+
# res = Net::HTTP.start(hostname) do |http|
|
13
|
+
# http.request(req)
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# Properties:
|
17
|
+
#
|
18
|
+
# - Request body: optional.
|
19
|
+
# - Response body: yes.
|
20
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: yes.
|
21
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
22
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: yes.
|
23
|
+
#
|
24
|
+
# Related:
|
25
|
+
#
|
26
|
+
# - Net::HTTP.get: sends +GET+ request, returns response body.
|
27
|
+
# - Net::HTTP#get: sends +GET+ request, returns response object.
|
28
|
+
#
|
8
29
|
class Net::HTTP::Get < Net::HTTPRequest
|
9
30
|
METHOD = 'GET'
|
10
31
|
REQUEST_HAS_BODY = false
|
11
32
|
RESPONSE_HAS_BODY = true
|
12
33
|
end
|
13
34
|
|
14
|
-
#
|
15
|
-
#
|
35
|
+
# \Class for representing
|
36
|
+
# {HTTP method HEAD}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#HEAD_method]:
|
37
|
+
#
|
38
|
+
# require 'net/http'
|
39
|
+
# uri = URI('http://example.com')
|
40
|
+
# hostname = uri.hostname # => "example.com"
|
41
|
+
# req = Net::HTTP::Head.new(uri) # => #<Net::HTTP::Head HEAD>
|
42
|
+
# res = Net::HTTP.start(hostname) do |http|
|
43
|
+
# http.request(req)
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# Properties:
|
47
|
+
#
|
48
|
+
# - Request body: optional.
|
49
|
+
# - Response body: no.
|
50
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: yes.
|
51
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
52
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: yes.
|
53
|
+
#
|
54
|
+
# Related:
|
55
|
+
#
|
56
|
+
# - Net::HTTP#head: sends +HEAD+ request, returns response object.
|
57
|
+
#
|
16
58
|
class Net::HTTP::Head < Net::HTTPRequest
|
17
59
|
METHOD = 'HEAD'
|
18
60
|
REQUEST_HAS_BODY = false
|
19
61
|
RESPONSE_HAS_BODY = false
|
20
62
|
end
|
21
63
|
|
22
|
-
#
|
23
|
-
#
|
64
|
+
# \Class for representing
|
65
|
+
# {HTTP method POST}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#POST_method]:
|
66
|
+
#
|
67
|
+
# require 'net/http'
|
68
|
+
# uri = URI('http://example.com')
|
69
|
+
# hostname = uri.hostname # => "example.com"
|
70
|
+
# uri.path = '/posts'
|
71
|
+
# req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST>
|
72
|
+
# req.body = '{"title": "foo","body": "bar","userId": 1}'
|
73
|
+
# req.content_type = 'application/json'
|
74
|
+
# res = Net::HTTP.start(hostname) do |http|
|
75
|
+
# http.request(req)
|
76
|
+
# end
|
77
|
+
#
|
78
|
+
# Properties:
|
79
|
+
#
|
80
|
+
# - Request body: yes.
|
81
|
+
# - Response body: yes.
|
82
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: no.
|
83
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: no.
|
84
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: yes.
|
85
|
+
#
|
86
|
+
# Related:
|
87
|
+
#
|
88
|
+
# - Net::HTTP.post: sends +POST+ request, returns response object.
|
89
|
+
# - Net::HTTP#post: sends +POST+ request, returns response object.
|
90
|
+
#
|
24
91
|
class Net::HTTP::Post < Net::HTTPRequest
|
25
92
|
METHOD = 'POST'
|
26
93
|
REQUEST_HAS_BODY = true
|
27
94
|
RESPONSE_HAS_BODY = true
|
28
95
|
end
|
29
96
|
|
30
|
-
#
|
31
|
-
#
|
97
|
+
# \Class for representing
|
98
|
+
# {HTTP method PUT}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#PUT_method]:
|
99
|
+
#
|
100
|
+
# require 'net/http'
|
101
|
+
# uri = URI('http://example.com')
|
102
|
+
# hostname = uri.hostname # => "example.com"
|
103
|
+
# uri.path = '/posts'
|
104
|
+
# req = Net::HTTP::Put.new(uri) # => #<Net::HTTP::Put PUT>
|
105
|
+
# req.body = '{"title": "foo","body": "bar","userId": 1}'
|
106
|
+
# req.content_type = 'application/json'
|
107
|
+
# res = Net::HTTP.start(hostname) do |http|
|
108
|
+
# http.request(req)
|
109
|
+
# end
|
110
|
+
#
|
111
|
+
# Properties:
|
112
|
+
#
|
113
|
+
# - Request body: yes.
|
114
|
+
# - Response body: yes.
|
115
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: no.
|
116
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
117
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
|
118
|
+
#
|
32
119
|
class Net::HTTP::Put < Net::HTTPRequest
|
33
120
|
METHOD = 'PUT'
|
34
121
|
REQUEST_HAS_BODY = true
|
35
122
|
RESPONSE_HAS_BODY = true
|
36
123
|
end
|
37
124
|
|
38
|
-
#
|
39
|
-
#
|
125
|
+
# \Class for representing
|
126
|
+
# {HTTP method DELETE}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#DELETE_method]:
|
127
|
+
#
|
128
|
+
# require 'net/http'
|
129
|
+
# uri = URI('http://example.com')
|
130
|
+
# hostname = uri.hostname # => "example.com"
|
131
|
+
# uri.path = '/posts/1'
|
132
|
+
# req = Net::HTTP::Delete.new(uri) # => #<Net::HTTP::Delete DELETE>
|
133
|
+
# res = Net::HTTP.start(hostname) do |http|
|
134
|
+
# http.request(req)
|
135
|
+
# end
|
136
|
+
#
|
137
|
+
# Properties:
|
138
|
+
#
|
139
|
+
# - Request body: optional.
|
140
|
+
# - Response body: yes.
|
141
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: no.
|
142
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
143
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
|
144
|
+
#
|
145
|
+
# Related:
|
146
|
+
#
|
147
|
+
# - Net::HTTP#delete: sends +DELETE+ request, returns response object.
|
148
|
+
#
|
40
149
|
class Net::HTTP::Delete < Net::HTTPRequest
|
41
150
|
METHOD = 'DELETE'
|
42
151
|
REQUEST_HAS_BODY = false
|
43
152
|
RESPONSE_HAS_BODY = true
|
44
153
|
end
|
45
154
|
|
46
|
-
#
|
155
|
+
# \Class for representing
|
156
|
+
# {HTTP method OPTIONS}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#OPTIONS_method]:
|
157
|
+
#
|
158
|
+
# require 'net/http'
|
159
|
+
# uri = URI('http://example.com')
|
160
|
+
# hostname = uri.hostname # => "example.com"
|
161
|
+
# req = Net::HTTP::Options.new(uri) # => #<Net::HTTP::Options OPTIONS>
|
162
|
+
# res = Net::HTTP.start(hostname) do |http|
|
163
|
+
# http.request(req)
|
164
|
+
# end
|
165
|
+
#
|
166
|
+
# Properties:
|
167
|
+
#
|
168
|
+
# - Request body: optional.
|
169
|
+
# - Response body: yes.
|
170
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: yes.
|
171
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
172
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
|
173
|
+
#
|
174
|
+
# Related:
|
175
|
+
#
|
176
|
+
# - Net::HTTP#options: sends +OPTIONS+ request, returns response object.
|
177
|
+
#
|
47
178
|
class Net::HTTP::Options < Net::HTTPRequest
|
48
179
|
METHOD = 'OPTIONS'
|
49
180
|
REQUEST_HAS_BODY = false
|
50
181
|
RESPONSE_HAS_BODY = true
|
51
182
|
end
|
52
183
|
|
53
|
-
#
|
184
|
+
# \Class for representing
|
185
|
+
# {HTTP method TRACE}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#TRACE_method]:
|
186
|
+
#
|
187
|
+
# require 'net/http'
|
188
|
+
# uri = URI('http://example.com')
|
189
|
+
# hostname = uri.hostname # => "example.com"
|
190
|
+
# req = Net::HTTP::Trace.new(uri) # => #<Net::HTTP::Trace TRACE>
|
191
|
+
# res = Net::HTTP.start(hostname) do |http|
|
192
|
+
# http.request(req)
|
193
|
+
# end
|
194
|
+
#
|
195
|
+
# Properties:
|
196
|
+
#
|
197
|
+
# - Request body: no.
|
198
|
+
# - Response body: yes.
|
199
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: yes.
|
200
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
201
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
|
202
|
+
#
|
203
|
+
# Related:
|
204
|
+
#
|
205
|
+
# - Net::HTTP#trace: sends +TRACE+ request, returns response object.
|
206
|
+
#
|
54
207
|
class Net::HTTP::Trace < Net::HTTPRequest
|
55
208
|
METHOD = 'TRACE'
|
56
209
|
REQUEST_HAS_BODY = false
|
57
210
|
RESPONSE_HAS_BODY = true
|
58
211
|
end
|
59
212
|
|
213
|
+
# \Class for representing
|
214
|
+
# {HTTP method PATCH}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#PATCH_method]:
|
60
215
|
#
|
61
|
-
#
|
216
|
+
# require 'net/http'
|
217
|
+
# uri = URI('http://example.com')
|
218
|
+
# hostname = uri.hostname # => "example.com"
|
219
|
+
# uri.path = '/posts'
|
220
|
+
# req = Net::HTTP::Patch.new(uri) # => #<Net::HTTP::Patch PATCH>
|
221
|
+
# req.body = '{"title": "foo","body": "bar","userId": 1}'
|
222
|
+
# req.content_type = 'application/json'
|
223
|
+
# res = Net::HTTP.start(hostname) do |http|
|
224
|
+
# http.request(req)
|
225
|
+
# end
|
226
|
+
#
|
227
|
+
# Properties:
|
228
|
+
#
|
229
|
+
# - Request body: yes.
|
230
|
+
# - Response body: yes.
|
231
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: no.
|
232
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: no.
|
233
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
|
234
|
+
#
|
235
|
+
# Related:
|
236
|
+
#
|
237
|
+
# - Net::HTTP#patch: sends +PATCH+ request, returns response object.
|
62
238
|
#
|
63
|
-
|
64
|
-
# See Net::HTTPGenericRequest for attributes and methods.
|
65
239
|
class Net::HTTP::Patch < Net::HTTPRequest
|
66
240
|
METHOD = 'PATCH'
|
67
241
|
REQUEST_HAS_BODY = true
|
@@ -72,49 +246,147 @@ end
|
|
72
246
|
# WebDAV methods --- RFC2518
|
73
247
|
#
|
74
248
|
|
75
|
-
#
|
249
|
+
# \Class for representing
|
250
|
+
# {WebDAV method PROPFIND}[http://www.webdav.org/specs/rfc4918.html#METHOD_PROPFIND]:
|
251
|
+
#
|
252
|
+
# require 'net/http'
|
253
|
+
# uri = URI('http://example.com')
|
254
|
+
# hostname = uri.hostname # => "example.com"
|
255
|
+
# req = Net::HTTP::Propfind.new(uri) # => #<Net::HTTP::Propfind PROPFIND>
|
256
|
+
# res = Net::HTTP.start(hostname) do |http|
|
257
|
+
# http.request(req)
|
258
|
+
# end
|
259
|
+
#
|
260
|
+
# Related:
|
261
|
+
#
|
262
|
+
# - Net::HTTP#propfind: sends +PROPFIND+ request, returns response object.
|
263
|
+
#
|
76
264
|
class Net::HTTP::Propfind < Net::HTTPRequest
|
77
265
|
METHOD = 'PROPFIND'
|
78
266
|
REQUEST_HAS_BODY = true
|
79
267
|
RESPONSE_HAS_BODY = true
|
80
268
|
end
|
81
269
|
|
82
|
-
#
|
270
|
+
# \Class for representing
|
271
|
+
# {WebDAV method PROPPATCH}[http://www.webdav.org/specs/rfc4918.html#METHOD_PROPPATCH]:
|
272
|
+
#
|
273
|
+
# require 'net/http'
|
274
|
+
# uri = URI('http://example.com')
|
275
|
+
# hostname = uri.hostname # => "example.com"
|
276
|
+
# req = Net::HTTP::Proppatch.new(uri) # => #<Net::HTTP::Proppatch PROPPATCH>
|
277
|
+
# res = Net::HTTP.start(hostname) do |http|
|
278
|
+
# http.request(req)
|
279
|
+
# end
|
280
|
+
#
|
281
|
+
# Related:
|
282
|
+
#
|
283
|
+
# - Net::HTTP#proppatch: sends +PROPPATCH+ request, returns response object.
|
284
|
+
#
|
83
285
|
class Net::HTTP::Proppatch < Net::HTTPRequest
|
84
286
|
METHOD = 'PROPPATCH'
|
85
287
|
REQUEST_HAS_BODY = true
|
86
288
|
RESPONSE_HAS_BODY = true
|
87
289
|
end
|
88
290
|
|
89
|
-
#
|
291
|
+
# \Class for representing
|
292
|
+
# {WebDAV method MKCOL}[http://www.webdav.org/specs/rfc4918.html#METHOD_MKCOL]:
|
293
|
+
#
|
294
|
+
# require 'net/http'
|
295
|
+
# uri = URI('http://example.com')
|
296
|
+
# hostname = uri.hostname # => "example.com"
|
297
|
+
# req = Net::HTTP::Mkcol.new(uri) # => #<Net::HTTP::Mkcol MKCOL>
|
298
|
+
# res = Net::HTTP.start(hostname) do |http|
|
299
|
+
# http.request(req)
|
300
|
+
# end
|
301
|
+
#
|
302
|
+
# Related:
|
303
|
+
#
|
304
|
+
# - Net::HTTP#mkcol: sends +MKCOL+ request, returns response object.
|
305
|
+
#
|
90
306
|
class Net::HTTP::Mkcol < Net::HTTPRequest
|
91
307
|
METHOD = 'MKCOL'
|
92
308
|
REQUEST_HAS_BODY = true
|
93
309
|
RESPONSE_HAS_BODY = true
|
94
310
|
end
|
95
311
|
|
96
|
-
#
|
312
|
+
# \Class for representing
|
313
|
+
# {WebDAV method COPY}[http://www.webdav.org/specs/rfc4918.html#METHOD_COPY]:
|
314
|
+
#
|
315
|
+
# require 'net/http'
|
316
|
+
# uri = URI('http://example.com')
|
317
|
+
# hostname = uri.hostname # => "example.com"
|
318
|
+
# req = Net::HTTP::Copy.new(uri) # => #<Net::HTTP::Copy COPY>
|
319
|
+
# res = Net::HTTP.start(hostname) do |http|
|
320
|
+
# http.request(req)
|
321
|
+
# end
|
322
|
+
#
|
323
|
+
# Related:
|
324
|
+
#
|
325
|
+
# - Net::HTTP#copy: sends +COPY+ request, returns response object.
|
326
|
+
#
|
97
327
|
class Net::HTTP::Copy < Net::HTTPRequest
|
98
328
|
METHOD = 'COPY'
|
99
329
|
REQUEST_HAS_BODY = false
|
100
330
|
RESPONSE_HAS_BODY = true
|
101
331
|
end
|
102
332
|
|
103
|
-
#
|
333
|
+
# \Class for representing
|
334
|
+
# {WebDAV method MOVE}[http://www.webdav.org/specs/rfc4918.html#METHOD_MOVE]:
|
335
|
+
#
|
336
|
+
# require 'net/http'
|
337
|
+
# uri = URI('http://example.com')
|
338
|
+
# hostname = uri.hostname # => "example.com"
|
339
|
+
# req = Net::HTTP::Move.new(uri) # => #<Net::HTTP::Move MOVE>
|
340
|
+
# res = Net::HTTP.start(hostname) do |http|
|
341
|
+
# http.request(req)
|
342
|
+
# end
|
343
|
+
#
|
344
|
+
# Related:
|
345
|
+
#
|
346
|
+
# - Net::HTTP#move: sends +MOVE+ request, returns response object.
|
347
|
+
#
|
104
348
|
class Net::HTTP::Move < Net::HTTPRequest
|
105
349
|
METHOD = 'MOVE'
|
106
350
|
REQUEST_HAS_BODY = false
|
107
351
|
RESPONSE_HAS_BODY = true
|
108
352
|
end
|
109
353
|
|
110
|
-
#
|
354
|
+
# \Class for representing
|
355
|
+
# {WebDAV method LOCK}[http://www.webdav.org/specs/rfc4918.html#METHOD_LOCK]:
|
356
|
+
#
|
357
|
+
# require 'net/http'
|
358
|
+
# uri = URI('http://example.com')
|
359
|
+
# hostname = uri.hostname # => "example.com"
|
360
|
+
# req = Net::HTTP::Lock.new(uri) # => #<Net::HTTP::Lock LOCK>
|
361
|
+
# res = Net::HTTP.start(hostname) do |http|
|
362
|
+
# http.request(req)
|
363
|
+
# end
|
364
|
+
#
|
365
|
+
# Related:
|
366
|
+
#
|
367
|
+
# - Net::HTTP#lock: sends +LOCK+ request, returns response object.
|
368
|
+
#
|
111
369
|
class Net::HTTP::Lock < Net::HTTPRequest
|
112
370
|
METHOD = 'LOCK'
|
113
371
|
REQUEST_HAS_BODY = true
|
114
372
|
RESPONSE_HAS_BODY = true
|
115
373
|
end
|
116
374
|
|
117
|
-
#
|
375
|
+
# \Class for representing
|
376
|
+
# {WebDAV method UNLOCK}[http://www.webdav.org/specs/rfc4918.html#METHOD_UNLOCK]:
|
377
|
+
#
|
378
|
+
# require 'net/http'
|
379
|
+
# uri = URI('http://example.com')
|
380
|
+
# hostname = uri.hostname # => "example.com"
|
381
|
+
# req = Net::HTTP::Unlock.new(uri) # => #<Net::HTTP::Unlock UNLOCK>
|
382
|
+
# res = Net::HTTP.start(hostname) do |http|
|
383
|
+
# http.request(req)
|
384
|
+
# end
|
385
|
+
#
|
386
|
+
# Related:
|
387
|
+
#
|
388
|
+
# - Net::HTTP#unlock: sends +UNLOCK+ request, returns response object.
|
389
|
+
#
|
118
390
|
class Net::HTTP::Unlock < Net::HTTPRequest
|
119
391
|
METHOD = 'UNLOCK'
|
120
392
|
REQUEST_HAS_BODY = true
|