net-http 0.1.1 → 0.4.1
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/Gemfile +2 -0
- data/README.md +1 -1
- data/Rakefile +0 -7
- data/doc/net-http/examples.rdoc +31 -0
- data/doc/net-http/included_getters.rdoc +3 -0
- data/lib/net/http/backward.rb +27 -13
- data/lib/net/http/exceptions.rb +28 -27
- data/lib/net/http/generic_request.rb +96 -21
- data/lib/net/http/header.rb +628 -163
- data/lib/net/http/proxy_delta.rb +1 -1
- data/lib/net/http/request.rb +73 -6
- data/lib/net/http/requests.rb +327 -25
- data/lib/net/http/response.rb +339 -28
- data/lib/net/http/responses.rb +1090 -223
- data/lib/net/http/status.rb +7 -6
- data/lib/net/http.rb +1458 -668
- data/lib/net/https.rb +1 -1
- data/net-http.gemspec +9 -6
- metadata +5 -20
- data/.github/workflows/test.yml +0 -24
- data/.gitignore +0 -8
- data/Gemfile.lock +0 -23
data/lib/net/http/proxy_delta.rb
CHANGED
data/lib/net/http/request.rb
CHANGED
@@ -1,8 +1,76 @@
|
|
1
|
-
# frozen_string_literal:
|
2
|
-
|
3
|
-
# This class
|
4
|
-
#
|
5
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This class is the base class for \Net::HTTP request classes.
|
4
|
+
# The class should not be used directly;
|
5
|
+
# instead you should use its subclasses, listed below.
|
6
|
+
#
|
7
|
+
# == Creating a Request
|
8
|
+
#
|
9
|
+
# An request object may be created with either a URI or a string hostname:
|
10
|
+
#
|
11
|
+
# require 'net/http'
|
12
|
+
# uri = URI('https://jsonplaceholder.typicode.com/')
|
13
|
+
# req = Net::HTTP::Get.new(uri) # => #<Net::HTTP::Get GET>
|
14
|
+
# req = Net::HTTP::Get.new(uri.hostname) # => #<Net::HTTP::Get GET>
|
15
|
+
#
|
16
|
+
# And with any of the subclasses:
|
17
|
+
#
|
18
|
+
# req = Net::HTTP::Head.new(uri) # => #<Net::HTTP::Head HEAD>
|
19
|
+
# req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST>
|
20
|
+
# req = Net::HTTP::Put.new(uri) # => #<Net::HTTP::Put PUT>
|
21
|
+
# # ...
|
22
|
+
#
|
23
|
+
# The new instance is suitable for use as the argument to Net::HTTP#request.
|
24
|
+
#
|
25
|
+
# == Request Headers
|
26
|
+
#
|
27
|
+
# A new request object has these header fields by default:
|
28
|
+
#
|
29
|
+
# req.to_hash
|
30
|
+
# # =>
|
31
|
+
# {"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],
|
32
|
+
# "accept"=>["*/*"],
|
33
|
+
# "user-agent"=>["Ruby"],
|
34
|
+
# "host"=>["jsonplaceholder.typicode.com"]}
|
35
|
+
#
|
36
|
+
# See:
|
37
|
+
#
|
38
|
+
# - {Request header Accept-Encoding}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Accept-Encoding]
|
39
|
+
# and {Compression and Decompression}[rdoc-ref:Net::HTTP@Compression+and+Decompression].
|
40
|
+
# - {Request header Accept}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#accept-request-header].
|
41
|
+
# - {Request header User-Agent}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#user-agent-request-header].
|
42
|
+
# - {Request header Host}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#host-request-header].
|
43
|
+
#
|
44
|
+
# You can add headers or override default headers:
|
45
|
+
#
|
46
|
+
# # res = Net::HTTP::Get.new(uri, {'foo' => '0', 'bar' => '1'})
|
47
|
+
#
|
48
|
+
# This class (and therefore its subclasses) also includes (indirectly)
|
49
|
+
# module Net::HTTPHeader, which gives access to its
|
50
|
+
# {methods for setting headers}[rdoc-ref:Net::HTTPHeader@Setters].
|
51
|
+
#
|
52
|
+
# == Request Subclasses
|
53
|
+
#
|
54
|
+
# Subclasses for HTTP requests:
|
55
|
+
#
|
56
|
+
# - Net::HTTP::Get
|
57
|
+
# - Net::HTTP::Head
|
58
|
+
# - Net::HTTP::Post
|
59
|
+
# - Net::HTTP::Put
|
60
|
+
# - Net::HTTP::Delete
|
61
|
+
# - Net::HTTP::Options
|
62
|
+
# - Net::HTTP::Trace
|
63
|
+
# - Net::HTTP::Patch
|
64
|
+
#
|
65
|
+
# Subclasses for WebDAV requests:
|
66
|
+
#
|
67
|
+
# - Net::HTTP::Propfind
|
68
|
+
# - Net::HTTP::Proppatch
|
69
|
+
# - Net::HTTP::Mkcol
|
70
|
+
# - Net::HTTP::Copy
|
71
|
+
# - Net::HTTP::Move
|
72
|
+
# - Net::HTTP::Lock
|
73
|
+
# - Net::HTTP::Unlock
|
6
74
|
#
|
7
75
|
class Net::HTTPRequest < Net::HTTPGenericRequest
|
8
76
|
# Creates an HTTP request object for +path+.
|
@@ -18,4 +86,3 @@ class Net::HTTPRequest < Net::HTTPGenericRequest
|
|
18
86
|
path, initheader
|
19
87
|
end
|
20
88
|
end
|
21
|
-
|
data/lib/net/http/requests.rb
CHANGED
@@ -1,67 +1,257 @@
|
|
1
|
-
# frozen_string_literal:
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
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
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
17
|
+
#
|
18
|
+
# Properties:
|
19
|
+
#
|
20
|
+
# - Request body: optional.
|
21
|
+
# - Response body: yes.
|
22
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: yes.
|
23
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
24
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: yes.
|
25
|
+
#
|
26
|
+
# Related:
|
27
|
+
#
|
28
|
+
# - Net::HTTP.get: sends +GET+ request, returns response body.
|
29
|
+
# - Net::HTTP#get: sends +GET+ request, returns response object.
|
30
|
+
#
|
8
31
|
class Net::HTTP::Get < Net::HTTPRequest
|
9
32
|
METHOD = 'GET'
|
10
33
|
REQUEST_HAS_BODY = false
|
11
34
|
RESPONSE_HAS_BODY = true
|
12
35
|
end
|
13
36
|
|
14
|
-
#
|
15
|
-
#
|
37
|
+
# \Class for representing
|
38
|
+
# {HTTP method HEAD}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#HEAD_method]:
|
39
|
+
#
|
40
|
+
# require 'net/http'
|
41
|
+
# uri = URI('http://example.com')
|
42
|
+
# hostname = uri.hostname # => "example.com"
|
43
|
+
# req = Net::HTTP::Head.new(uri) # => #<Net::HTTP::Head HEAD>
|
44
|
+
# res = Net::HTTP.start(hostname) do |http|
|
45
|
+
# http.request(req)
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
49
|
+
#
|
50
|
+
# Properties:
|
51
|
+
#
|
52
|
+
# - Request body: optional.
|
53
|
+
# - Response body: no.
|
54
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: yes.
|
55
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
56
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: yes.
|
57
|
+
#
|
58
|
+
# Related:
|
59
|
+
#
|
60
|
+
# - Net::HTTP#head: sends +HEAD+ request, returns response object.
|
61
|
+
#
|
16
62
|
class Net::HTTP::Head < Net::HTTPRequest
|
17
63
|
METHOD = 'HEAD'
|
18
64
|
REQUEST_HAS_BODY = false
|
19
65
|
RESPONSE_HAS_BODY = false
|
20
66
|
end
|
21
67
|
|
22
|
-
#
|
23
|
-
#
|
68
|
+
# \Class for representing
|
69
|
+
# {HTTP method POST}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#POST_method]:
|
70
|
+
#
|
71
|
+
# require 'net/http'
|
72
|
+
# uri = URI('http://example.com')
|
73
|
+
# hostname = uri.hostname # => "example.com"
|
74
|
+
# uri.path = '/posts'
|
75
|
+
# req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST>
|
76
|
+
# req.body = '{"title": "foo","body": "bar","userId": 1}'
|
77
|
+
# req.content_type = 'application/json'
|
78
|
+
# res = Net::HTTP.start(hostname) do |http|
|
79
|
+
# http.request(req)
|
80
|
+
# end
|
81
|
+
#
|
82
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
83
|
+
#
|
84
|
+
# Properties:
|
85
|
+
#
|
86
|
+
# - Request body: yes.
|
87
|
+
# - Response body: yes.
|
88
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: no.
|
89
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: no.
|
90
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: yes.
|
91
|
+
#
|
92
|
+
# Related:
|
93
|
+
#
|
94
|
+
# - Net::HTTP.post: sends +POST+ request, returns response object.
|
95
|
+
# - Net::HTTP#post: sends +POST+ request, returns response object.
|
96
|
+
#
|
24
97
|
class Net::HTTP::Post < Net::HTTPRequest
|
25
98
|
METHOD = 'POST'
|
26
99
|
REQUEST_HAS_BODY = true
|
27
100
|
RESPONSE_HAS_BODY = true
|
28
101
|
end
|
29
102
|
|
30
|
-
#
|
31
|
-
#
|
103
|
+
# \Class for representing
|
104
|
+
# {HTTP method PUT}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#PUT_method]:
|
105
|
+
#
|
106
|
+
# require 'net/http'
|
107
|
+
# uri = URI('http://example.com')
|
108
|
+
# hostname = uri.hostname # => "example.com"
|
109
|
+
# uri.path = '/posts'
|
110
|
+
# req = Net::HTTP::Put.new(uri) # => #<Net::HTTP::Put PUT>
|
111
|
+
# req.body = '{"title": "foo","body": "bar","userId": 1}'
|
112
|
+
# req.content_type = 'application/json'
|
113
|
+
# res = Net::HTTP.start(hostname) do |http|
|
114
|
+
# http.request(req)
|
115
|
+
# end
|
116
|
+
#
|
117
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
118
|
+
#
|
119
|
+
# Properties:
|
120
|
+
#
|
121
|
+
# - Request body: yes.
|
122
|
+
# - Response body: yes.
|
123
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: no.
|
124
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
125
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
|
126
|
+
#
|
32
127
|
class Net::HTTP::Put < Net::HTTPRequest
|
33
128
|
METHOD = 'PUT'
|
34
129
|
REQUEST_HAS_BODY = true
|
35
130
|
RESPONSE_HAS_BODY = true
|
36
131
|
end
|
37
132
|
|
38
|
-
#
|
39
|
-
#
|
133
|
+
# \Class for representing
|
134
|
+
# {HTTP method DELETE}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#DELETE_method]:
|
135
|
+
#
|
136
|
+
# require 'net/http'
|
137
|
+
# uri = URI('http://example.com')
|
138
|
+
# hostname = uri.hostname # => "example.com"
|
139
|
+
# uri.path = '/posts/1'
|
140
|
+
# req = Net::HTTP::Delete.new(uri) # => #<Net::HTTP::Delete DELETE>
|
141
|
+
# res = Net::HTTP.start(hostname) do |http|
|
142
|
+
# http.request(req)
|
143
|
+
# end
|
144
|
+
#
|
145
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
146
|
+
#
|
147
|
+
# Properties:
|
148
|
+
#
|
149
|
+
# - Request body: optional.
|
150
|
+
# - Response body: yes.
|
151
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: no.
|
152
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
153
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
|
154
|
+
#
|
155
|
+
# Related:
|
156
|
+
#
|
157
|
+
# - Net::HTTP#delete: sends +DELETE+ request, returns response object.
|
158
|
+
#
|
40
159
|
class Net::HTTP::Delete < Net::HTTPRequest
|
41
160
|
METHOD = 'DELETE'
|
42
161
|
REQUEST_HAS_BODY = false
|
43
162
|
RESPONSE_HAS_BODY = true
|
44
163
|
end
|
45
164
|
|
46
|
-
#
|
165
|
+
# \Class for representing
|
166
|
+
# {HTTP method OPTIONS}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#OPTIONS_method]:
|
167
|
+
#
|
168
|
+
# require 'net/http'
|
169
|
+
# uri = URI('http://example.com')
|
170
|
+
# hostname = uri.hostname # => "example.com"
|
171
|
+
# req = Net::HTTP::Options.new(uri) # => #<Net::HTTP::Options OPTIONS>
|
172
|
+
# res = Net::HTTP.start(hostname) do |http|
|
173
|
+
# http.request(req)
|
174
|
+
# end
|
175
|
+
#
|
176
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
177
|
+
#
|
178
|
+
# Properties:
|
179
|
+
#
|
180
|
+
# - Request body: optional.
|
181
|
+
# - Response body: yes.
|
182
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: yes.
|
183
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
184
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
|
185
|
+
#
|
186
|
+
# Related:
|
187
|
+
#
|
188
|
+
# - Net::HTTP#options: sends +OPTIONS+ request, returns response object.
|
189
|
+
#
|
47
190
|
class Net::HTTP::Options < Net::HTTPRequest
|
48
191
|
METHOD = 'OPTIONS'
|
49
192
|
REQUEST_HAS_BODY = false
|
50
193
|
RESPONSE_HAS_BODY = true
|
51
194
|
end
|
52
195
|
|
53
|
-
#
|
196
|
+
# \Class for representing
|
197
|
+
# {HTTP method TRACE}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#TRACE_method]:
|
198
|
+
#
|
199
|
+
# require 'net/http'
|
200
|
+
# uri = URI('http://example.com')
|
201
|
+
# hostname = uri.hostname # => "example.com"
|
202
|
+
# req = Net::HTTP::Trace.new(uri) # => #<Net::HTTP::Trace TRACE>
|
203
|
+
# res = Net::HTTP.start(hostname) do |http|
|
204
|
+
# http.request(req)
|
205
|
+
# end
|
206
|
+
#
|
207
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
208
|
+
#
|
209
|
+
# Properties:
|
210
|
+
#
|
211
|
+
# - Request body: no.
|
212
|
+
# - Response body: yes.
|
213
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: yes.
|
214
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
|
215
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
|
216
|
+
#
|
217
|
+
# Related:
|
218
|
+
#
|
219
|
+
# - Net::HTTP#trace: sends +TRACE+ request, returns response object.
|
220
|
+
#
|
54
221
|
class Net::HTTP::Trace < Net::HTTPRequest
|
55
222
|
METHOD = 'TRACE'
|
56
223
|
REQUEST_HAS_BODY = false
|
57
224
|
RESPONSE_HAS_BODY = true
|
58
225
|
end
|
59
226
|
|
227
|
+
# \Class for representing
|
228
|
+
# {HTTP method PATCH}[https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#PATCH_method]:
|
60
229
|
#
|
61
|
-
#
|
230
|
+
# require 'net/http'
|
231
|
+
# uri = URI('http://example.com')
|
232
|
+
# hostname = uri.hostname # => "example.com"
|
233
|
+
# uri.path = '/posts'
|
234
|
+
# req = Net::HTTP::Patch.new(uri) # => #<Net::HTTP::Patch PATCH>
|
235
|
+
# req.body = '{"title": "foo","body": "bar","userId": 1}'
|
236
|
+
# req.content_type = 'application/json'
|
237
|
+
# res = Net::HTTP.start(hostname) do |http|
|
238
|
+
# http.request(req)
|
239
|
+
# end
|
240
|
+
#
|
241
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
242
|
+
#
|
243
|
+
# Properties:
|
244
|
+
#
|
245
|
+
# - Request body: yes.
|
246
|
+
# - Response body: yes.
|
247
|
+
# - {Safe}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods]: no.
|
248
|
+
# - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: no.
|
249
|
+
# - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
|
250
|
+
#
|
251
|
+
# Related:
|
252
|
+
#
|
253
|
+
# - Net::HTTP#patch: sends +PATCH+ request, returns response object.
|
62
254
|
#
|
63
|
-
|
64
|
-
# See Net::HTTPGenericRequest for attributes and methods.
|
65
255
|
class Net::HTTP::Patch < Net::HTTPRequest
|
66
256
|
METHOD = 'PATCH'
|
67
257
|
REQUEST_HAS_BODY = true
|
@@ -72,49 +262,161 @@ end
|
|
72
262
|
# WebDAV methods --- RFC2518
|
73
263
|
#
|
74
264
|
|
75
|
-
#
|
265
|
+
# \Class for representing
|
266
|
+
# {WebDAV method PROPFIND}[http://www.webdav.org/specs/rfc4918.html#METHOD_PROPFIND]:
|
267
|
+
#
|
268
|
+
# require 'net/http'
|
269
|
+
# uri = URI('http://example.com')
|
270
|
+
# hostname = uri.hostname # => "example.com"
|
271
|
+
# req = Net::HTTP::Propfind.new(uri) # => #<Net::HTTP::Propfind PROPFIND>
|
272
|
+
# res = Net::HTTP.start(hostname) do |http|
|
273
|
+
# http.request(req)
|
274
|
+
# end
|
275
|
+
#
|
276
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
277
|
+
#
|
278
|
+
# Related:
|
279
|
+
#
|
280
|
+
# - Net::HTTP#propfind: sends +PROPFIND+ request, returns response object.
|
281
|
+
#
|
76
282
|
class Net::HTTP::Propfind < Net::HTTPRequest
|
77
283
|
METHOD = 'PROPFIND'
|
78
284
|
REQUEST_HAS_BODY = true
|
79
285
|
RESPONSE_HAS_BODY = true
|
80
286
|
end
|
81
287
|
|
82
|
-
#
|
288
|
+
# \Class for representing
|
289
|
+
# {WebDAV method PROPPATCH}[http://www.webdav.org/specs/rfc4918.html#METHOD_PROPPATCH]:
|
290
|
+
#
|
291
|
+
# require 'net/http'
|
292
|
+
# uri = URI('http://example.com')
|
293
|
+
# hostname = uri.hostname # => "example.com"
|
294
|
+
# req = Net::HTTP::Proppatch.new(uri) # => #<Net::HTTP::Proppatch PROPPATCH>
|
295
|
+
# res = Net::HTTP.start(hostname) do |http|
|
296
|
+
# http.request(req)
|
297
|
+
# end
|
298
|
+
#
|
299
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
300
|
+
#
|
301
|
+
# Related:
|
302
|
+
#
|
303
|
+
# - Net::HTTP#proppatch: sends +PROPPATCH+ request, returns response object.
|
304
|
+
#
|
83
305
|
class Net::HTTP::Proppatch < Net::HTTPRequest
|
84
306
|
METHOD = 'PROPPATCH'
|
85
307
|
REQUEST_HAS_BODY = true
|
86
308
|
RESPONSE_HAS_BODY = true
|
87
309
|
end
|
88
310
|
|
89
|
-
#
|
311
|
+
# \Class for representing
|
312
|
+
# {WebDAV method MKCOL}[http://www.webdav.org/specs/rfc4918.html#METHOD_MKCOL]:
|
313
|
+
#
|
314
|
+
# require 'net/http'
|
315
|
+
# uri = URI('http://example.com')
|
316
|
+
# hostname = uri.hostname # => "example.com"
|
317
|
+
# req = Net::HTTP::Mkcol.new(uri) # => #<Net::HTTP::Mkcol MKCOL>
|
318
|
+
# res = Net::HTTP.start(hostname) do |http|
|
319
|
+
# http.request(req)
|
320
|
+
# end
|
321
|
+
#
|
322
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
323
|
+
#
|
324
|
+
# Related:
|
325
|
+
#
|
326
|
+
# - Net::HTTP#mkcol: sends +MKCOL+ request, returns response object.
|
327
|
+
#
|
90
328
|
class Net::HTTP::Mkcol < Net::HTTPRequest
|
91
329
|
METHOD = 'MKCOL'
|
92
330
|
REQUEST_HAS_BODY = true
|
93
331
|
RESPONSE_HAS_BODY = true
|
94
332
|
end
|
95
333
|
|
96
|
-
#
|
334
|
+
# \Class for representing
|
335
|
+
# {WebDAV method COPY}[http://www.webdav.org/specs/rfc4918.html#METHOD_COPY]:
|
336
|
+
#
|
337
|
+
# require 'net/http'
|
338
|
+
# uri = URI('http://example.com')
|
339
|
+
# hostname = uri.hostname # => "example.com"
|
340
|
+
# req = Net::HTTP::Copy.new(uri) # => #<Net::HTTP::Copy COPY>
|
341
|
+
# res = Net::HTTP.start(hostname) do |http|
|
342
|
+
# http.request(req)
|
343
|
+
# end
|
344
|
+
#
|
345
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
346
|
+
#
|
347
|
+
# Related:
|
348
|
+
#
|
349
|
+
# - Net::HTTP#copy: sends +COPY+ request, returns response object.
|
350
|
+
#
|
97
351
|
class Net::HTTP::Copy < Net::HTTPRequest
|
98
352
|
METHOD = 'COPY'
|
99
353
|
REQUEST_HAS_BODY = false
|
100
354
|
RESPONSE_HAS_BODY = true
|
101
355
|
end
|
102
356
|
|
103
|
-
#
|
357
|
+
# \Class for representing
|
358
|
+
# {WebDAV method MOVE}[http://www.webdav.org/specs/rfc4918.html#METHOD_MOVE]:
|
359
|
+
#
|
360
|
+
# require 'net/http'
|
361
|
+
# uri = URI('http://example.com')
|
362
|
+
# hostname = uri.hostname # => "example.com"
|
363
|
+
# req = Net::HTTP::Move.new(uri) # => #<Net::HTTP::Move MOVE>
|
364
|
+
# res = Net::HTTP.start(hostname) do |http|
|
365
|
+
# http.request(req)
|
366
|
+
# end
|
367
|
+
#
|
368
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
369
|
+
#
|
370
|
+
# Related:
|
371
|
+
#
|
372
|
+
# - Net::HTTP#move: sends +MOVE+ request, returns response object.
|
373
|
+
#
|
104
374
|
class Net::HTTP::Move < Net::HTTPRequest
|
105
375
|
METHOD = 'MOVE'
|
106
376
|
REQUEST_HAS_BODY = false
|
107
377
|
RESPONSE_HAS_BODY = true
|
108
378
|
end
|
109
379
|
|
110
|
-
#
|
380
|
+
# \Class for representing
|
381
|
+
# {WebDAV method LOCK}[http://www.webdav.org/specs/rfc4918.html#METHOD_LOCK]:
|
382
|
+
#
|
383
|
+
# require 'net/http'
|
384
|
+
# uri = URI('http://example.com')
|
385
|
+
# hostname = uri.hostname # => "example.com"
|
386
|
+
# req = Net::HTTP::Lock.new(uri) # => #<Net::HTTP::Lock LOCK>
|
387
|
+
# res = Net::HTTP.start(hostname) do |http|
|
388
|
+
# http.request(req)
|
389
|
+
# end
|
390
|
+
#
|
391
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
392
|
+
#
|
393
|
+
# Related:
|
394
|
+
#
|
395
|
+
# - Net::HTTP#lock: sends +LOCK+ request, returns response object.
|
396
|
+
#
|
111
397
|
class Net::HTTP::Lock < Net::HTTPRequest
|
112
398
|
METHOD = 'LOCK'
|
113
399
|
REQUEST_HAS_BODY = true
|
114
400
|
RESPONSE_HAS_BODY = true
|
115
401
|
end
|
116
402
|
|
117
|
-
#
|
403
|
+
# \Class for representing
|
404
|
+
# {WebDAV method UNLOCK}[http://www.webdav.org/specs/rfc4918.html#METHOD_UNLOCK]:
|
405
|
+
#
|
406
|
+
# require 'net/http'
|
407
|
+
# uri = URI('http://example.com')
|
408
|
+
# hostname = uri.hostname # => "example.com"
|
409
|
+
# req = Net::HTTP::Unlock.new(uri) # => #<Net::HTTP::Unlock UNLOCK>
|
410
|
+
# res = Net::HTTP.start(hostname) do |http|
|
411
|
+
# http.request(req)
|
412
|
+
# end
|
413
|
+
#
|
414
|
+
# See {Request Headers}[rdoc-ref:Net::HTTPRequest@Request+Headers].
|
415
|
+
#
|
416
|
+
# Related:
|
417
|
+
#
|
418
|
+
# - Net::HTTP#unlock: sends +UNLOCK+ request, returns response object.
|
419
|
+
#
|
118
420
|
class Net::HTTP::Unlock < Net::HTTPRequest
|
119
421
|
METHOD = 'UNLOCK'
|
120
422
|
REQUEST_HAS_BODY = true
|