net-http 0.2.2 → 0.3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/net/http/exceptions.rb +27 -26
- data/lib/net/http/generic_request.rb +2 -1
- data/lib/net/http/header.rb +3 -2
- data/lib/net/http/responses.rb +228 -223
- data/lib/net/http.rb +12 -18
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3acb7aa2ebc9a987516c4e7695092854871c1a598c3a78a3dd3b171d4b183b9f
|
4
|
+
data.tar.gz: c6d54e1d976cdad0f93e51d37ad9c640350e7bbb449747dafaafd4e86a4dea6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94d18f7753cc8c766cd94d3923f5b863ac2c47888daf9219fa4df8c280b9351b4b84212d8beb903ef1bb48bcdc1eb28ab462e98991ee692c8d439f4b0451c2c7
|
7
|
+
data.tar.gz: bd9c39b50408b619d6bf0eff06bc3eb2b532ba888558e6d30457e0fbc80d4f05351805d12ec2926e1824969627e53821b399fc93cde073a44073f774dbbb88cd
|
data/lib/net/http/exceptions.rb
CHANGED
@@ -1,33 +1,34 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
module Net
|
3
|
+
# Net::HTTP exception class.
|
4
|
+
# You cannot use Net::HTTPExceptions directly; instead, you must use
|
5
|
+
# its subclasses.
|
6
|
+
module HTTPExceptions
|
7
|
+
def initialize(msg, res) #:nodoc:
|
8
|
+
super msg
|
9
|
+
@response = res
|
10
|
+
end
|
11
|
+
attr_reader :response
|
12
|
+
alias data response #:nodoc: obsolete
|
9
13
|
end
|
10
|
-
attr_reader :response
|
11
|
-
alias data response #:nodoc: obsolete
|
12
|
-
end
|
13
|
-
class Net::HTTPError < Net::ProtocolError
|
14
|
-
include Net::HTTPExceptions
|
15
|
-
end
|
16
|
-
class Net::HTTPRetriableError < Net::ProtoRetriableError
|
17
|
-
include Net::HTTPExceptions
|
18
|
-
end
|
19
|
-
class Net::HTTPServerException < Net::ProtoServerError
|
20
|
-
# We cannot use the name "HTTPServerError", it is the name of the response.
|
21
|
-
include Net::HTTPExceptions
|
22
|
-
end
|
23
14
|
|
24
|
-
|
25
|
-
|
15
|
+
class HTTPError < ProtocolError
|
16
|
+
include HTTPExceptions
|
17
|
+
end
|
26
18
|
|
27
|
-
class
|
28
|
-
|
29
|
-
end
|
19
|
+
class HTTPRetriableError < ProtoRetriableError
|
20
|
+
include HTTPExceptions
|
21
|
+
end
|
30
22
|
|
31
|
-
|
23
|
+
class HTTPClientException < ProtoServerError
|
24
|
+
include HTTPExceptions
|
25
|
+
end
|
26
|
+
|
27
|
+
class HTTPFatalError < ProtoFatalError
|
28
|
+
include HTTPExceptions
|
29
|
+
end
|
30
|
+
|
31
|
+
# We cannot use the name "HTTPServerError", it is the name of the response.
|
32
|
+
HTTPServerException = HTTPClientException # :nodoc:
|
32
33
|
deprecate_constant(:HTTPServerException)
|
33
34
|
end
|
@@ -15,7 +15,8 @@ class Net::HTTPGenericRequest
|
|
15
15
|
|
16
16
|
if URI === uri_or_path then
|
17
17
|
raise ArgumentError, "not an HTTP URI" unless URI::HTTP === uri_or_path
|
18
|
-
|
18
|
+
hostname = uri_or_path.hostname
|
19
|
+
raise ArgumentError, "no host component for URI" unless (hostname && hostname.length > 0)
|
19
20
|
@uri = uri_or_path.dup
|
20
21
|
host = @uri.hostname.dup
|
21
22
|
host << ":".freeze << @uri.port.to_s if @uri.port != @uri.default_port
|
data/lib/net/http/header.rb
CHANGED
@@ -338,9 +338,10 @@ module Net::HTTPHeader
|
|
338
338
|
# fits inside the full entity body, as range of byte offsets.
|
339
339
|
def content_range
|
340
340
|
return nil unless @header['content-range']
|
341
|
-
m = %r
|
341
|
+
m = %r<\A\s*(\w+)\s+(\d+)-(\d+)/(\d+|\*)>.match(self['Content-Range']) or
|
342
342
|
raise Net::HTTPHeaderSyntaxError, 'wrong Content-Range format'
|
343
|
-
m[1]
|
343
|
+
return unless m[1] == 'bytes'
|
344
|
+
m[2].to_i .. m[3].to_i
|
344
345
|
end
|
345
346
|
|
346
347
|
# The length of the range represented in Content-Range: header.
|
data/lib/net/http/responses.rb
CHANGED
@@ -1,231 +1,238 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
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
|
-
|
30
|
-
|
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
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
class
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
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
|
102
|
-
|
103
|
-
end
|
104
|
-
class
|
105
|
-
|
106
|
-
end
|
107
|
-
class
|
108
|
-
|
109
|
-
end
|
110
|
-
class
|
111
|
-
|
112
|
-
end
|
113
|
-
class
|
114
|
-
|
115
|
-
end
|
116
|
-
class
|
117
|
-
|
118
|
-
end
|
119
|
-
class
|
120
|
-
|
121
|
-
end
|
122
|
-
class
|
123
|
-
|
124
|
-
end
|
125
|
-
class
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
|
130
|
-
|
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
|
196
|
-
|
197
|
-
end
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
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:
|
data/lib/net/http.rb
CHANGED
@@ -133,7 +133,7 @@ module Net #:nodoc:
|
|
133
133
|
# puts res.class.name # => 'HTTPOK'
|
134
134
|
#
|
135
135
|
# # Body
|
136
|
-
# puts res.body
|
136
|
+
# puts res.body
|
137
137
|
#
|
138
138
|
# === Following Redirection
|
139
139
|
#
|
@@ -397,7 +397,7 @@ module Net #:nodoc:
|
|
397
397
|
class HTTP < Protocol
|
398
398
|
|
399
399
|
# :stopdoc:
|
400
|
-
VERSION = "0.
|
400
|
+
VERSION = "0.3.0.1"
|
401
401
|
Revision = %q$Revision$.split[1]
|
402
402
|
HTTPVersion = '1.1'
|
403
403
|
begin
|
@@ -1013,13 +1013,14 @@ module Net #:nodoc:
|
|
1013
1013
|
end
|
1014
1014
|
|
1015
1015
|
debug "opening connection to #{conn_addr}:#{conn_port}..."
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1016
|
+
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
|
1017
|
+
begin
|
1018
|
+
TCPSocket.open(conn_addr, conn_port, @local_host, @local_port)
|
1019
|
+
rescue => e
|
1020
|
+
raise e, "Failed to open TCP connection to " +
|
1021
|
+
"#{conn_addr}:#{conn_port} (#{e.message})"
|
1022
|
+
end
|
1023
|
+
}
|
1023
1024
|
s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
1024
1025
|
debug "opened"
|
1025
1026
|
if use_ssl?
|
@@ -1221,16 +1222,9 @@ module Net #:nodoc:
|
|
1221
1222
|
end
|
1222
1223
|
end
|
1223
1224
|
|
1224
|
-
# [Bug #12921]
|
1225
|
-
if /linux|freebsd|darwin/ =~ RUBY_PLATFORM
|
1226
|
-
ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE = true
|
1227
|
-
else
|
1228
|
-
ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE = false
|
1229
|
-
end
|
1230
|
-
|
1231
1225
|
# The username of the proxy server, if one is configured.
|
1232
1226
|
def proxy_user
|
1233
|
-
if
|
1227
|
+
if @proxy_from_env
|
1234
1228
|
user = proxy_uri&.user
|
1235
1229
|
unescape(user) if user
|
1236
1230
|
else
|
@@ -1240,7 +1234,7 @@ module Net #:nodoc:
|
|
1240
1234
|
|
1241
1235
|
# The password of the proxy server, if one is configured.
|
1242
1236
|
def proxy_pass
|
1243
|
-
if
|
1237
|
+
if @proxy_from_env
|
1244
1238
|
pass = proxy_uri&.password
|
1245
1239
|
unescape(pass) if pass
|
1246
1240
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NARUSE, Yui
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uri
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubygems_version: 3.
|
78
|
+
rubygems_version: 3.6.0.dev
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: HTTP client api for Ruby.
|