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.
@@ -1,231 +1,648 @@
1
1
  # frozen_string_literal: true
2
- # :stopdoc:
2
+ #--
3
3
  # https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
4
- class Net::HTTPUnknownResponse < Net::HTTPResponse
5
- HAS_BODY = true
6
- EXCEPTION_TYPE = Net::HTTPError
7
- end
8
- class Net::HTTPInformation < Net::HTTPResponse # 1xx
9
- HAS_BODY = false
10
- EXCEPTION_TYPE = Net::HTTPError
11
- end
12
- class Net::HTTPSuccess < Net::HTTPResponse # 2xx
13
- HAS_BODY = true
14
- EXCEPTION_TYPE = Net::HTTPError
15
- end
16
- class Net::HTTPRedirection < Net::HTTPResponse # 3xx
17
- HAS_BODY = true
18
- EXCEPTION_TYPE = Net::HTTPRetriableError
19
- end
20
- class Net::HTTPClientError < Net::HTTPResponse # 4xx
21
- HAS_BODY = true
22
- EXCEPTION_TYPE = Net::HTTPClientException # for backward compatibility
23
- end
24
- class Net::HTTPServerError < Net::HTTPResponse # 5xx
25
- HAS_BODY = true
26
- EXCEPTION_TYPE = Net::HTTPFatalError # for backward compatibility
27
- end
28
4
 
29
- class Net::HTTPContinue < Net::HTTPInformation # 100
30
- HAS_BODY = false
31
- end
32
- class Net::HTTPSwitchProtocol < Net::HTTPInformation # 101
33
- HAS_BODY = false
34
- end
35
- class Net::HTTPProcessing < Net::HTTPInformation # 102
36
- HAS_BODY = false
37
- end
38
- class Net::HTTPEarlyHints < Net::HTTPInformation # 103 - RFC 8297
39
- HAS_BODY = false
40
- end
5
+ module Net
41
6
 
42
- class Net::HTTPOK < Net::HTTPSuccess # 200
43
- HAS_BODY = true
44
- end
45
- class Net::HTTPCreated < Net::HTTPSuccess # 201
46
- HAS_BODY = true
47
- end
48
- class Net::HTTPAccepted < Net::HTTPSuccess # 202
49
- HAS_BODY = true
50
- end
51
- class Net::HTTPNonAuthoritativeInformation < Net::HTTPSuccess # 203
52
- HAS_BODY = true
53
- end
54
- class Net::HTTPNoContent < Net::HTTPSuccess # 204
55
- HAS_BODY = false
56
- end
57
- class Net::HTTPResetContent < Net::HTTPSuccess # 205
58
- HAS_BODY = false
59
- end
60
- class Net::HTTPPartialContent < Net::HTTPSuccess # 206
61
- HAS_BODY = true
62
- end
63
- class Net::HTTPMultiStatus < Net::HTTPSuccess # 207 - RFC 4918
64
- HAS_BODY = true
65
- end
66
- class Net::HTTPAlreadyReported < Net::HTTPSuccess # 208 - RFC 5842
67
- HAS_BODY = true
68
- end
69
- class Net::HTTPIMUsed < Net::HTTPSuccess # 226 - RFC 3229
70
- HAS_BODY = true
71
- end
7
+ class HTTPUnknownResponse < HTTPResponse
8
+ HAS_BODY = true
9
+ EXCEPTION_TYPE = HTTPError #
10
+ end
72
11
 
73
- class Net::HTTPMultipleChoices < Net::HTTPRedirection # 300
74
- HAS_BODY = true
75
- end
76
- Net::HTTPMultipleChoice = Net::HTTPMultipleChoices
77
- class Net::HTTPMovedPermanently < Net::HTTPRedirection # 301
78
- HAS_BODY = true
79
- end
80
- class Net::HTTPFound < Net::HTTPRedirection # 302
81
- HAS_BODY = true
82
- end
83
- Net::HTTPMovedTemporarily = Net::HTTPFound
84
- class Net::HTTPSeeOther < Net::HTTPRedirection # 303
85
- HAS_BODY = true
86
- end
87
- class Net::HTTPNotModified < Net::HTTPRedirection # 304
88
- HAS_BODY = false
89
- end
90
- class Net::HTTPUseProxy < Net::HTTPRedirection # 305
91
- HAS_BODY = false
92
- end
93
- # 306 Switch Proxy - no longer unused
94
- class Net::HTTPTemporaryRedirect < Net::HTTPRedirection # 307
95
- HAS_BODY = true
96
- end
97
- class Net::HTTPPermanentRedirect < Net::HTTPRedirection # 308
98
- HAS_BODY = true
99
- end
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
22
+ HAS_BODY = false
23
+ EXCEPTION_TYPE = HTTPError #
24
+ end
100
25
 
101
- class Net::HTTPBadRequest < Net::HTTPClientError # 400
102
- HAS_BODY = true
103
- end
104
- class Net::HTTPUnauthorized < Net::HTTPClientError # 401
105
- HAS_BODY = true
106
- end
107
- class Net::HTTPPaymentRequired < Net::HTTPClientError # 402
108
- HAS_BODY = true
109
- end
110
- class Net::HTTPForbidden < Net::HTTPClientError # 403
111
- HAS_BODY = true
112
- end
113
- class Net::HTTPNotFound < Net::HTTPClientError # 404
114
- HAS_BODY = true
115
- end
116
- class Net::HTTPMethodNotAllowed < Net::HTTPClientError # 405
117
- HAS_BODY = true
118
- end
119
- class Net::HTTPNotAcceptable < Net::HTTPClientError # 406
120
- HAS_BODY = true
121
- end
122
- class Net::HTTPProxyAuthenticationRequired < Net::HTTPClientError # 407
123
- HAS_BODY = true
124
- end
125
- class Net::HTTPRequestTimeout < Net::HTTPClientError # 408
126
- HAS_BODY = true
127
- end
128
- Net::HTTPRequestTimeOut = Net::HTTPRequestTimeout
129
- class Net::HTTPConflict < Net::HTTPClientError # 409
130
- HAS_BODY = true
131
- end
132
- class Net::HTTPGone < Net::HTTPClientError # 410
133
- HAS_BODY = true
134
- end
135
- class Net::HTTPLengthRequired < Net::HTTPClientError # 411
136
- HAS_BODY = true
137
- end
138
- class Net::HTTPPreconditionFailed < Net::HTTPClientError # 412
139
- HAS_BODY = true
140
- end
141
- class Net::HTTPPayloadTooLarge < Net::HTTPClientError # 413
142
- HAS_BODY = true
143
- end
144
- Net::HTTPRequestEntityTooLarge = Net::HTTPPayloadTooLarge
145
- class Net::HTTPURITooLong < Net::HTTPClientError # 414
146
- HAS_BODY = true
147
- end
148
- Net::HTTPRequestURITooLong = Net::HTTPURITooLong
149
- Net::HTTPRequestURITooLarge = Net::HTTPRequestURITooLong
150
- class Net::HTTPUnsupportedMediaType < Net::HTTPClientError # 415
151
- HAS_BODY = true
152
- end
153
- class Net::HTTPRangeNotSatisfiable < Net::HTTPClientError # 416
154
- HAS_BODY = true
155
- end
156
- Net::HTTPRequestedRangeNotSatisfiable = Net::HTTPRangeNotSatisfiable
157
- class Net::HTTPExpectationFailed < Net::HTTPClientError # 417
158
- HAS_BODY = true
159
- end
160
- # 418 I'm a teapot - RFC 2324; a joke RFC
161
- # 420 Enhance Your Calm - Twitter
162
- class Net::HTTPMisdirectedRequest < Net::HTTPClientError # 421 - RFC 7540
163
- HAS_BODY = true
164
- end
165
- class Net::HTTPUnprocessableEntity < Net::HTTPClientError # 422 - RFC 4918
166
- HAS_BODY = true
167
- end
168
- class Net::HTTPLocked < Net::HTTPClientError # 423 - RFC 4918
169
- HAS_BODY = true
170
- end
171
- class Net::HTTPFailedDependency < Net::HTTPClientError # 424 - RFC 4918
172
- HAS_BODY = true
173
- end
174
- # 425 Unordered Collection - existed only in draft
175
- class Net::HTTPUpgradeRequired < Net::HTTPClientError # 426 - RFC 2817
176
- HAS_BODY = true
177
- end
178
- class Net::HTTPPreconditionRequired < Net::HTTPClientError # 428 - RFC 6585
179
- HAS_BODY = true
180
- end
181
- class Net::HTTPTooManyRequests < Net::HTTPClientError # 429 - RFC 6585
182
- HAS_BODY = true
183
- end
184
- class Net::HTTPRequestHeaderFieldsTooLarge < Net::HTTPClientError # 431 - RFC 6585
185
- HAS_BODY = true
186
- end
187
- class Net::HTTPUnavailableForLegalReasons < Net::HTTPClientError # 451 - RFC 7725
188
- HAS_BODY = true
189
- end
190
- # 444 No Response - Nginx
191
- # 449 Retry With - Microsoft
192
- # 450 Blocked by Windows Parental Controls - Microsoft
193
- # 499 Client Closed Request - Nginx
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
37
+ HAS_BODY = true
38
+ EXCEPTION_TYPE = HTTPError #
39
+ end
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
52
+ HAS_BODY = true
53
+ EXCEPTION_TYPE = HTTPRetriableError #
54
+ end
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
66
+ HAS_BODY = true
67
+ EXCEPTION_TYPE = HTTPClientException #
68
+ end
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
80
+ HAS_BODY = true
81
+ EXCEPTION_TYPE = HTTPFatalError #
82
+ end
83
+
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
95
+ HAS_BODY = false
96
+ end
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
110
+ HAS_BODY = false
111
+ end
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
123
+ HAS_BODY = false
124
+ end
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
138
+ HAS_BODY = false
139
+ end
140
+
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
147
+ HAS_BODY = true
148
+ end
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
156
+ HAS_BODY = true
157
+ end
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
165
+ HAS_BODY = true
166
+ end
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
176
+ HAS_BODY = true
177
+ end
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
185
+ HAS_BODY = false
186
+ end
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
195
+ HAS_BODY = false
196
+ end
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
205
+ HAS_BODY = true
206
+ end
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
215
+ HAS_BODY = true
216
+ end
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
227
+ HAS_BODY = true
228
+ end
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
237
+ HAS_BODY = true
238
+ end
239
+
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
246
+ HAS_BODY = true
247
+ end
248
+ HTTPMultipleChoice = HTTPMultipleChoices
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
256
+ HAS_BODY = true
257
+ end
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
265
+ HAS_BODY = true
266
+ end
267
+ HTTPMovedTemporarily = HTTPFound
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
274
+ HAS_BODY = true
275
+ end
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
283
+ HAS_BODY = false
284
+ end
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
292
+ HAS_BODY = false
293
+ end
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
301
+ HAS_BODY = true
302
+ end
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
309
+ HAS_BODY = true
310
+ end
311
+
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
317
+ HAS_BODY = true
318
+ end
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
325
+ HAS_BODY = true
326
+ end
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
333
+ HAS_BODY = true
334
+ end
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
342
+ HAS_BODY = true
343
+ end
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
350
+ HAS_BODY = true
351
+ end
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
358
+ HAS_BODY = true
359
+ end
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
367
+ HAS_BODY = true
368
+ end
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
375
+ HAS_BODY = true
376
+ end
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
383
+ HAS_BODY = true
384
+ end
385
+ HTTPRequestTimeOut = HTTPRequestTimeout
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
392
+ HAS_BODY = true
393
+ end
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
401
+ HAS_BODY = true
402
+ end
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
410
+ HAS_BODY = true
411
+ end
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
419
+ HAS_BODY = true
420
+ end
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
427
+ HAS_BODY = true
428
+ end
429
+ HTTPRequestEntityTooLarge = HTTPPayloadTooLarge
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
436
+ HAS_BODY = true
437
+ end
438
+ HTTPRequestURITooLong = HTTPURITooLong
439
+ HTTPRequestURITooLarge = HTTPRequestURITooLong
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
446
+ HAS_BODY = true
447
+ end
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
454
+ HAS_BODY = true
455
+ end
456
+ HTTPRequestedRangeNotSatisfiable = HTTPRangeNotSatisfiable
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
463
+ HAS_BODY = true
464
+ end
465
+
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
+
469
+ # 420 Enhance Your Calm - Twitter
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
476
+ HAS_BODY = true
477
+ end
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
484
+ HAS_BODY = true
485
+ end
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
492
+ HAS_BODY = true
493
+ end
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
500
+ HAS_BODY = true
501
+ end
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
511
+ HAS_BODY = true
512
+ end
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
519
+ HAS_BODY = true
520
+ end
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
527
+ HAS_BODY = true
528
+ end
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
536
+ HAS_BODY = true
537
+ end
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
545
+ HAS_BODY = true
546
+ end
547
+ # 444 No Response - Nginx
548
+ # 449 Retry With - Microsoft
549
+ # 450 Blocked by Windows Parental Controls - Microsoft
550
+ # 499 Client Closed Request - Nginx
551
+
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
557
+ HAS_BODY = true
558
+ end
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
566
+ HAS_BODY = true
567
+ end
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
575
+ HAS_BODY = true
576
+ end
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
584
+ HAS_BODY = true
585
+ end
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
593
+ HAS_BODY = true
594
+ end
595
+ HTTPGatewayTimeOut = HTTPGatewayTimeout
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
602
+ HAS_BODY = true
603
+ end
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
610
+ HAS_BODY = true
611
+ end
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
618
+ HAS_BODY = true
619
+ end
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
626
+ HAS_BODY = true
627
+ end
628
+ # 509 Bandwidth Limit Exceeded - Apache bw/limited extension
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
635
+ HAS_BODY = true
636
+ end
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
643
+ HAS_BODY = true
644
+ end
194
645
 
195
- class Net::HTTPInternalServerError < Net::HTTPServerError # 500
196
- HAS_BODY = true
197
- end
198
- class Net::HTTPNotImplemented < Net::HTTPServerError # 501
199
- HAS_BODY = true
200
- end
201
- class Net::HTTPBadGateway < Net::HTTPServerError # 502
202
- HAS_BODY = true
203
- end
204
- class Net::HTTPServiceUnavailable < Net::HTTPServerError # 503
205
- HAS_BODY = true
206
- end
207
- class Net::HTTPGatewayTimeout < Net::HTTPServerError # 504
208
- HAS_BODY = true
209
- end
210
- Net::HTTPGatewayTimeOut = Net::HTTPGatewayTimeout
211
- class Net::HTTPVersionNotSupported < Net::HTTPServerError # 505
212
- HAS_BODY = true
213
- end
214
- class Net::HTTPVariantAlsoNegotiates < Net::HTTPServerError # 506
215
- HAS_BODY = true
216
- end
217
- class Net::HTTPInsufficientStorage < Net::HTTPServerError # 507 - RFC 4918
218
- HAS_BODY = true
219
- end
220
- class Net::HTTPLoopDetected < Net::HTTPServerError # 508 - RFC 5842
221
- HAS_BODY = true
222
- end
223
- # 509 Bandwidth Limit Exceeded - Apache bw/limited extension
224
- class Net::HTTPNotExtended < Net::HTTPServerError # 510 - RFC 2774
225
- HAS_BODY = true
226
- end
227
- class Net::HTTPNetworkAuthenticationRequired < Net::HTTPServerError # 511 - RFC 6585
228
- HAS_BODY = true
229
646
  end
230
647
 
231
648
  class Net::HTTPResponse
@@ -303,5 +720,3 @@ class Net::HTTPResponse
303
720
  '511' => Net::HTTPNetworkAuthenticationRequired,
304
721
  }
305
722
  end
306
-
307
- # :startdoc: