net-http 0.3.0 → 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/.gitignore +0 -1
- data/doc/net-http/examples.rdoc +30 -0
- data/lib/net/http/header.rb +470 -103
- data/lib/net/http/request.rb +27 -5
- data/lib/net/http/requests.rb +296 -24
- data/lib/net/http/response.rb +127 -11
- data/lib/net/http/responses.rb +479 -69
- data/lib/net/http.rb +599 -346
- metadata +3 -2
data/lib/net/http/responses.rb
CHANGED
@@ -3,192 +3,545 @@
|
|
3
3
|
# https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
|
4
4
|
|
5
5
|
module Net
|
6
|
-
# :stopdoc:
|
7
6
|
|
8
7
|
class HTTPUnknownResponse < HTTPResponse
|
9
8
|
HAS_BODY = true
|
10
9
|
EXCEPTION_TYPE = HTTPError #
|
11
10
|
end
|
12
|
-
|
11
|
+
|
12
|
+
# Parent class for informational (1xx) HTTP response classes.
|
13
|
+
#
|
14
|
+
# An informational response indicates that the request was received and understood.
|
15
|
+
#
|
16
|
+
# References:
|
17
|
+
#
|
18
|
+
# - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#status.1xx].
|
19
|
+
# - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#1xx_informational_response].
|
20
|
+
#
|
21
|
+
class HTTPInformation < HTTPResponse
|
13
22
|
HAS_BODY = false
|
14
23
|
EXCEPTION_TYPE = HTTPError #
|
15
24
|
end
|
16
|
-
|
25
|
+
|
26
|
+
# Parent class for success (2xx) HTTP response classes.
|
27
|
+
#
|
28
|
+
# A success response indicates the action requested by the client
|
29
|
+
# was received, understood, and accepted.
|
30
|
+
#
|
31
|
+
# References:
|
32
|
+
#
|
33
|
+
# - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#status.2xx].
|
34
|
+
# - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#2xx_success].
|
35
|
+
#
|
36
|
+
class HTTPSuccess < HTTPResponse
|
17
37
|
HAS_BODY = true
|
18
38
|
EXCEPTION_TYPE = HTTPError #
|
19
39
|
end
|
20
|
-
|
40
|
+
|
41
|
+
# Parent class for redirection (3xx) HTTP response classes.
|
42
|
+
#
|
43
|
+
# A redirection response indicates the client must take additional action
|
44
|
+
# to complete the request.
|
45
|
+
#
|
46
|
+
# References:
|
47
|
+
#
|
48
|
+
# - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#status.3xx].
|
49
|
+
# - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_redirection].
|
50
|
+
#
|
51
|
+
class HTTPRedirection < HTTPResponse
|
21
52
|
HAS_BODY = true
|
22
53
|
EXCEPTION_TYPE = HTTPRetriableError #
|
23
54
|
end
|
24
|
-
|
55
|
+
|
56
|
+
# Parent class for client error (4xx) HTTP response classes.
|
57
|
+
#
|
58
|
+
# A client error response indicates that the client may have caused an error.
|
59
|
+
#
|
60
|
+
# References:
|
61
|
+
#
|
62
|
+
# - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#status.4xx].
|
63
|
+
# - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_client_errors].
|
64
|
+
#
|
65
|
+
class HTTPClientError < HTTPResponse
|
25
66
|
HAS_BODY = true
|
26
67
|
EXCEPTION_TYPE = HTTPClientException #
|
27
68
|
end
|
28
|
-
|
69
|
+
|
70
|
+
# Parent class for server error (5xx) HTTP response classes.
|
71
|
+
#
|
72
|
+
# A server error response indicates that the server failed to fulfill a request.
|
73
|
+
#
|
74
|
+
# References:
|
75
|
+
#
|
76
|
+
# - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#status.5xx].
|
77
|
+
# - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#5xx_server_errors].
|
78
|
+
#
|
79
|
+
class HTTPServerError < HTTPResponse
|
29
80
|
HAS_BODY = true
|
30
81
|
EXCEPTION_TYPE = HTTPFatalError #
|
31
82
|
end
|
32
83
|
|
33
|
-
class
|
84
|
+
# Response class for +Continue+ responses (status code 100).
|
85
|
+
#
|
86
|
+
# A +Continue+ response indicates that the server has received the request headers.
|
87
|
+
#
|
88
|
+
# References:
|
89
|
+
#
|
90
|
+
# - {Mozilla}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/100].
|
91
|
+
# - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#name-100-continue].
|
92
|
+
# - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#100].
|
93
|
+
#
|
94
|
+
class HTTPContinue < HTTPInformation
|
34
95
|
HAS_BODY = false
|
35
96
|
end
|
36
|
-
|
97
|
+
|
98
|
+
# Response class for <tt>Switching Protocol</tt> responses (status code 101).
|
99
|
+
#
|
100
|
+
# The <tt>Switching Protocol<tt> response indicates that the server has received
|
101
|
+
# a request to switch protocols, and has agreed to do so.
|
102
|
+
#
|
103
|
+
# References:
|
104
|
+
#
|
105
|
+
# - {Mozilla}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/101].
|
106
|
+
# - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#name-101-switching-protocols].
|
107
|
+
# - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#101].
|
108
|
+
#
|
109
|
+
class HTTPSwitchProtocol < HTTPInformation
|
37
110
|
HAS_BODY = false
|
38
111
|
end
|
39
|
-
|
112
|
+
|
113
|
+
# Response class for +Processing+ responses (status code 102).
|
114
|
+
#
|
115
|
+
# The +Processing+ response indicates that the server has received
|
116
|
+
# and is processing the request, but no response is available yet.
|
117
|
+
#
|
118
|
+
# References:
|
119
|
+
#
|
120
|
+
# - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#102].
|
121
|
+
#
|
122
|
+
class HTTPProcessing < HTTPInformation
|
40
123
|
HAS_BODY = false
|
41
124
|
end
|
42
|
-
|
125
|
+
|
126
|
+
# Response class for <tt>Early Hints</tt> responses (status code 103).
|
127
|
+
#
|
128
|
+
# The <tt>Early Hints</tt> indicates that the server has received
|
129
|
+
# and is processing the request, and contains certain headers;
|
130
|
+
# the final response is not available yet.
|
131
|
+
#
|
132
|
+
# References:
|
133
|
+
#
|
134
|
+
# - {Mozilla}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103].
|
135
|
+
# - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#103].
|
136
|
+
#
|
137
|
+
class HTTPEarlyHints < HTTPInformation
|
43
138
|
HAS_BODY = false
|
44
139
|
end
|
45
140
|
|
46
|
-
class
|
141
|
+
# Response class for +OK+ responses (status code 200).
|
142
|
+
#
|
143
|
+
# The +OK+ response indicates that the server has received
|
144
|
+
# a request and has responded successfully.
|
145
|
+
# See {200 OK}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#200].
|
146
|
+
class HTTPOK < HTTPSuccess
|
47
147
|
HAS_BODY = true
|
48
148
|
end
|
49
|
-
|
149
|
+
|
150
|
+
# Response class for +Created+ responses (status code 201).
|
151
|
+
#
|
152
|
+
# The +Created+ response indicates that the server has received
|
153
|
+
# and has fulfilled a request to create a new resource.
|
154
|
+
# See {201 Created}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#201].
|
155
|
+
class HTTPCreated < HTTPSuccess
|
50
156
|
HAS_BODY = true
|
51
157
|
end
|
52
|
-
|
158
|
+
|
159
|
+
# Response class for +Accepted+ responses (status code 202).
|
160
|
+
#
|
161
|
+
# The +Accepted+ response indicates that the server has received
|
162
|
+
# and is processing a request, but the processing has not yet been completed.
|
163
|
+
# See {202 Accepted}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#202].
|
164
|
+
class HTTPAccepted < HTTPSuccess
|
53
165
|
HAS_BODY = true
|
54
166
|
end
|
55
|
-
|
167
|
+
|
168
|
+
# Response class for <tt>Non-Authoritative Information</tt> responses (status code 203).
|
169
|
+
#
|
170
|
+
# The <tt>Non-Authoritative Information</tt> response indicates that the server
|
171
|
+
# is a transforming proxy (such as a Web accelerator)
|
172
|
+
# that received a 200 OK response from its origin,
|
173
|
+
# and is returning a modified version of the origin's response.
|
174
|
+
# See {203 Non-Authoritative Information}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#203].
|
175
|
+
class HTTPNonAuthoritativeInformation < HTTPSuccess
|
56
176
|
HAS_BODY = true
|
57
177
|
end
|
58
|
-
|
178
|
+
|
179
|
+
# Response class for <tt>No Content</tt> responses (status code 204).
|
180
|
+
#
|
181
|
+
# The <tt>No Content</tt> response indicates that the server
|
182
|
+
# successfully processed the request, and is not returning any content.
|
183
|
+
# See {204 No Content}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#204].
|
184
|
+
class HTTPNoContent < HTTPSuccess
|
59
185
|
HAS_BODY = false
|
60
186
|
end
|
61
|
-
|
187
|
+
|
188
|
+
# Response class for <tt>Reset Content</tt> responses (status code 205).
|
189
|
+
#
|
190
|
+
# The <tt>Reset Content</tt> response indicates that the server
|
191
|
+
# successfully processed the request,
|
192
|
+
# asks that the client reset its document view, and is not returning any content.
|
193
|
+
# See {205 Reset Content}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#205].
|
194
|
+
class HTTPResetContent < HTTPSuccess
|
62
195
|
HAS_BODY = false
|
63
196
|
end
|
64
|
-
|
197
|
+
|
198
|
+
# Response class for <tt>Partial Content</tt> responses (status code 206).
|
199
|
+
#
|
200
|
+
# The <tt>Partial Content</tt> response indicates that the server is delivering
|
201
|
+
# only part of the resource (byte serving)
|
202
|
+
# due to a Range header in the request.
|
203
|
+
# See {206 Partial Content}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#206].
|
204
|
+
class HTTPPartialContent < HTTPSuccess
|
65
205
|
HAS_BODY = true
|
66
206
|
end
|
67
|
-
|
207
|
+
|
208
|
+
# Response class for <tt>Multi-Status (WebDAV)</tt> responses (status code 207).
|
209
|
+
#
|
210
|
+
# The <tt>Multi-Status (WebDAV)</tt> response indicates that the server
|
211
|
+
# has received the request,
|
212
|
+
# and that the message body can contain a number of separate response codes.
|
213
|
+
# See {207 Multi-Status (WebDAV)}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#207].
|
214
|
+
class HTTPMultiStatus < HTTPSuccess
|
68
215
|
HAS_BODY = true
|
69
216
|
end
|
70
|
-
|
217
|
+
|
218
|
+
# Response class for <tt>Already Reported (WebDAV)</tt> responses (status code 208).
|
219
|
+
#
|
220
|
+
# The <tt>Already Reported (WebDAV)</tt> response indicates that the server
|
221
|
+
# has received the request,
|
222
|
+
# and that the members of a DAV binding have already been enumerated
|
223
|
+
# in a preceding part of the (multi-status) response,
|
224
|
+
# and are not being included again.
|
225
|
+
# See {208 Already Reported (WebDAV)}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#208].
|
226
|
+
class HTTPAlreadyReported < HTTPSuccess
|
71
227
|
HAS_BODY = true
|
72
228
|
end
|
73
|
-
|
229
|
+
|
230
|
+
# Response class for <tt>IM Used</tt> responses (status code 226).
|
231
|
+
#
|
232
|
+
# The <tt>IM Used</tt> response indicates that the server has fulfilled a request
|
233
|
+
# for the resource, and the response is a representation of the result
|
234
|
+
# of one or more instance-manipulations applied to the current instance.
|
235
|
+
# See {226 IM Used}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#226].
|
236
|
+
class HTTPIMUsed < HTTPSuccess
|
74
237
|
HAS_BODY = true
|
75
238
|
end
|
76
239
|
|
77
|
-
class
|
240
|
+
# Response class for <tt>Multiple Choices</tt> responses (status code 300).
|
241
|
+
#
|
242
|
+
# The <tt>Multiple Choices</tt> response indicates that the server
|
243
|
+
# offers multiple options for the resource from which the client may choose.
|
244
|
+
# See {300 Multiple Choices}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#300].
|
245
|
+
class HTTPMultipleChoices < HTTPRedirection
|
78
246
|
HAS_BODY = true
|
79
247
|
end
|
80
248
|
HTTPMultipleChoice = HTTPMultipleChoices
|
81
|
-
|
249
|
+
|
250
|
+
# Response class for <tt>Moved Permanently</tt> responses (status code 301).
|
251
|
+
#
|
252
|
+
# The <tt>Moved Permanently</tt> response indicates that links or records
|
253
|
+
# returning this response should be updated to use the given URL.
|
254
|
+
# See {301 Moved Permanently}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#301].
|
255
|
+
class HTTPMovedPermanently < HTTPRedirection
|
82
256
|
HAS_BODY = true
|
83
257
|
end
|
84
|
-
|
258
|
+
|
259
|
+
# Response class for <tt>Found</tt> responses (status code 302).
|
260
|
+
#
|
261
|
+
# The <tt>Found</tt> response indicates that the client
|
262
|
+
# should look at (browse to) another URL.
|
263
|
+
# See {302 Found}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#302].
|
264
|
+
class HTTPFound < HTTPRedirection
|
85
265
|
HAS_BODY = true
|
86
266
|
end
|
87
267
|
HTTPMovedTemporarily = HTTPFound
|
88
|
-
|
268
|
+
|
269
|
+
# Response class for <tt>See Other</tt> responses (status code 303).
|
270
|
+
#
|
271
|
+
# The response to the request can be found under another URI using the GET method.
|
272
|
+
# See {303 See Other}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#303].
|
273
|
+
class HTTPSeeOther < HTTPRedirection
|
89
274
|
HAS_BODY = true
|
90
275
|
end
|
91
|
-
|
276
|
+
|
277
|
+
# Response class for <tt>Not Modified</tt> responses (status code 304).
|
278
|
+
#
|
279
|
+
# Indicates that the resource has not been modified since the version
|
280
|
+
# specified by the request headers.
|
281
|
+
# See {304 Not Modified}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#304].
|
282
|
+
class HTTPNotModified < HTTPRedirection
|
92
283
|
HAS_BODY = false
|
93
284
|
end
|
94
|
-
|
285
|
+
|
286
|
+
# Response class for <tt>Use Proxy</tt> responses (status code 305).
|
287
|
+
#
|
288
|
+
# The requested resource is available only through a proxy,
|
289
|
+
# whose address is provided in the response.
|
290
|
+
# See {305 Use Proxy}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#305].
|
291
|
+
class HTTPUseProxy < HTTPRedirection
|
95
292
|
HAS_BODY = false
|
96
293
|
end
|
97
|
-
|
98
|
-
class
|
294
|
+
|
295
|
+
# Response class for <tt>Temporary Redirect</tt> responses (status code 307).
|
296
|
+
#
|
297
|
+
# The request should be repeated with another URI;
|
298
|
+
# however, future requests should still use the original URI.
|
299
|
+
# See {307 Temporary Redirect}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#307].
|
300
|
+
class HTTPTemporaryRedirect < HTTPRedirection
|
99
301
|
HAS_BODY = true
|
100
302
|
end
|
101
|
-
|
303
|
+
|
304
|
+
# Response class for <tt>Permanent Redirect</tt> responses (status code 308).
|
305
|
+
#
|
306
|
+
# This and all future requests should be directed to the given URI.
|
307
|
+
# See {308 Permanent Redirect}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#308].
|
308
|
+
class HTTPPermanentRedirect < HTTPRedirection
|
102
309
|
HAS_BODY = true
|
103
310
|
end
|
104
311
|
|
105
|
-
class
|
312
|
+
# Response class for <tt>Bad Request</tt> responses (status code 400).
|
313
|
+
#
|
314
|
+
# The server cannot or will not process the request due to an apparent client error.
|
315
|
+
# See {400 Bad Request}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#400].
|
316
|
+
class HTTPBadRequest < HTTPClientError
|
106
317
|
HAS_BODY = true
|
107
318
|
end
|
108
|
-
|
319
|
+
|
320
|
+
# Response class for <tt>Unauthorized</tt> responses (status code 401).
|
321
|
+
#
|
322
|
+
# Authentication is required, but either was not provided or failed.
|
323
|
+
# See {401 Unauthorized}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#401].
|
324
|
+
class HTTPUnauthorized < HTTPClientError
|
109
325
|
HAS_BODY = true
|
110
326
|
end
|
111
|
-
|
327
|
+
|
328
|
+
# Response class for <tt>Payment Required</tt> responses (status code 402).
|
329
|
+
#
|
330
|
+
# Reserved for future use.
|
331
|
+
# See {402 Payment Required}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#402].
|
332
|
+
class HTTPPaymentRequired < HTTPClientError
|
112
333
|
HAS_BODY = true
|
113
334
|
end
|
114
|
-
|
335
|
+
|
336
|
+
# Response class for <tt>Forbidden</tt> responses (status code 403).
|
337
|
+
#
|
338
|
+
# The request contained valid data and was understood by the server,
|
339
|
+
# but the server is refusing action.
|
340
|
+
# See {403 Forbidden}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#403].
|
341
|
+
class HTTPForbidden < HTTPClientError
|
115
342
|
HAS_BODY = true
|
116
343
|
end
|
117
|
-
|
344
|
+
|
345
|
+
# Response class for <tt>Not Found</tt> responses (status code 404).
|
346
|
+
#
|
347
|
+
# The requested resource could not be found but may be available in the future.
|
348
|
+
# See {404 Not Found}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#404].
|
349
|
+
class HTTPNotFound < HTTPClientError
|
118
350
|
HAS_BODY = true
|
119
351
|
end
|
120
|
-
|
352
|
+
|
353
|
+
# Response class for <tt>Method Not Allowed</tt> responses (status code 405).
|
354
|
+
#
|
355
|
+
# The request method is not supported for the requested resource.
|
356
|
+
# See {405 Method Not Allowed}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#405].
|
357
|
+
class HTTPMethodNotAllowed < HTTPClientError
|
121
358
|
HAS_BODY = true
|
122
359
|
end
|
123
|
-
|
360
|
+
|
361
|
+
# Response class for <tt>Not Acceptable</tt> responses (status code 406).
|
362
|
+
#
|
363
|
+
# The requested resource is capable of generating only content
|
364
|
+
# that not acceptable according to the Accept headers sent in the request.
|
365
|
+
# See {406 Not Acceptable}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#406].
|
366
|
+
class HTTPNotAcceptable < HTTPClientError
|
124
367
|
HAS_BODY = true
|
125
368
|
end
|
126
|
-
|
369
|
+
|
370
|
+
# Response class for <tt>Proxy Authentication Required</tt> responses (status code 407).
|
371
|
+
#
|
372
|
+
# The client must first authenticate itself with the proxy.
|
373
|
+
# See {407 Proxy Authentication Required}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#407].
|
374
|
+
class HTTPProxyAuthenticationRequired < HTTPClientError
|
127
375
|
HAS_BODY = true
|
128
376
|
end
|
129
|
-
|
377
|
+
|
378
|
+
# Response class for <tt>Request Timeout</tt> responses (status code 408).
|
379
|
+
#
|
380
|
+
# The server timed out waiting for the request.
|
381
|
+
# See {408 Request Timeout}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#408].
|
382
|
+
class HTTPRequestTimeout < HTTPClientError
|
130
383
|
HAS_BODY = true
|
131
384
|
end
|
132
385
|
HTTPRequestTimeOut = HTTPRequestTimeout
|
133
|
-
|
386
|
+
|
387
|
+
# Response class for <tt>Conflict</tt> responses (status code 409).
|
388
|
+
#
|
389
|
+
# The request could not be processed because of conflict in the current state of the resource.
|
390
|
+
# See {409 Conflict}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#409].
|
391
|
+
class HTTPConflict < HTTPClientError
|
134
392
|
HAS_BODY = true
|
135
393
|
end
|
136
|
-
|
394
|
+
|
395
|
+
# Response class for <tt>Gone</tt> responses (status code 410).
|
396
|
+
#
|
397
|
+
# The resource requested was previously in use but is no longer available
|
398
|
+
# and will not be available again.
|
399
|
+
# See {410 Gone}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#410].
|
400
|
+
class HTTPGone < HTTPClientError
|
137
401
|
HAS_BODY = true
|
138
402
|
end
|
139
|
-
|
403
|
+
|
404
|
+
# Response class for <tt>Length Required</tt> responses (status code 411).
|
405
|
+
#
|
406
|
+
# The request did not specify the length of its content,
|
407
|
+
# which is required by the requested resource.
|
408
|
+
# See {411 Length Required}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#411].
|
409
|
+
class HTTPLengthRequired < HTTPClientError
|
140
410
|
HAS_BODY = true
|
141
411
|
end
|
142
|
-
|
412
|
+
|
413
|
+
# Response class for <tt>Precondition Failed</tt> responses (status code 412).
|
414
|
+
#
|
415
|
+
# The server does not meet one of the preconditions
|
416
|
+
# specified in the request headers.
|
417
|
+
# See {412 Precondition Failed}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#412].
|
418
|
+
class HTTPPreconditionFailed < HTTPClientError
|
143
419
|
HAS_BODY = true
|
144
420
|
end
|
145
|
-
|
421
|
+
|
422
|
+
# Response class for <tt>Payload Too Large</tt> responses (status code 413).
|
423
|
+
#
|
424
|
+
# The request is larger than the server is willing or able to process.
|
425
|
+
# See {413 Payload Too Large}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#413].
|
426
|
+
class HTTPPayloadTooLarge < HTTPClientError
|
146
427
|
HAS_BODY = true
|
147
428
|
end
|
148
429
|
HTTPRequestEntityTooLarge = HTTPPayloadTooLarge
|
149
|
-
|
430
|
+
|
431
|
+
# Response class for <tt>URI Too Long</tt> responses (status code 414).
|
432
|
+
#
|
433
|
+
# The URI provided was too long for the server to process.
|
434
|
+
# See {414 URI Too Long}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#414].
|
435
|
+
class HTTPURITooLong < HTTPClientError
|
150
436
|
HAS_BODY = true
|
151
437
|
end
|
152
438
|
HTTPRequestURITooLong = HTTPURITooLong
|
153
439
|
HTTPRequestURITooLarge = HTTPRequestURITooLong
|
154
|
-
|
440
|
+
|
441
|
+
# Response class for <tt>Unsupported Media Type</tt> responses (status code 415).
|
442
|
+
#
|
443
|
+
# The request entity has a media type which the server or resource does not support.
|
444
|
+
# See {415 Unsupported Media Type}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#415].
|
445
|
+
class HTTPUnsupportedMediaType < HTTPClientError
|
155
446
|
HAS_BODY = true
|
156
447
|
end
|
157
|
-
|
448
|
+
|
449
|
+
# Response class for <tt>Range Not Satisfiable</tt> responses (status code 416).
|
450
|
+
#
|
451
|
+
# The request entity has a media type which the server or resource does not support.
|
452
|
+
# See {416 Range Not Satisfiable}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#416].
|
453
|
+
class HTTPRangeNotSatisfiable < HTTPClientError
|
158
454
|
HAS_BODY = true
|
159
455
|
end
|
160
456
|
HTTPRequestedRangeNotSatisfiable = HTTPRangeNotSatisfiable
|
161
|
-
|
457
|
+
|
458
|
+
# Response class for <tt>Expectation Failed</tt> responses (status code 417).
|
459
|
+
#
|
460
|
+
# The server cannot meet the requirements of the Expect request-header field.
|
461
|
+
# See {417 Expectation Failed}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#417].
|
462
|
+
class HTTPExpectationFailed < HTTPClientError
|
162
463
|
HAS_BODY = true
|
163
464
|
end
|
465
|
+
|
164
466
|
# 418 I'm a teapot - RFC 2324; a joke RFC
|
467
|
+
# See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#418.
|
468
|
+
|
165
469
|
# 420 Enhance Your Calm - Twitter
|
166
|
-
|
470
|
+
|
471
|
+
# Response class for <tt>Misdirected Request</tt> responses (status code 421).
|
472
|
+
#
|
473
|
+
# The request was directed at a server that is not able to produce a response.
|
474
|
+
# See {421 Misdirected Request}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#421].
|
475
|
+
class HTTPMisdirectedRequest < HTTPClientError
|
167
476
|
HAS_BODY = true
|
168
477
|
end
|
169
|
-
|
478
|
+
|
479
|
+
# Response class for <tt>Unprocessable Entity</tt> responses (status code 422).
|
480
|
+
#
|
481
|
+
# The request was well-formed but had semantic errors.
|
482
|
+
# See {422 Unprocessable Entity}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#422].
|
483
|
+
class HTTPUnprocessableEntity < HTTPClientError
|
170
484
|
HAS_BODY = true
|
171
485
|
end
|
172
|
-
|
486
|
+
|
487
|
+
# Response class for <tt>Locked (WebDAV)</tt> responses (status code 423).
|
488
|
+
#
|
489
|
+
# The requested resource is locked.
|
490
|
+
# See {423 Locked (WebDAV)}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#423].
|
491
|
+
class HTTPLocked < HTTPClientError
|
173
492
|
HAS_BODY = true
|
174
493
|
end
|
175
|
-
|
494
|
+
|
495
|
+
# Response class for <tt>Failed Dependency (WebDAV)</tt> responses (status code 424).
|
496
|
+
#
|
497
|
+
# The request failed because it depended on another request and that request failed.
|
498
|
+
# See {424 Failed Dependency (WebDAV)}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#424].
|
499
|
+
class HTTPFailedDependency < HTTPClientError
|
176
500
|
HAS_BODY = true
|
177
501
|
end
|
178
|
-
|
179
|
-
|
502
|
+
|
503
|
+
# 425 Too Early
|
504
|
+
# https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#425.
|
505
|
+
|
506
|
+
# Response class for <tt>Upgrade Required</tt> responses (status code 426).
|
507
|
+
#
|
508
|
+
# The client should switch to the protocol given in the Upgrade header field.
|
509
|
+
# See {426 Upgrade Required}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#426].
|
510
|
+
class HTTPUpgradeRequired < HTTPClientError
|
180
511
|
HAS_BODY = true
|
181
512
|
end
|
182
|
-
|
513
|
+
|
514
|
+
# Response class for <tt>Precondition Required</tt> responses (status code 428).
|
515
|
+
#
|
516
|
+
# The origin server requires the request to be conditional.
|
517
|
+
# See {428 Precondition Required}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#428].
|
518
|
+
class HTTPPreconditionRequired < HTTPClientError
|
183
519
|
HAS_BODY = true
|
184
520
|
end
|
185
|
-
|
521
|
+
|
522
|
+
# Response class for <tt>Too Many Requests</tt> responses (status code 429).
|
523
|
+
#
|
524
|
+
# The user has sent too many requests in a given amount of time.
|
525
|
+
# See {429 Too Many Requests}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#429].
|
526
|
+
class HTTPTooManyRequests < HTTPClientError
|
186
527
|
HAS_BODY = true
|
187
528
|
end
|
188
|
-
|
529
|
+
|
530
|
+
# Response class for <tt>Request Header Fields Too Large</tt> responses (status code 431).
|
531
|
+
#
|
532
|
+
# An individual header field is too large,
|
533
|
+
# or all the header fields collectively, are too large.
|
534
|
+
# See {431 Request Header Fields Too Large}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#431].
|
535
|
+
class HTTPRequestHeaderFieldsTooLarge < HTTPClientError
|
189
536
|
HAS_BODY = true
|
190
537
|
end
|
191
|
-
|
538
|
+
|
539
|
+
# Response class for <tt>Unavailable For Legal Reasons</tt> responses (status code 451).
|
540
|
+
#
|
541
|
+
# A server operator has received a legal demand to deny access to a resource or to a set of resources
|
542
|
+
# that includes the requested resource.
|
543
|
+
# See {451 Unavailable For Legal Reasons}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#451].
|
544
|
+
class HTTPUnavailableForLegalReasons < HTTPClientError
|
192
545
|
HAS_BODY = true
|
193
546
|
end
|
194
547
|
# 444 No Response - Nginx
|
@@ -196,43 +549,100 @@ module Net
|
|
196
549
|
# 450 Blocked by Windows Parental Controls - Microsoft
|
197
550
|
# 499 Client Closed Request - Nginx
|
198
551
|
|
199
|
-
class
|
552
|
+
# Response class for <tt>Internal Server Error</tt> responses (status code 500).
|
553
|
+
#
|
554
|
+
# An unexpected condition was encountered and no more specific message is suitable.
|
555
|
+
# See {500 Internal Server Error}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#500].
|
556
|
+
class HTTPInternalServerError < HTTPServerError
|
200
557
|
HAS_BODY = true
|
201
558
|
end
|
202
|
-
|
559
|
+
|
560
|
+
# Response class for <tt>Not Implemented</tt> responses (status code 501).
|
561
|
+
#
|
562
|
+
# The server either does not recognize the request method,
|
563
|
+
# or it lacks the ability to fulfil the request.
|
564
|
+
# See {501 Not Implemented}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#501].
|
565
|
+
class HTTPNotImplemented < HTTPServerError
|
203
566
|
HAS_BODY = true
|
204
567
|
end
|
205
|
-
|
568
|
+
|
569
|
+
# Response class for <tt>Bad Gateway</tt> responses (status code 502).
|
570
|
+
#
|
571
|
+
# The server was acting as a gateway or proxy
|
572
|
+
# and received an invalid response from the upstream server.
|
573
|
+
# See {502 Bad Gateway}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#502].
|
574
|
+
class HTTPBadGateway < HTTPServerError
|
206
575
|
HAS_BODY = true
|
207
576
|
end
|
208
|
-
|
577
|
+
|
578
|
+
# Response class for <tt>Service Unavailable</tt> responses (status code 503).
|
579
|
+
#
|
580
|
+
# The server cannot handle the request
|
581
|
+
# (because it is overloaded or down for maintenance).
|
582
|
+
# See {503 Service Unavailable}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#503].
|
583
|
+
class HTTPServiceUnavailable < HTTPServerError
|
209
584
|
HAS_BODY = true
|
210
585
|
end
|
211
|
-
|
586
|
+
|
587
|
+
# Response class for <tt>Gateway Timeout</tt> responses (status code 504).
|
588
|
+
#
|
589
|
+
# The server was acting as a gateway or proxy
|
590
|
+
# and did not receive a timely response from the upstream server.
|
591
|
+
# See {504 Gateway Timeout}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#504].
|
592
|
+
class HTTPGatewayTimeout < HTTPServerError
|
212
593
|
HAS_BODY = true
|
213
594
|
end
|
214
595
|
HTTPGatewayTimeOut = HTTPGatewayTimeout
|
215
|
-
|
596
|
+
|
597
|
+
# Response class for <tt>HTTP Version Not Supported</tt> responses (status code 505).
|
598
|
+
#
|
599
|
+
# The server does not support the HTTP version used in the request.
|
600
|
+
# See {505 HTTP Version Not Supported}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#505].
|
601
|
+
class HTTPVersionNotSupported < HTTPServerError
|
216
602
|
HAS_BODY = true
|
217
603
|
end
|
218
|
-
|
604
|
+
|
605
|
+
# Response class for <tt>Variant Also Negotiates</tt> responses (status code 506).
|
606
|
+
#
|
607
|
+
# Transparent content negotiation for the request results in a circular reference.
|
608
|
+
# See {506 Variant Also Negotiates}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#506].
|
609
|
+
class HTTPVariantAlsoNegotiates < HTTPServerError
|
219
610
|
HAS_BODY = true
|
220
611
|
end
|
221
|
-
|
612
|
+
|
613
|
+
# Response class for <tt>Insufficient Storage (WebDAV)</tt> responses (status code 507).
|
614
|
+
#
|
615
|
+
# The server is unable to store the representation needed to complete the request.
|
616
|
+
# See {507 Insufficient Storage (WebDAV)}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#507].
|
617
|
+
class HTTPInsufficientStorage < HTTPServerError
|
222
618
|
HAS_BODY = true
|
223
619
|
end
|
224
|
-
|
620
|
+
|
621
|
+
# Response class for <tt>Loop Detected (WebDAV)</tt> responses (status code 508).
|
622
|
+
#
|
623
|
+
# The server detected an infinite loop while processing the request.
|
624
|
+
# See {508 Loop Detected (WebDAV)}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#508].
|
625
|
+
class HTTPLoopDetected < HTTPServerError
|
225
626
|
HAS_BODY = true
|
226
627
|
end
|
227
628
|
# 509 Bandwidth Limit Exceeded - Apache bw/limited extension
|
228
|
-
|
629
|
+
|
630
|
+
# Response class for <tt>Not Extended</tt> responses (status code 510).
|
631
|
+
#
|
632
|
+
# Further extensions to the request are required for the server to fulfill it.
|
633
|
+
# See {510 Not Extended}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#510].
|
634
|
+
class HTTPNotExtended < HTTPServerError
|
229
635
|
HAS_BODY = true
|
230
636
|
end
|
231
|
-
|
637
|
+
|
638
|
+
# Response class for <tt>Network Authentication Required</tt> responses (status code 511).
|
639
|
+
#
|
640
|
+
# The client needs to authenticate to gain network access.
|
641
|
+
# See {511 Network Authentication Required}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#511].
|
642
|
+
class HTTPNetworkAuthenticationRequired < HTTPServerError
|
232
643
|
HAS_BODY = true
|
233
644
|
end
|
234
645
|
|
235
|
-
# :startdoc:
|
236
646
|
end
|
237
647
|
|
238
648
|
class Net::HTTPResponse
|