net-http 0.2.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,231 +1,238 @@
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
6
+ # :stopdoc:
41
7
 
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
8
+ class HTTPUnknownResponse < HTTPResponse
9
+ HAS_BODY = true
10
+ EXCEPTION_TYPE = HTTPError #
11
+ end
12
+ class HTTPInformation < HTTPResponse # 1xx
13
+ HAS_BODY = false
14
+ EXCEPTION_TYPE = HTTPError #
15
+ end
16
+ class HTTPSuccess < HTTPResponse # 2xx
17
+ HAS_BODY = true
18
+ EXCEPTION_TYPE = HTTPError #
19
+ end
20
+ class HTTPRedirection < HTTPResponse # 3xx
21
+ HAS_BODY = true
22
+ EXCEPTION_TYPE = HTTPRetriableError #
23
+ end
24
+ class HTTPClientError < HTTPResponse # 4xx
25
+ HAS_BODY = true
26
+ EXCEPTION_TYPE = HTTPClientException #
27
+ end
28
+ class HTTPServerError < HTTPResponse # 5xx
29
+ HAS_BODY = true
30
+ EXCEPTION_TYPE = HTTPFatalError #
31
+ end
72
32
 
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
33
+ class HTTPContinue < HTTPInformation # 100
34
+ HAS_BODY = false
35
+ end
36
+ class HTTPSwitchProtocol < HTTPInformation # 101
37
+ HAS_BODY = false
38
+ end
39
+ class HTTPProcessing < HTTPInformation # 102
40
+ HAS_BODY = false
41
+ end
42
+ class HTTPEarlyHints < HTTPInformation # 103 - RFC 8297
43
+ HAS_BODY = false
44
+ end
100
45
 
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
46
+ class HTTPOK < HTTPSuccess # 200
47
+ HAS_BODY = true
48
+ end
49
+ class HTTPCreated < HTTPSuccess # 201
50
+ HAS_BODY = true
51
+ end
52
+ class HTTPAccepted < HTTPSuccess # 202
53
+ HAS_BODY = true
54
+ end
55
+ class HTTPNonAuthoritativeInformation < HTTPSuccess # 203
56
+ HAS_BODY = true
57
+ end
58
+ class HTTPNoContent < HTTPSuccess # 204
59
+ HAS_BODY = false
60
+ end
61
+ class HTTPResetContent < HTTPSuccess # 205
62
+ HAS_BODY = false
63
+ end
64
+ class HTTPPartialContent < HTTPSuccess # 206
65
+ HAS_BODY = true
66
+ end
67
+ class HTTPMultiStatus < HTTPSuccess # 207 - RFC 4918
68
+ HAS_BODY = true
69
+ end
70
+ class HTTPAlreadyReported < HTTPSuccess # 208 - RFC 5842
71
+ HAS_BODY = true
72
+ end
73
+ class HTTPIMUsed < HTTPSuccess # 226 - RFC 3229
74
+ HAS_BODY = true
75
+ end
194
76
 
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
77
+ class HTTPMultipleChoices < HTTPRedirection # 300
78
+ HAS_BODY = true
79
+ end
80
+ HTTPMultipleChoice = HTTPMultipleChoices
81
+ class HTTPMovedPermanently < HTTPRedirection # 301
82
+ HAS_BODY = true
83
+ end
84
+ class HTTPFound < HTTPRedirection # 302
85
+ HAS_BODY = true
86
+ end
87
+ HTTPMovedTemporarily = HTTPFound
88
+ class HTTPSeeOther < HTTPRedirection # 303
89
+ HAS_BODY = true
90
+ end
91
+ class HTTPNotModified < HTTPRedirection # 304
92
+ HAS_BODY = false
93
+ end
94
+ class HTTPUseProxy < HTTPRedirection # 305
95
+ HAS_BODY = false
96
+ end
97
+ # 306 Switch Proxy - no longer unused
98
+ class HTTPTemporaryRedirect < HTTPRedirection # 307
99
+ HAS_BODY = true
100
+ end
101
+ class HTTPPermanentRedirect < HTTPRedirection # 308
102
+ HAS_BODY = true
103
+ end
104
+
105
+ class HTTPBadRequest < HTTPClientError # 400
106
+ HAS_BODY = true
107
+ end
108
+ class HTTPUnauthorized < HTTPClientError # 401
109
+ HAS_BODY = true
110
+ end
111
+ class HTTPPaymentRequired < HTTPClientError # 402
112
+ HAS_BODY = true
113
+ end
114
+ class HTTPForbidden < HTTPClientError # 403
115
+ HAS_BODY = true
116
+ end
117
+ class HTTPNotFound < HTTPClientError # 404
118
+ HAS_BODY = true
119
+ end
120
+ class HTTPMethodNotAllowed < HTTPClientError # 405
121
+ HAS_BODY = true
122
+ end
123
+ class HTTPNotAcceptable < HTTPClientError # 406
124
+ HAS_BODY = true
125
+ end
126
+ class HTTPProxyAuthenticationRequired < HTTPClientError # 407
127
+ HAS_BODY = true
128
+ end
129
+ class HTTPRequestTimeout < HTTPClientError # 408
130
+ HAS_BODY = true
131
+ end
132
+ HTTPRequestTimeOut = HTTPRequestTimeout
133
+ class HTTPConflict < HTTPClientError # 409
134
+ HAS_BODY = true
135
+ end
136
+ class HTTPGone < HTTPClientError # 410
137
+ HAS_BODY = true
138
+ end
139
+ class HTTPLengthRequired < HTTPClientError # 411
140
+ HAS_BODY = true
141
+ end
142
+ class HTTPPreconditionFailed < HTTPClientError # 412
143
+ HAS_BODY = true
144
+ end
145
+ class HTTPPayloadTooLarge < HTTPClientError # 413
146
+ HAS_BODY = true
147
+ end
148
+ HTTPRequestEntityTooLarge = HTTPPayloadTooLarge
149
+ class HTTPURITooLong < HTTPClientError # 414
150
+ HAS_BODY = true
151
+ end
152
+ HTTPRequestURITooLong = HTTPURITooLong
153
+ HTTPRequestURITooLarge = HTTPRequestURITooLong
154
+ class HTTPUnsupportedMediaType < HTTPClientError # 415
155
+ HAS_BODY = true
156
+ end
157
+ class HTTPRangeNotSatisfiable < HTTPClientError # 416
158
+ HAS_BODY = true
159
+ end
160
+ HTTPRequestedRangeNotSatisfiable = HTTPRangeNotSatisfiable
161
+ class HTTPExpectationFailed < HTTPClientError # 417
162
+ HAS_BODY = true
163
+ end
164
+ # 418 I'm a teapot - RFC 2324; a joke RFC
165
+ # 420 Enhance Your Calm - Twitter
166
+ class HTTPMisdirectedRequest < HTTPClientError # 421 - RFC 7540
167
+ HAS_BODY = true
168
+ end
169
+ class HTTPUnprocessableEntity < HTTPClientError # 422 - RFC 4918
170
+ HAS_BODY = true
171
+ end
172
+ class HTTPLocked < HTTPClientError # 423 - RFC 4918
173
+ HAS_BODY = true
174
+ end
175
+ class HTTPFailedDependency < HTTPClientError # 424 - RFC 4918
176
+ HAS_BODY = true
177
+ end
178
+ # 425 Unordered Collection - existed only in draft
179
+ class HTTPUpgradeRequired < HTTPClientError # 426 - RFC 2817
180
+ HAS_BODY = true
181
+ end
182
+ class HTTPPreconditionRequired < HTTPClientError # 428 - RFC 6585
183
+ HAS_BODY = true
184
+ end
185
+ class HTTPTooManyRequests < HTTPClientError # 429 - RFC 6585
186
+ HAS_BODY = true
187
+ end
188
+ class HTTPRequestHeaderFieldsTooLarge < HTTPClientError # 431 - RFC 6585
189
+ HAS_BODY = true
190
+ end
191
+ class HTTPUnavailableForLegalReasons < HTTPClientError # 451 - RFC 7725
192
+ HAS_BODY = true
193
+ end
194
+ # 444 No Response - Nginx
195
+ # 449 Retry With - Microsoft
196
+ # 450 Blocked by Windows Parental Controls - Microsoft
197
+ # 499 Client Closed Request - Nginx
198
+
199
+ class HTTPInternalServerError < HTTPServerError # 500
200
+ HAS_BODY = true
201
+ end
202
+ class HTTPNotImplemented < HTTPServerError # 501
203
+ HAS_BODY = true
204
+ end
205
+ class HTTPBadGateway < HTTPServerError # 502
206
+ HAS_BODY = true
207
+ end
208
+ class HTTPServiceUnavailable < HTTPServerError # 503
209
+ HAS_BODY = true
210
+ end
211
+ class HTTPGatewayTimeout < HTTPServerError # 504
212
+ HAS_BODY = true
213
+ end
214
+ HTTPGatewayTimeOut = HTTPGatewayTimeout
215
+ class HTTPVersionNotSupported < HTTPServerError # 505
216
+ HAS_BODY = true
217
+ end
218
+ class HTTPVariantAlsoNegotiates < HTTPServerError # 506
219
+ HAS_BODY = true
220
+ end
221
+ class HTTPInsufficientStorage < HTTPServerError # 507 - RFC 4918
222
+ HAS_BODY = true
223
+ end
224
+ class HTTPLoopDetected < HTTPServerError # 508 - RFC 5842
225
+ HAS_BODY = true
226
+ end
227
+ # 509 Bandwidth Limit Exceeded - Apache bw/limited extension
228
+ class HTTPNotExtended < HTTPServerError # 510 - RFC 2774
229
+ HAS_BODY = true
230
+ end
231
+ class HTTPNetworkAuthenticationRequired < HTTPServerError # 511 - RFC 6585
232
+ HAS_BODY = true
233
+ end
234
+
235
+ # :startdoc:
229
236
  end
230
237
 
231
238
  class Net::HTTPResponse
@@ -303,5 +310,3 @@ class Net::HTTPResponse
303
310
  '511' => Net::HTTPNetworkAuthenticationRequired,
304
311
  }
305
312
  end
306
-
307
- # :startdoc: