capistrano-data_plane_api 0.1.5 → 0.2.0

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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -2
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG.md +6 -0
  5. data/Gemfile +7 -4
  6. data/Gemfile.lock +108 -69
  7. data/README.md +5 -0
  8. data/capistrano-data_plane_api.gemspec +5 -2
  9. data/exe/cap_data_plane_api +3 -2
  10. data/lib/capistrano/data_plane_api/configuration/backend.rb +2 -0
  11. data/lib/capistrano/data_plane_api/configuration/server.rb +4 -2
  12. data/lib/capistrano/data_plane_api/configuration/symbol.rb +2 -0
  13. data/lib/capistrano/data_plane_api/configuration.rb +3 -3
  14. data/lib/capistrano/data_plane_api/deploy/args.rb +71 -40
  15. data/lib/capistrano/data_plane_api/deploy/deployment_stats.rb +29 -25
  16. data/lib/capistrano/data_plane_api/deploy/group.rb +33 -24
  17. data/lib/capistrano/data_plane_api/deploy/helper.rb +3 -5
  18. data/lib/capistrano/data_plane_api/deploy/server_stats.rb +60 -43
  19. data/lib/capistrano/data_plane_api/deploy.rb +3 -2
  20. data/lib/capistrano/data_plane_api/diggable.rb +5 -2
  21. data/lib/capistrano/data_plane_api/equatable.rb +4 -2
  22. data/lib/capistrano/data_plane_api/helper.rb +31 -27
  23. data/lib/capistrano/data_plane_api/hooks.rb +1 -0
  24. data/lib/capistrano/data_plane_api/show_state.rb +15 -12
  25. data/lib/capistrano/data_plane_api/tasks.rb +26 -2
  26. data/lib/capistrano/data_plane_api/terminal_print_loop.rb +7 -4
  27. data/lib/capistrano/data_plane_api/type.rb +9 -5
  28. data/lib/capistrano/data_plane_api/version.rb +2 -2
  29. data/lib/capistrano/data_plane_api.rb +96 -69
  30. data/lib/capistrano-data_plane_api.rb +4 -0
  31. data/rbi/capistrano-data_plane_api.rbi +283 -0
  32. data/sorbet/config +6 -0
  33. data/sorbet/rbi/annotations/.gitattributes +1 -0
  34. data/sorbet/rbi/annotations/faraday.rbi +17 -0
  35. data/sorbet/rbi/annotations/minitest.rbi +119 -0
  36. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  37. data/sorbet/rbi/annotations/webmock.rbi +9 -0
  38. data/sorbet/rbi/dsl/.gitattributes +1 -0
  39. data/sorbet/rbi/dsl/capistrano/data_plane_api/configuration/backend.rbi +50 -0
  40. data/sorbet/rbi/dsl/capistrano/data_plane_api/configuration/server.rbi +24 -0
  41. data/sorbet/rbi/dsl/capistrano/data_plane_api/configuration.rbi +52 -0
  42. data/sorbet/rbi/dsl/capistrano/data_plane_api/type.rbi +12 -0
  43. data/sorbet/rbi/gems/.gitattributes +1 -0
  44. data/sorbet/rbi/gems/addressable@2.8.7.rbi +1994 -0
  45. data/sorbet/rbi/gems/ast@2.4.3.rbi +585 -0
  46. data/sorbet/rbi/gems/base64@0.2.0.rbi +509 -0
  47. data/sorbet/rbi/gems/bigdecimal@3.1.9.rbi +8 -0
  48. data/sorbet/rbi/gems/booleans@0.1.3.rbi +28 -0
  49. data/sorbet/rbi/gems/byebug@12.0.0.rbi +37 -0
  50. data/sorbet/rbi/gems/crack@1.0.0.rbi +145 -0
  51. data/sorbet/rbi/gems/data_plane_api@0.2.0.rbi +238 -0
  52. data/sorbet/rbi/gems/faraday-net_http@3.4.0.rbi +147 -0
  53. data/sorbet/rbi/gems/faraday@2.13.0.rbi +2974 -0
  54. data/sorbet/rbi/gems/hashdiff@1.1.2.rbi +353 -0
  55. data/sorbet/rbi/gems/json@2.10.2.rbi +2113 -0
  56. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +240 -0
  57. data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
  58. data/sorbet/rbi/gems/minitest@5.25.5.rbi +1547 -0
  59. data/sorbet/rbi/gems/net-http@0.6.0.rbi +4247 -0
  60. data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
  61. data/sorbet/rbi/gems/pastel@0.8.0.rbi +733 -0
  62. data/sorbet/rbi/gems/public_suffix@6.0.1.rbi +936 -0
  63. data/sorbet/rbi/gems/racc@1.8.1.rbi +160 -0
  64. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +404 -0
  65. data/sorbet/rbi/gems/rake@13.0.6.rbi +3030 -0
  66. data/sorbet/rbi/gems/rexml@3.4.1.rbi +5346 -0
  67. data/sorbet/rbi/gems/rubocop-espago@1.1.8.rbi +9 -0
  68. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
  69. data/sorbet/rbi/gems/shale-builder@0.2.4.rbi +9 -0
  70. data/sorbet/rbi/gems/shale@1.2.2.rbi +2323 -0
  71. data/sorbet/rbi/gems/shoulda-context@2.0.0.rbi +563 -0
  72. data/sorbet/rbi/gems/strings-ansi@0.2.0.rbi +178 -0
  73. data/sorbet/rbi/gems/strings@0.2.1.rbi +830 -0
  74. data/sorbet/rbi/gems/thor@1.2.1.rbi +3957 -0
  75. data/sorbet/rbi/gems/tty-box@0.7.0.rbi +593 -0
  76. data/sorbet/rbi/gems/tty-color@0.6.0.rbi +241 -0
  77. data/sorbet/rbi/gems/tty-cursor@0.7.1.rbi +443 -0
  78. data/sorbet/rbi/gems/unicode-display_width@2.6.0.rbi +66 -0
  79. data/sorbet/rbi/gems/unicode_utils@1.4.0.rbi +184 -0
  80. data/sorbet/rbi/gems/uri@1.0.3.rbi +2349 -0
  81. data/sorbet/rbi/gems/vcr@6.3.1.rbi +3040 -0
  82. data/sorbet/rbi/gems/webmock@3.25.1.rbi +1792 -0
  83. data/sorbet/rbi/shims/gems/faraday.rbi +21 -0
  84. data/sorbet/rbi/shims/gems/shoulda-context@2.0.0.rbi +15 -0
  85. data/sorbet/rbi/todo.rbi +7 -0
  86. data/sorbet/tapioca/config.yml +28 -0
  87. data/sorbet/tapioca/extensions/load_gem.rb +1 -0
  88. data/sorbet/tapioca/require.rb +4 -0
  89. data/templates/bin/deploy.rb +1 -0
  90. metadata +106 -8
@@ -0,0 +1,4247 @@
1
+ # typed: false
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `net-http` gem.
5
+ # Please instead update this file by running `bin/tapioca gem net-http`.
6
+
7
+
8
+ # \Class \Net::HTTP provides a rich library that implements the client
9
+ # in a client-server model that uses the \HTTP request-response protocol.
10
+ # For information about \HTTP, see:
11
+ #
12
+ # - {Hypertext Transfer Protocol}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol].
13
+ # - {Technical overview}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Technical_overview].
14
+ #
15
+ # == About the Examples
16
+ #
17
+ # :include: doc/net-http/examples.rdoc
18
+ #
19
+ # == Strategies
20
+ #
21
+ # - If you will make only a few GET requests,
22
+ # consider using {OpenURI}[https://docs.ruby-lang.org/en/master/OpenURI.html].
23
+ # - If you will make only a few requests of all kinds,
24
+ # consider using the various singleton convenience methods in this class.
25
+ # Each of the following methods automatically starts and finishes
26
+ # a {session}[rdoc-ref:Net::HTTP@Sessions] that sends a single request:
27
+ #
28
+ # # Return string response body.
29
+ # Net::HTTP.get(hostname, path)
30
+ # Net::HTTP.get(uri)
31
+ #
32
+ # # Write string response body to $stdout.
33
+ # Net::HTTP.get_print(hostname, path)
34
+ # Net::HTTP.get_print(uri)
35
+ #
36
+ # # Return response as Net::HTTPResponse object.
37
+ # Net::HTTP.get_response(hostname, path)
38
+ # Net::HTTP.get_response(uri)
39
+ # data = '{"title": "foo", "body": "bar", "userId": 1}'
40
+ # Net::HTTP.post(uri, data)
41
+ # params = {title: 'foo', body: 'bar', userId: 1}
42
+ # Net::HTTP.post_form(uri, params)
43
+ # data = '{"title": "foo", "body": "bar", "userId": 1}'
44
+ # Net::HTTP.put(uri, data)
45
+ #
46
+ # - If performance is important, consider using sessions, which lower request overhead.
47
+ # This {session}[rdoc-ref:Net::HTTP@Sessions] has multiple requests for
48
+ # {HTTP methods}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods]
49
+ # and {WebDAV methods}[https://en.wikipedia.org/wiki/WebDAV#Implementation]:
50
+ #
51
+ # Net::HTTP.start(hostname) do |http|
52
+ # # Session started automatically before block execution.
53
+ # http.get(path)
54
+ # http.head(path)
55
+ # body = 'Some text'
56
+ # http.post(path, body) # Can also have a block.
57
+ # http.put(path, body)
58
+ # http.delete(path)
59
+ # http.options(path)
60
+ # http.trace(path)
61
+ # http.patch(path, body) # Can also have a block.
62
+ # http.copy(path)
63
+ # http.lock(path, body)
64
+ # http.mkcol(path, body)
65
+ # http.move(path)
66
+ # http.propfind(path, body)
67
+ # http.proppatch(path, body)
68
+ # http.unlock(path, body)
69
+ # # Session finished automatically at block exit.
70
+ # end
71
+ #
72
+ # The methods cited above are convenience methods that, via their few arguments,
73
+ # allow minimal control over the requests.
74
+ # For greater control, consider using {request objects}[rdoc-ref:Net::HTTPRequest].
75
+ #
76
+ # == URIs
77
+ #
78
+ # On the internet, a URI
79
+ # ({Universal Resource Identifier}[https://en.wikipedia.org/wiki/Uniform_Resource_Identifier])
80
+ # is a string that identifies a particular resource.
81
+ # It consists of some or all of: scheme, hostname, path, query, and fragment;
82
+ # see {URI syntax}[https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax].
83
+ #
84
+ # A Ruby {URI::Generic}[https://docs.ruby-lang.org/en/master/URI/Generic.html] object
85
+ # represents an internet URI.
86
+ # It provides, among others, methods
87
+ # +scheme+, +hostname+, +path+, +query+, and +fragment+.
88
+ #
89
+ # === Schemes
90
+ #
91
+ # An internet \URI has
92
+ # a {scheme}[https://en.wikipedia.org/wiki/List_of_URI_schemes].
93
+ #
94
+ # The two schemes supported in \Net::HTTP are <tt>'https'</tt> and <tt>'http'</tt>:
95
+ #
96
+ # uri.scheme # => "https"
97
+ # URI('http://example.com').scheme # => "http"
98
+ #
99
+ # === Hostnames
100
+ #
101
+ # A hostname identifies a server (host) to which requests may be sent:
102
+ #
103
+ # hostname = uri.hostname # => "jsonplaceholder.typicode.com"
104
+ # Net::HTTP.start(hostname) do |http|
105
+ # # Some HTTP stuff.
106
+ # end
107
+ #
108
+ # === Paths
109
+ #
110
+ # A host-specific path identifies a resource on the host:
111
+ #
112
+ # _uri = uri.dup
113
+ # _uri.path = '/todos/1'
114
+ # hostname = _uri.hostname
115
+ # path = _uri.path
116
+ # Net::HTTP.get(hostname, path)
117
+ #
118
+ # === Queries
119
+ #
120
+ # A host-specific query adds name/value pairs to the URI:
121
+ #
122
+ # _uri = uri.dup
123
+ # params = {userId: 1, completed: false}
124
+ # _uri.query = URI.encode_www_form(params)
125
+ # _uri # => #<URI::HTTPS https://jsonplaceholder.typicode.com?userId=1&completed=false>
126
+ # Net::HTTP.get(_uri)
127
+ #
128
+ # === Fragments
129
+ #
130
+ # A {URI fragment}[https://en.wikipedia.org/wiki/URI_fragment] has no effect
131
+ # in \Net::HTTP;
132
+ # the same data is returned, regardless of whether a fragment is included.
133
+ #
134
+ # == Request Headers
135
+ #
136
+ # Request headers may be used to pass additional information to the host,
137
+ # similar to arguments passed in a method call;
138
+ # each header is a name/value pair.
139
+ #
140
+ # Each of the \Net::HTTP methods that sends a request to the host
141
+ # has optional argument +headers+,
142
+ # where the headers are expressed as a hash of field-name/value pairs:
143
+ #
144
+ # headers = {Accept: 'application/json', Connection: 'Keep-Alive'}
145
+ # Net::HTTP.get(uri, headers)
146
+ #
147
+ # See lists of both standard request fields and common request fields at
148
+ # {Request Fields}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields].
149
+ # A host may also accept other custom fields.
150
+ #
151
+ # == \HTTP Sessions
152
+ #
153
+ # A _session_ is a connection between a server (host) and a client that:
154
+ #
155
+ # - Is begun by instance method Net::HTTP#start.
156
+ # - May contain any number of requests.
157
+ # - Is ended by instance method Net::HTTP#finish.
158
+ #
159
+ # See example sessions at {Strategies}[rdoc-ref:Net::HTTP@Strategies].
160
+ #
161
+ # === Session Using \Net::HTTP.start
162
+ #
163
+ # If you have many requests to make to a single host (and port),
164
+ # consider using singleton method Net::HTTP.start with a block;
165
+ # the method handles the session automatically by:
166
+ #
167
+ # - Calling #start before block execution.
168
+ # - Executing the block.
169
+ # - Calling #finish after block execution.
170
+ #
171
+ # In the block, you can use these instance methods,
172
+ # each of which that sends a single request:
173
+ #
174
+ # - {HTTP methods}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods]:
175
+ #
176
+ # - #get, #request_get: GET.
177
+ # - #head, #request_head: HEAD.
178
+ # - #post, #request_post: POST.
179
+ # - #delete: DELETE.
180
+ # - #options: OPTIONS.
181
+ # - #trace: TRACE.
182
+ # - #patch: PATCH.
183
+ #
184
+ # - {WebDAV methods}[https://en.wikipedia.org/wiki/WebDAV#Implementation]:
185
+ #
186
+ # - #copy: COPY.
187
+ # - #lock: LOCK.
188
+ # - #mkcol: MKCOL.
189
+ # - #move: MOVE.
190
+ # - #propfind: PROPFIND.
191
+ # - #proppatch: PROPPATCH.
192
+ # - #unlock: UNLOCK.
193
+ #
194
+ # === Session Using \Net::HTTP.start and \Net::HTTP.finish
195
+ #
196
+ # You can manage a session manually using methods #start and #finish:
197
+ #
198
+ # http = Net::HTTP.new(hostname)
199
+ # http.start
200
+ # http.get('/todos/1')
201
+ # http.get('/todos/2')
202
+ # http.delete('/posts/1')
203
+ # http.finish # Needed to free resources.
204
+ #
205
+ # === Single-Request Session
206
+ #
207
+ # Certain convenience methods automatically handle a session by:
208
+ #
209
+ # - Creating an \HTTP object
210
+ # - Starting a session.
211
+ # - Sending a single request.
212
+ # - Finishing the session.
213
+ # - Destroying the object.
214
+ #
215
+ # Such methods that send GET requests:
216
+ #
217
+ # - ::get: Returns the string response body.
218
+ # - ::get_print: Writes the string response body to $stdout.
219
+ # - ::get_response: Returns a Net::HTTPResponse object.
220
+ #
221
+ # Such methods that send POST requests:
222
+ #
223
+ # - ::post: Posts data to the host.
224
+ # - ::post_form: Posts form data to the host.
225
+ #
226
+ # == \HTTP Requests and Responses
227
+ #
228
+ # Many of the methods above are convenience methods,
229
+ # each of which sends a request and returns a string
230
+ # without directly using \Net::HTTPRequest and \Net::HTTPResponse objects.
231
+ #
232
+ # You can, however, directly create a request object, send the request,
233
+ # and retrieve the response object; see:
234
+ #
235
+ # - Net::HTTPRequest.
236
+ # - Net::HTTPResponse.
237
+ #
238
+ # == Following Redirection
239
+ #
240
+ # Each returned response is an instance of a subclass of Net::HTTPResponse.
241
+ # See the {response class hierarchy}[rdoc-ref:Net::HTTPResponse@Response+Subclasses].
242
+ #
243
+ # In particular, class Net::HTTPRedirection is the parent
244
+ # of all redirection classes.
245
+ # This allows you to craft a case statement to handle redirections properly:
246
+ #
247
+ # def fetch(uri, limit = 10)
248
+ # # You should choose a better exception.
249
+ # raise ArgumentError, 'Too many HTTP redirects' if limit == 0
250
+ #
251
+ # res = Net::HTTP.get_response(URI(uri))
252
+ # case res
253
+ # when Net::HTTPSuccess # Any success class.
254
+ # res
255
+ # when Net::HTTPRedirection # Any redirection class.
256
+ # location = res['Location']
257
+ # warn "Redirected to #{location}"
258
+ # fetch(location, limit - 1)
259
+ # else # Any other class.
260
+ # res.value
261
+ # end
262
+ # end
263
+ #
264
+ # fetch(uri)
265
+ #
266
+ # == Basic Authentication
267
+ #
268
+ # Basic authentication is performed according to
269
+ # {RFC2617}[http://www.ietf.org/rfc/rfc2617.txt]:
270
+ #
271
+ # req = Net::HTTP::Get.new(uri)
272
+ # req.basic_auth('user', 'pass')
273
+ # res = Net::HTTP.start(hostname) do |http|
274
+ # http.request(req)
275
+ # end
276
+ #
277
+ # == Streaming Response Bodies
278
+ #
279
+ # By default \Net::HTTP reads an entire response into memory. If you are
280
+ # handling large files or wish to implement a progress bar you can instead
281
+ # stream the body directly to an IO.
282
+ #
283
+ # Net::HTTP.start(hostname) do |http|
284
+ # req = Net::HTTP::Get.new(uri)
285
+ # http.request(req) do |res|
286
+ # open('t.tmp', 'w') do |f|
287
+ # res.read_body do |chunk|
288
+ # f.write chunk
289
+ # end
290
+ # end
291
+ # end
292
+ # end
293
+ #
294
+ # == HTTPS
295
+ #
296
+ # HTTPS is enabled for an \HTTP connection by Net::HTTP#use_ssl=:
297
+ #
298
+ # Net::HTTP.start(hostname, :use_ssl => true) do |http|
299
+ # req = Net::HTTP::Get.new(uri)
300
+ # res = http.request(req)
301
+ # end
302
+ #
303
+ # Or if you simply want to make a GET request, you may pass in a URI
304
+ # object that has an \HTTPS URL. \Net::HTTP automatically turns on TLS
305
+ # verification if the URI object has a 'https' URI scheme:
306
+ #
307
+ # uri # => #<URI::HTTPS https://jsonplaceholder.typicode.com/>
308
+ # Net::HTTP.get(uri)
309
+ #
310
+ # == Proxy Server
311
+ #
312
+ # An \HTTP object can have
313
+ # a {proxy server}[https://en.wikipedia.org/wiki/Proxy_server].
314
+ #
315
+ # You can create an \HTTP object with a proxy server
316
+ # using method Net::HTTP.new or method Net::HTTP.start.
317
+ #
318
+ # The proxy may be defined either by argument +p_addr+
319
+ # or by environment variable <tt>'http_proxy'</tt>.
320
+ #
321
+ # === Proxy Using Argument +p_addr+ as a \String
322
+ #
323
+ # When argument +p_addr+ is a string hostname,
324
+ # the returned +http+ has the given host as its proxy:
325
+ #
326
+ # http = Net::HTTP.new(hostname, nil, 'proxy.example')
327
+ # http.proxy? # => true
328
+ # http.proxy_from_env? # => false
329
+ # http.proxy_address # => "proxy.example"
330
+ # # These use default values.
331
+ # http.proxy_port # => 80
332
+ # http.proxy_user # => nil
333
+ # http.proxy_pass # => nil
334
+ #
335
+ # The port, username, and password for the proxy may also be given:
336
+ #
337
+ # http = Net::HTTP.new(hostname, nil, 'proxy.example', 8000, 'pname', 'ppass')
338
+ # # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false>
339
+ # http.proxy? # => true
340
+ # http.proxy_from_env? # => false
341
+ # http.proxy_address # => "proxy.example"
342
+ # http.proxy_port # => 8000
343
+ # http.proxy_user # => "pname"
344
+ # http.proxy_pass # => "ppass"
345
+ #
346
+ # === Proxy Using '<tt>ENV['http_proxy']</tt>'
347
+ #
348
+ # When environment variable <tt>'http_proxy'</tt>
349
+ # is set to a \URI string,
350
+ # the returned +http+ will have the server at that URI as its proxy;
351
+ # note that the \URI string must have a protocol
352
+ # such as <tt>'http'</tt> or <tt>'https'</tt>:
353
+ #
354
+ # ENV['http_proxy'] = 'http://example.com'
355
+ # http = Net::HTTP.new(hostname)
356
+ # http.proxy? # => true
357
+ # http.proxy_from_env? # => true
358
+ # http.proxy_address # => "example.com"
359
+ # # These use default values.
360
+ # http.proxy_port # => 80
361
+ # http.proxy_user # => nil
362
+ # http.proxy_pass # => nil
363
+ #
364
+ # The \URI string may include proxy username, password, and port number:
365
+ #
366
+ # ENV['http_proxy'] = 'http://pname:ppass@example.com:8000'
367
+ # http = Net::HTTP.new(hostname)
368
+ # http.proxy? # => true
369
+ # http.proxy_from_env? # => true
370
+ # http.proxy_address # => "example.com"
371
+ # http.proxy_port # => 8000
372
+ # http.proxy_user # => "pname"
373
+ # http.proxy_pass # => "ppass"
374
+ #
375
+ # === Filtering Proxies
376
+ #
377
+ # With method Net::HTTP.new (but not Net::HTTP.start),
378
+ # you can use argument +p_no_proxy+ to filter proxies:
379
+ #
380
+ # - Reject a certain address:
381
+ #
382
+ # http = Net::HTTP.new('example.com', nil, 'proxy.example', 8000, 'pname', 'ppass', 'proxy.example')
383
+ # http.proxy_address # => nil
384
+ #
385
+ # - Reject certain domains or subdomains:
386
+ #
387
+ # http = Net::HTTP.new('example.com', nil, 'my.proxy.example', 8000, 'pname', 'ppass', 'proxy.example')
388
+ # http.proxy_address # => nil
389
+ #
390
+ # - Reject certain addresses and port combinations:
391
+ #
392
+ # http = Net::HTTP.new('example.com', nil, 'proxy.example', 8000, 'pname', 'ppass', 'proxy.example:1234')
393
+ # http.proxy_address # => "proxy.example"
394
+ #
395
+ # http = Net::HTTP.new('example.com', nil, 'proxy.example', 8000, 'pname', 'ppass', 'proxy.example:8000')
396
+ # http.proxy_address # => nil
397
+ #
398
+ # - Reject a list of the types above delimited using a comma:
399
+ #
400
+ # http = Net::HTTP.new('example.com', nil, 'proxy.example', 8000, 'pname', 'ppass', 'my.proxy,proxy.example:8000')
401
+ # http.proxy_address # => nil
402
+ #
403
+ # http = Net::HTTP.new('example.com', nil, 'my.proxy', 8000, 'pname', 'ppass', 'my.proxy,proxy.example:8000')
404
+ # http.proxy_address # => nil
405
+ #
406
+ # == Compression and Decompression
407
+ #
408
+ # \Net::HTTP does not compress the body of a request before sending.
409
+ #
410
+ # By default, \Net::HTTP adds header <tt>'Accept-Encoding'</tt>
411
+ # to a new {request object}[rdoc-ref:Net::HTTPRequest]:
412
+ #
413
+ # Net::HTTP::Get.new(uri)['Accept-Encoding']
414
+ # # => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
415
+ #
416
+ # This requests the server to zip-encode the response body if there is one;
417
+ # the server is not required to do so.
418
+ #
419
+ # \Net::HTTP does not automatically decompress a response body
420
+ # if the response has header <tt>'Content-Range'</tt>.
421
+ #
422
+ # Otherwise decompression (or not) depends on the value of header
423
+ # {Content-Encoding}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-encoding-response-header]:
424
+ #
425
+ # - <tt>'deflate'</tt>, <tt>'gzip'</tt>, or <tt>'x-gzip'</tt>:
426
+ # decompresses the body and deletes the header.
427
+ # - <tt>'none'</tt> or <tt>'identity'</tt>:
428
+ # does not decompress the body, but deletes the header.
429
+ # - Any other value:
430
+ # leaves the body and header unchanged.
431
+ #
432
+ # == What's Here
433
+ #
434
+ # First, what's elsewhere. Class Net::HTTP:
435
+ #
436
+ # - Inherits from {class Object}[https://docs.ruby-lang.org/en/master/Object.html#class-Object-label-What-27s+Here].
437
+ #
438
+ # This is a categorized summary of methods and attributes.
439
+ #
440
+ # === \Net::HTTP Objects
441
+ #
442
+ # - {::new}[rdoc-ref:Net::HTTP.new]:
443
+ # Creates a new instance.
444
+ # - {#inspect}[rdoc-ref:Net::HTTP#inspect]:
445
+ # Returns a string representation of +self+.
446
+ #
447
+ # === Sessions
448
+ #
449
+ # - {::start}[rdoc-ref:Net::HTTP.start]:
450
+ # Begins a new session in a new \Net::HTTP object.
451
+ # - {#started?}[rdoc-ref:Net::HTTP#started?]
452
+ # (aliased as {#active?}[rdoc-ref:Net::HTTP#active?]):
453
+ # Returns whether in a session.
454
+ # - {#finish}[rdoc-ref:Net::HTTP#finish]:
455
+ # Ends an active session.
456
+ # - {#start}[rdoc-ref:Net::HTTP#start]:
457
+ # Begins a new session in an existing \Net::HTTP object (+self+).
458
+ #
459
+ # === Connections
460
+ #
461
+ # - {:continue_timeout}[rdoc-ref:Net::HTTP#continue_timeout]:
462
+ # Returns the continue timeout.
463
+ # - {#continue_timeout=}[rdoc-ref:Net::HTTP#continue_timeout=]:
464
+ # Sets the continue timeout seconds.
465
+ # - {:keep_alive_timeout}[rdoc-ref:Net::HTTP#keep_alive_timeout]:
466
+ # Returns the keep-alive timeout.
467
+ # - {:keep_alive_timeout=}[rdoc-ref:Net::HTTP#keep_alive_timeout=]:
468
+ # Sets the keep-alive timeout.
469
+ # - {:max_retries}[rdoc-ref:Net::HTTP#max_retries]:
470
+ # Returns the maximum retries.
471
+ # - {#max_retries=}[rdoc-ref:Net::HTTP#max_retries=]:
472
+ # Sets the maximum retries.
473
+ # - {:open_timeout}[rdoc-ref:Net::HTTP#open_timeout]:
474
+ # Returns the open timeout.
475
+ # - {:open_timeout=}[rdoc-ref:Net::HTTP#open_timeout=]:
476
+ # Sets the open timeout.
477
+ # - {:read_timeout}[rdoc-ref:Net::HTTP#read_timeout]:
478
+ # Returns the open timeout.
479
+ # - {:read_timeout=}[rdoc-ref:Net::HTTP#read_timeout=]:
480
+ # Sets the read timeout.
481
+ # - {:ssl_timeout}[rdoc-ref:Net::HTTP#ssl_timeout]:
482
+ # Returns the ssl timeout.
483
+ # - {:ssl_timeout=}[rdoc-ref:Net::HTTP#ssl_timeout=]:
484
+ # Sets the ssl timeout.
485
+ # - {:write_timeout}[rdoc-ref:Net::HTTP#write_timeout]:
486
+ # Returns the write timeout.
487
+ # - {write_timeout=}[rdoc-ref:Net::HTTP#write_timeout=]:
488
+ # Sets the write timeout.
489
+ #
490
+ # === Requests
491
+ #
492
+ # - {::get}[rdoc-ref:Net::HTTP.get]:
493
+ # Sends a GET request and returns the string response body.
494
+ # - {::get_print}[rdoc-ref:Net::HTTP.get_print]:
495
+ # Sends a GET request and write the string response body to $stdout.
496
+ # - {::get_response}[rdoc-ref:Net::HTTP.get_response]:
497
+ # Sends a GET request and returns a response object.
498
+ # - {::post_form}[rdoc-ref:Net::HTTP.post_form]:
499
+ # Sends a POST request with form data and returns a response object.
500
+ # - {::post}[rdoc-ref:Net::HTTP.post]:
501
+ # Sends a POST request with data and returns a response object.
502
+ # - {::put}[rdoc-ref:Net::HTTP.put]:
503
+ # Sends a PUT request with data and returns a response object.
504
+ # - {#copy}[rdoc-ref:Net::HTTP#copy]:
505
+ # Sends a COPY request and returns a response object.
506
+ # - {#delete}[rdoc-ref:Net::HTTP#delete]:
507
+ # Sends a DELETE request and returns a response object.
508
+ # - {#get}[rdoc-ref:Net::HTTP#get]:
509
+ # Sends a GET request and returns a response object.
510
+ # - {#head}[rdoc-ref:Net::HTTP#head]:
511
+ # Sends a HEAD request and returns a response object.
512
+ # - {#lock}[rdoc-ref:Net::HTTP#lock]:
513
+ # Sends a LOCK request and returns a response object.
514
+ # - {#mkcol}[rdoc-ref:Net::HTTP#mkcol]:
515
+ # Sends a MKCOL request and returns a response object.
516
+ # - {#move}[rdoc-ref:Net::HTTP#move]:
517
+ # Sends a MOVE request and returns a response object.
518
+ # - {#options}[rdoc-ref:Net::HTTP#options]:
519
+ # Sends a OPTIONS request and returns a response object.
520
+ # - {#patch}[rdoc-ref:Net::HTTP#patch]:
521
+ # Sends a PATCH request and returns a response object.
522
+ # - {#post}[rdoc-ref:Net::HTTP#post]:
523
+ # Sends a POST request and returns a response object.
524
+ # - {#propfind}[rdoc-ref:Net::HTTP#propfind]:
525
+ # Sends a PROPFIND request and returns a response object.
526
+ # - {#proppatch}[rdoc-ref:Net::HTTP#proppatch]:
527
+ # Sends a PROPPATCH request and returns a response object.
528
+ # - {#put}[rdoc-ref:Net::HTTP#put]:
529
+ # Sends a PUT request and returns a response object.
530
+ # - {#request}[rdoc-ref:Net::HTTP#request]:
531
+ # Sends a request and returns a response object.
532
+ # - {#request_get}[rdoc-ref:Net::HTTP#request_get]
533
+ # (aliased as {#get2}[rdoc-ref:Net::HTTP#get2]):
534
+ # Sends a GET request and forms a response object;
535
+ # if a block given, calls the block with the object,
536
+ # otherwise returns the object.
537
+ # - {#request_head}[rdoc-ref:Net::HTTP#request_head]
538
+ # (aliased as {#head2}[rdoc-ref:Net::HTTP#head2]):
539
+ # Sends a HEAD request and forms a response object;
540
+ # if a block given, calls the block with the object,
541
+ # otherwise returns the object.
542
+ # - {#request_post}[rdoc-ref:Net::HTTP#request_post]
543
+ # (aliased as {#post2}[rdoc-ref:Net::HTTP#post2]):
544
+ # Sends a POST request and forms a response object;
545
+ # if a block given, calls the block with the object,
546
+ # otherwise returns the object.
547
+ # - {#send_request}[rdoc-ref:Net::HTTP#send_request]:
548
+ # Sends a request and returns a response object.
549
+ # - {#trace}[rdoc-ref:Net::HTTP#trace]:
550
+ # Sends a TRACE request and returns a response object.
551
+ # - {#unlock}[rdoc-ref:Net::HTTP#unlock]:
552
+ # Sends an UNLOCK request and returns a response object.
553
+ #
554
+ # === Responses
555
+ #
556
+ # - {:close_on_empty_response}[rdoc-ref:Net::HTTP#close_on_empty_response]:
557
+ # Returns whether to close connection on empty response.
558
+ # - {:close_on_empty_response=}[rdoc-ref:Net::HTTP#close_on_empty_response=]:
559
+ # Sets whether to close connection on empty response.
560
+ # - {:ignore_eof}[rdoc-ref:Net::HTTP#ignore_eof]:
561
+ # Returns whether to ignore end-of-file when reading a response body
562
+ # with <tt>Content-Length</tt> headers.
563
+ # - {:ignore_eof=}[rdoc-ref:Net::HTTP#ignore_eof=]:
564
+ # Sets whether to ignore end-of-file when reading a response body
565
+ # with <tt>Content-Length</tt> headers.
566
+ # - {:response_body_encoding}[rdoc-ref:Net::HTTP#response_body_encoding]:
567
+ # Returns the encoding to use for the response body.
568
+ # - {#response_body_encoding=}[rdoc-ref:Net::HTTP#response_body_encoding=]:
569
+ # Sets the response body encoding.
570
+ #
571
+ # === Proxies
572
+ #
573
+ # - {:proxy_address}[rdoc-ref:Net::HTTP#proxy_address]:
574
+ # Returns the proxy address.
575
+ # - {:proxy_address=}[rdoc-ref:Net::HTTP#proxy_address=]:
576
+ # Sets the proxy address.
577
+ # - {::proxy_class?}[rdoc-ref:Net::HTTP.proxy_class?]:
578
+ # Returns whether +self+ is a proxy class.
579
+ # - {#proxy?}[rdoc-ref:Net::HTTP#proxy?]:
580
+ # Returns whether +self+ has a proxy.
581
+ # - {#proxy_address}[rdoc-ref:Net::HTTP#proxy_address]
582
+ # (aliased as {#proxyaddr}[rdoc-ref:Net::HTTP#proxyaddr]):
583
+ # Returns the proxy address.
584
+ # - {#proxy_from_env?}[rdoc-ref:Net::HTTP#proxy_from_env?]:
585
+ # Returns whether the proxy is taken from an environment variable.
586
+ # - {:proxy_from_env=}[rdoc-ref:Net::HTTP#proxy_from_env=]:
587
+ # Sets whether the proxy is to be taken from an environment variable.
588
+ # - {:proxy_pass}[rdoc-ref:Net::HTTP#proxy_pass]:
589
+ # Returns the proxy password.
590
+ # - {:proxy_pass=}[rdoc-ref:Net::HTTP#proxy_pass=]:
591
+ # Sets the proxy password.
592
+ # - {:proxy_port}[rdoc-ref:Net::HTTP#proxy_port]:
593
+ # Returns the proxy port.
594
+ # - {:proxy_port=}[rdoc-ref:Net::HTTP#proxy_port=]:
595
+ # Sets the proxy port.
596
+ # - {#proxy_user}[rdoc-ref:Net::HTTP#proxy_user]:
597
+ # Returns the proxy user name.
598
+ # - {:proxy_user=}[rdoc-ref:Net::HTTP#proxy_user=]:
599
+ # Sets the proxy user.
600
+ #
601
+ # === Security
602
+ #
603
+ # - {:ca_file}[rdoc-ref:Net::HTTP#ca_file]:
604
+ # Returns the path to a CA certification file.
605
+ # - {:ca_file=}[rdoc-ref:Net::HTTP#ca_file=]:
606
+ # Sets the path to a CA certification file.
607
+ # - {:ca_path}[rdoc-ref:Net::HTTP#ca_path]:
608
+ # Returns the path of to CA directory containing certification files.
609
+ # - {:ca_path=}[rdoc-ref:Net::HTTP#ca_path=]:
610
+ # Sets the path of to CA directory containing certification files.
611
+ # - {:cert}[rdoc-ref:Net::HTTP#cert]:
612
+ # Returns the OpenSSL::X509::Certificate object to be used for client certification.
613
+ # - {:cert=}[rdoc-ref:Net::HTTP#cert=]:
614
+ # Sets the OpenSSL::X509::Certificate object to be used for client certification.
615
+ # - {:cert_store}[rdoc-ref:Net::HTTP#cert_store]:
616
+ # Returns the X509::Store to be used for verifying peer certificate.
617
+ # - {:cert_store=}[rdoc-ref:Net::HTTP#cert_store=]:
618
+ # Sets the X509::Store to be used for verifying peer certificate.
619
+ # - {:ciphers}[rdoc-ref:Net::HTTP#ciphers]:
620
+ # Returns the available SSL ciphers.
621
+ # - {:ciphers=}[rdoc-ref:Net::HTTP#ciphers=]:
622
+ # Sets the available SSL ciphers.
623
+ # - {:extra_chain_cert}[rdoc-ref:Net::HTTP#extra_chain_cert]:
624
+ # Returns the extra X509 certificates to be added to the certificate chain.
625
+ # - {:extra_chain_cert=}[rdoc-ref:Net::HTTP#extra_chain_cert=]:
626
+ # Sets the extra X509 certificates to be added to the certificate chain.
627
+ # - {:key}[rdoc-ref:Net::HTTP#key]:
628
+ # Returns the OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
629
+ # - {:key=}[rdoc-ref:Net::HTTP#key=]:
630
+ # Sets the OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
631
+ # - {:max_version}[rdoc-ref:Net::HTTP#max_version]:
632
+ # Returns the maximum SSL version.
633
+ # - {:max_version=}[rdoc-ref:Net::HTTP#max_version=]:
634
+ # Sets the maximum SSL version.
635
+ # - {:min_version}[rdoc-ref:Net::HTTP#min_version]:
636
+ # Returns the minimum SSL version.
637
+ # - {:min_version=}[rdoc-ref:Net::HTTP#min_version=]:
638
+ # Sets the minimum SSL version.
639
+ # - {#peer_cert}[rdoc-ref:Net::HTTP#peer_cert]:
640
+ # Returns the X509 certificate chain for the session's socket peer.
641
+ # - {:ssl_version}[rdoc-ref:Net::HTTP#ssl_version]:
642
+ # Returns the SSL version.
643
+ # - {:ssl_version=}[rdoc-ref:Net::HTTP#ssl_version=]:
644
+ # Sets the SSL version.
645
+ # - {#use_ssl=}[rdoc-ref:Net::HTTP#use_ssl=]:
646
+ # Sets whether a new session is to use Transport Layer Security.
647
+ # - {#use_ssl?}[rdoc-ref:Net::HTTP#use_ssl?]:
648
+ # Returns whether +self+ uses SSL.
649
+ # - {:verify_callback}[rdoc-ref:Net::HTTP#verify_callback]:
650
+ # Returns the callback for the server certification verification.
651
+ # - {:verify_callback=}[rdoc-ref:Net::HTTP#verify_callback=]:
652
+ # Sets the callback for the server certification verification.
653
+ # - {:verify_depth}[rdoc-ref:Net::HTTP#verify_depth]:
654
+ # Returns the maximum depth for the certificate chain verification.
655
+ # - {:verify_depth=}[rdoc-ref:Net::HTTP#verify_depth=]:
656
+ # Sets the maximum depth for the certificate chain verification.
657
+ # - {:verify_hostname}[rdoc-ref:Net::HTTP#verify_hostname]:
658
+ # Returns the flags for server the certification verification at the beginning of the SSL/TLS session.
659
+ # - {:verify_hostname=}[rdoc-ref:Net::HTTP#verify_hostname=]:
660
+ # Sets he flags for server the certification verification at the beginning of the SSL/TLS session.
661
+ # - {:verify_mode}[rdoc-ref:Net::HTTP#verify_mode]:
662
+ # Returns the flags for server the certification verification at the beginning of the SSL/TLS session.
663
+ # - {:verify_mode=}[rdoc-ref:Net::HTTP#verify_mode=]:
664
+ # Sets the flags for server the certification verification at the beginning of the SSL/TLS session.
665
+ #
666
+ # === Addresses and Ports
667
+ #
668
+ # - {:address}[rdoc-ref:Net::HTTP#address]:
669
+ # Returns the string host name or host IP.
670
+ # - {::default_port}[rdoc-ref:Net::HTTP.default_port]:
671
+ # Returns integer 80, the default port to use for HTTP requests.
672
+ # - {::http_default_port}[rdoc-ref:Net::HTTP.http_default_port]:
673
+ # Returns integer 80, the default port to use for HTTP requests.
674
+ # - {::https_default_port}[rdoc-ref:Net::HTTP.https_default_port]:
675
+ # Returns integer 443, the default port to use for HTTPS requests.
676
+ # - {#ipaddr}[rdoc-ref:Net::HTTP#ipaddr]:
677
+ # Returns the IP address for the connection.
678
+ # - {#ipaddr=}[rdoc-ref:Net::HTTP#ipaddr=]:
679
+ # Sets the IP address for the connection.
680
+ # - {:local_host}[rdoc-ref:Net::HTTP#local_host]:
681
+ # Returns the string local host used to establish the connection.
682
+ # - {:local_host=}[rdoc-ref:Net::HTTP#local_host=]:
683
+ # Sets the string local host used to establish the connection.
684
+ # - {:local_port}[rdoc-ref:Net::HTTP#local_port]:
685
+ # Returns the integer local port used to establish the connection.
686
+ # - {:local_port=}[rdoc-ref:Net::HTTP#local_port=]:
687
+ # Sets the integer local port used to establish the connection.
688
+ # - {:port}[rdoc-ref:Net::HTTP#port]:
689
+ # Returns the integer port number.
690
+ #
691
+ # === \HTTP Version
692
+ #
693
+ # - {::version_1_2?}[rdoc-ref:Net::HTTP.version_1_2?]
694
+ # (aliased as {::is_version_1_2?}[rdoc-ref:Net::HTTP.is_version_1_2?]
695
+ # and {::version_1_2}[rdoc-ref:Net::HTTP.version_1_2]):
696
+ # Returns true; retained for compatibility.
697
+ #
698
+ # === Debugging
699
+ #
700
+ # - {#set_debug_output}[rdoc-ref:Net::HTTP#set_debug_output]:
701
+ # Sets the output stream for debugging.
702
+ #
703
+ # source://net-http//lib/net/http.rb#730
704
+ class Net::HTTP < ::Net::Protocol
705
+ # Creates a new \Net::HTTP object for the specified server address,
706
+ # without opening the TCP connection or initializing the \HTTP session.
707
+ # The +address+ should be a DNS hostname or IP address.
708
+ #
709
+ # @return [HTTP] a new instance of HTTP
710
+ #
711
+ # source://net-http//lib/net/http.rb#1154
712
+ def initialize(address, port = T.unsafe(nil)); end
713
+
714
+ # Returns +true+ if the \HTTP session has been started:
715
+ #
716
+ # http = Net::HTTP.new(hostname)
717
+ # http.started? # => false
718
+ # http.start
719
+ # http.started? # => true
720
+ # http.finish # => nil
721
+ # http.started? # => false
722
+ #
723
+ # Net::HTTP.start(hostname) do |http|
724
+ # http.started?
725
+ # end # => true
726
+ # http.started? # => false
727
+ #
728
+ # @return [Boolean]
729
+ #
730
+ # source://net-http//lib/net/http.rb#1490
731
+ def active?; end
732
+
733
+ # Returns the string host name or host IP given as argument +address+ in ::new.
734
+ #
735
+ # source://net-http//lib/net/http.rb#1270
736
+ def address; end
737
+
738
+ # Sets or returns the path to a CA certification file in PEM format.
739
+ #
740
+ # source://net-http//lib/net/http.rb#1541
741
+ def ca_file; end
742
+
743
+ # Sets or returns the path to a CA certification file in PEM format.
744
+ #
745
+ # source://net-http//lib/net/http.rb#1541
746
+ def ca_file=(_arg0); end
747
+
748
+ # Sets or returns the path of to CA directory
749
+ # containing certification files in PEM format.
750
+ #
751
+ # source://net-http//lib/net/http.rb#1545
752
+ def ca_path; end
753
+
754
+ # Sets or returns the path of to CA directory
755
+ # containing certification files in PEM format.
756
+ #
757
+ # source://net-http//lib/net/http.rb#1545
758
+ def ca_path=(_arg0); end
759
+
760
+ # Sets or returns the OpenSSL::X509::Certificate object
761
+ # to be used for client certification.
762
+ #
763
+ # source://net-http//lib/net/http.rb#1549
764
+ def cert; end
765
+
766
+ # Sets or returns the OpenSSL::X509::Certificate object
767
+ # to be used for client certification.
768
+ #
769
+ # source://net-http//lib/net/http.rb#1549
770
+ def cert=(_arg0); end
771
+
772
+ # Sets or returns the X509::Store to be used for verifying peer certificate.
773
+ #
774
+ # source://net-http//lib/net/http.rb#1552
775
+ def cert_store; end
776
+
777
+ # Sets or returns the X509::Store to be used for verifying peer certificate.
778
+ #
779
+ # source://net-http//lib/net/http.rb#1552
780
+ def cert_store=(_arg0); end
781
+
782
+ # Sets or returns the available SSL ciphers.
783
+ # See {OpenSSL::SSL::SSLContext#ciphers=}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-ciphers-3D].
784
+ #
785
+ # source://net-http//lib/net/http.rb#1556
786
+ def ciphers; end
787
+
788
+ # Sets or returns the available SSL ciphers.
789
+ # See {OpenSSL::SSL::SSLContext#ciphers=}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-ciphers-3D].
790
+ #
791
+ # source://net-http//lib/net/http.rb#1556
792
+ def ciphers=(_arg0); end
793
+
794
+ # Sets or returns whether to close the connection when the response is empty;
795
+ # initially +false+.
796
+ #
797
+ # source://net-http//lib/net/http.rb#1498
798
+ def close_on_empty_response; end
799
+
800
+ # Sets or returns whether to close the connection when the response is empty;
801
+ # initially +false+.
802
+ #
803
+ # source://net-http//lib/net/http.rb#1498
804
+ def close_on_empty_response=(_arg0); end
805
+
806
+ # Returns the continue timeout value;
807
+ # see continue_timeout=.
808
+ #
809
+ # source://net-http//lib/net/http.rb#1451
810
+ def continue_timeout; end
811
+
812
+ # Sets the continue timeout value,
813
+ # which is the number of seconds to wait for an expected 100 Continue response.
814
+ # If the \HTTP object does not receive a response in this many seconds
815
+ # it sends the request body.
816
+ #
817
+ # source://net-http//lib/net/http.rb#1457
818
+ def continue_timeout=(sec); end
819
+
820
+ # Sends a COPY request to the server;
821
+ # returns an instance of a subclass of Net::HTTPResponse.
822
+ #
823
+ # The request is based on the Net::HTTP::Copy object
824
+ # created from string +path+ and initial headers hash +initheader+.
825
+ #
826
+ # http = Net::HTTP.new(hostname)
827
+ # http.copy('/todos/1')
828
+ #
829
+ # source://net-http//lib/net/http.rb#2201
830
+ def copy(path, initheader = T.unsafe(nil)); end
831
+
832
+ # Sends a DELETE request to the server;
833
+ # returns an instance of a subclass of Net::HTTPResponse.
834
+ #
835
+ # The request is based on the Net::HTTP::Delete object
836
+ # created from string +path+ and initial headers hash +initheader+.
837
+ #
838
+ # http = Net::HTTP.new(hostname)
839
+ # http.delete('/todos/1')
840
+ #
841
+ # source://net-http//lib/net/http.rb#2175
842
+ def delete(path, initheader = T.unsafe(nil)); end
843
+
844
+ # Sets or returns the extra X509 certificates to be added to the certificate chain.
845
+ # See {OpenSSL::SSL::SSLContext#add_certificate}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-add_certificate].
846
+ #
847
+ # source://net-http//lib/net/http.rb#1560
848
+ def extra_chain_cert; end
849
+
850
+ # Sets or returns the extra X509 certificates to be added to the certificate chain.
851
+ # See {OpenSSL::SSL::SSLContext#add_certificate}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-add_certificate].
852
+ #
853
+ # source://net-http//lib/net/http.rb#1560
854
+ def extra_chain_cert=(_arg0); end
855
+
856
+ # Finishes the \HTTP session:
857
+ #
858
+ # http = Net::HTTP.new(hostname)
859
+ # http.start
860
+ # http.started? # => true
861
+ # http.finish # => nil
862
+ # http.started? # => false
863
+ #
864
+ # Raises IOError if not in a session.
865
+ #
866
+ # @raise [IOError]
867
+ #
868
+ # source://net-http//lib/net/http.rb#1776
869
+ def finish; end
870
+
871
+ # :call-seq:
872
+ # get(path, initheader = nil) {|res| ... }
873
+ #
874
+ # Sends a GET request to the server;
875
+ # returns an instance of a subclass of Net::HTTPResponse.
876
+ #
877
+ # The request is based on the Net::HTTP::Get object
878
+ # created from string +path+ and initial headers hash +initheader+.
879
+ #
880
+ # With a block given, calls the block with the response body:
881
+ #
882
+ # http = Net::HTTP.new(hostname)
883
+ # http.get('/todos/1') do |res|
884
+ # p res
885
+ # end # => #<Net::HTTPOK 200 OK readbody=true>
886
+ #
887
+ # Output:
888
+ #
889
+ # "{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false\n}"
890
+ #
891
+ # With no block given, simply returns the response object:
892
+ #
893
+ # http.get('/') # => #<Net::HTTPOK 200 OK readbody=true>
894
+ #
895
+ # Related:
896
+ #
897
+ # - Net::HTTP::Get: request class for \HTTP method GET.
898
+ # - Net::HTTP.get: sends GET request, returns response body.
899
+ #
900
+ # source://net-http//lib/net/http.rb#1987
901
+ def get(path, initheader = T.unsafe(nil), dest = T.unsafe(nil), &block); end
902
+
903
+ # Sends a GET request to the server;
904
+ # forms the response into a Net::HTTPResponse object.
905
+ #
906
+ # The request is based on the Net::HTTP::Get object
907
+ # created from string +path+ and initial headers hash +initheader+.
908
+ #
909
+ # With no block given, returns the response object:
910
+ #
911
+ # http = Net::HTTP.new(hostname)
912
+ # http.request_get('/todos') # => #<Net::HTTPOK 200 OK readbody=true>
913
+ #
914
+ # With a block given, calls the block with the response object
915
+ # and returns the response object:
916
+ #
917
+ # http.request_get('/todos') do |res|
918
+ # p res
919
+ # end # => #<Net::HTTPOK 200 OK readbody=true>
920
+ #
921
+ # Output:
922
+ #
923
+ # #<Net::HTTPOK 200 OK readbody=false>
924
+ #
925
+ # source://net-http//lib/net/http.rb#2254
926
+ def get2(path, initheader = T.unsafe(nil), &block); end
927
+
928
+ # Sends a HEAD request to the server;
929
+ # returns an instance of a subclass of Net::HTTPResponse.
930
+ #
931
+ # The request is based on the Net::HTTP::Head object
932
+ # created from string +path+ and initial headers hash +initheader+:
933
+ #
934
+ # res = http.head('/todos/1') # => #<Net::HTTPOK 200 OK readbody=true>
935
+ # res.body # => nil
936
+ # res.to_hash.take(3)
937
+ # # =>
938
+ # [["date", ["Wed, 15 Feb 2023 15:25:42 GMT"]],
939
+ # ["content-type", ["application/json; charset=utf-8"]],
940
+ # ["connection", ["close"]]]
941
+ #
942
+ # source://net-http//lib/net/http.rb#2011
943
+ def head(path, initheader = T.unsafe(nil)); end
944
+
945
+ # Sends a HEAD request to the server;
946
+ # returns an instance of a subclass of Net::HTTPResponse.
947
+ #
948
+ # The request is based on the Net::HTTP::Head object
949
+ # created from string +path+ and initial headers hash +initheader+.
950
+ #
951
+ # http = Net::HTTP.new(hostname)
952
+ # http.head('/todos/1') # => #<Net::HTTPOK 200 OK readbody=true>
953
+ #
954
+ # source://net-http//lib/net/http.rb#2267
955
+ def head2(path, initheader = T.unsafe(nil), &block); end
956
+
957
+ # Sets or returns whether to ignore end-of-file when reading a response body
958
+ # with <tt>Content-Length</tt> headers;
959
+ # initially +true+.
960
+ #
961
+ # source://net-http//lib/net/http.rb#1474
962
+ def ignore_eof; end
963
+
964
+ # Sets or returns whether to ignore end-of-file when reading a response body
965
+ # with <tt>Content-Length</tt> headers;
966
+ # initially +true+.
967
+ #
968
+ # source://net-http//lib/net/http.rb#1474
969
+ def ignore_eof=(_arg0); end
970
+
971
+ # Returns a string representation of +self+:
972
+ #
973
+ # Net::HTTP.new(hostname).inspect
974
+ # # => "#<Net::HTTP jsonplaceholder.typicode.com:80 open=false>"
975
+ #
976
+ # source://net-http//lib/net/http.rb#1211
977
+ def inspect; end
978
+
979
+ # Returns the IP address for the connection.
980
+ #
981
+ # If the session has not been started,
982
+ # returns the value set by #ipaddr=,
983
+ # or +nil+ if it has not been set:
984
+ #
985
+ # http = Net::HTTP.new(hostname)
986
+ # http.ipaddr # => nil
987
+ # http.ipaddr = '172.67.155.76'
988
+ # http.ipaddr # => "172.67.155.76"
989
+ #
990
+ # If the session has been started,
991
+ # returns the IP address from the socket:
992
+ #
993
+ # http = Net::HTTP.new(hostname)
994
+ # http.start
995
+ # http.ipaddr # => "172.67.155.76"
996
+ # http.finish
997
+ #
998
+ # source://net-http//lib/net/http.rb#1351
999
+ def ipaddr; end
1000
+
1001
+ # Sets the IP address for the connection:
1002
+ #
1003
+ # http = Net::HTTP.new(hostname)
1004
+ # http.ipaddr # => nil
1005
+ # http.ipaddr = '172.67.155.76'
1006
+ # http.ipaddr # => "172.67.155.76"
1007
+ #
1008
+ # The IP address may not be set if the session has been started.
1009
+ #
1010
+ # @raise [IOError]
1011
+ #
1012
+ # source://net-http//lib/net/http.rb#1363
1013
+ def ipaddr=(addr); end
1014
+
1015
+ # Sets or returns the numeric (\Integer or \Float) number of seconds
1016
+ # to keep the connection open after a request is sent;
1017
+ # initially 2.
1018
+ # If a new request is made during the given interval,
1019
+ # the still-open connection is used;
1020
+ # otherwise the connection will have been closed
1021
+ # and a new connection is opened.
1022
+ #
1023
+ # source://net-http//lib/net/http.rb#1469
1024
+ def keep_alive_timeout; end
1025
+
1026
+ # Sets or returns the numeric (\Integer or \Float) number of seconds
1027
+ # to keep the connection open after a request is sent;
1028
+ # initially 2.
1029
+ # If a new request is made during the given interval,
1030
+ # the still-open connection is used;
1031
+ # otherwise the connection will have been closed
1032
+ # and a new connection is opened.
1033
+ #
1034
+ # source://net-http//lib/net/http.rb#1469
1035
+ def keep_alive_timeout=(_arg0); end
1036
+
1037
+ # Sets or returns the OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
1038
+ #
1039
+ # source://net-http//lib/net/http.rb#1563
1040
+ def key; end
1041
+
1042
+ # Sets or returns the OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
1043
+ #
1044
+ # source://net-http//lib/net/http.rb#1563
1045
+ def key=(_arg0); end
1046
+
1047
+ # Sets or returns the string local host used to establish the connection;
1048
+ # initially +nil+.
1049
+ #
1050
+ # source://net-http//lib/net/http.rb#1277
1051
+ def local_host; end
1052
+
1053
+ # Sets or returns the string local host used to establish the connection;
1054
+ # initially +nil+.
1055
+ #
1056
+ # source://net-http//lib/net/http.rb#1277
1057
+ def local_host=(_arg0); end
1058
+
1059
+ # Sets or returns the integer local port used to establish the connection;
1060
+ # initially +nil+.
1061
+ #
1062
+ # source://net-http//lib/net/http.rb#1281
1063
+ def local_port; end
1064
+
1065
+ # Sets or returns the integer local port used to establish the connection;
1066
+ # initially +nil+.
1067
+ #
1068
+ # source://net-http//lib/net/http.rb#1281
1069
+ def local_port=(_arg0); end
1070
+
1071
+ # Sends a LOCK request to the server;
1072
+ # returns an instance of a subclass of Net::HTTPResponse.
1073
+ #
1074
+ # The request is based on the Net::HTTP::Lock object
1075
+ # created from string +path+, string +body+, and initial headers hash +initheader+.
1076
+ #
1077
+ # data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}'
1078
+ # http = Net::HTTP.new(hostname)
1079
+ # http.lock('/todos/1', data)
1080
+ #
1081
+ # source://net-http//lib/net/http.rb#2121
1082
+ def lock(path, body, initheader = T.unsafe(nil)); end
1083
+
1084
+ # Returns the maximum number of times to retry an idempotent request;
1085
+ # see #max_retries=.
1086
+ #
1087
+ # source://net-http//lib/net/http.rb#1407
1088
+ def max_retries; end
1089
+
1090
+ # Sets the maximum number of times to retry an idempotent request in case of
1091
+ # \Net::ReadTimeout, IOError, EOFError, Errno::ECONNRESET,
1092
+ # Errno::ECONNABORTED, Errno::EPIPE, OpenSSL::SSL::SSLError,
1093
+ # Timeout::Error.
1094
+ # The initial value is 1.
1095
+ #
1096
+ # Argument +retries+ must be a non-negative numeric value:
1097
+ #
1098
+ # http = Net::HTTP.new(hostname)
1099
+ # http.max_retries = 2 # => 2
1100
+ # http.max_retries # => 2
1101
+ #
1102
+ # source://net-http//lib/net/http.rb#1397
1103
+ def max_retries=(retries); end
1104
+
1105
+ # Sets or returns the maximum SSL version.
1106
+ # See {OpenSSL::SSL::SSLContext#max_version=}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-max_version-3D].
1107
+ #
1108
+ # source://net-http//lib/net/http.rb#1578
1109
+ def max_version; end
1110
+
1111
+ # Sets or returns the maximum SSL version.
1112
+ # See {OpenSSL::SSL::SSLContext#max_version=}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-max_version-3D].
1113
+ #
1114
+ # source://net-http//lib/net/http.rb#1578
1115
+ def max_version=(_arg0); end
1116
+
1117
+ # Sets or returns the minimum SSL version.
1118
+ # See {OpenSSL::SSL::SSLContext#min_version=}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-min_version-3D].
1119
+ #
1120
+ # source://net-http//lib/net/http.rb#1574
1121
+ def min_version; end
1122
+
1123
+ # Sets or returns the minimum SSL version.
1124
+ # See {OpenSSL::SSL::SSLContext#min_version=}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-min_version-3D].
1125
+ #
1126
+ # source://net-http//lib/net/http.rb#1574
1127
+ def min_version=(_arg0); end
1128
+
1129
+ # Sends a MKCOL request to the server;
1130
+ # returns an instance of a subclass of Net::HTTPResponse.
1131
+ #
1132
+ # The request is based on the Net::HTTP::Mkcol object
1133
+ # created from string +path+, string +body+, and initial headers hash +initheader+.
1134
+ #
1135
+ # data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}'
1136
+ # http.mkcol('/todos/1', data)
1137
+ # http = Net::HTTP.new(hostname)
1138
+ #
1139
+ # source://net-http//lib/net/http.rb#2215
1140
+ def mkcol(path, body = T.unsafe(nil), initheader = T.unsafe(nil)); end
1141
+
1142
+ # Sends a MOVE request to the server;
1143
+ # returns an instance of a subclass of Net::HTTPResponse.
1144
+ #
1145
+ # The request is based on the Net::HTTP::Move object
1146
+ # created from string +path+ and initial headers hash +initheader+.
1147
+ #
1148
+ # http = Net::HTTP.new(hostname)
1149
+ # http.move('/todos/1')
1150
+ #
1151
+ # source://net-http//lib/net/http.rb#2188
1152
+ def move(path, initheader = T.unsafe(nil)); end
1153
+
1154
+ # Sets or returns the numeric (\Integer or \Float) number of seconds
1155
+ # to wait for a connection to open;
1156
+ # initially 60.
1157
+ # If the connection is not made in the given interval,
1158
+ # an exception is raised.
1159
+ #
1160
+ # source://net-http//lib/net/http.rb#1373
1161
+ def open_timeout; end
1162
+
1163
+ # Sets or returns the numeric (\Integer or \Float) number of seconds
1164
+ # to wait for a connection to open;
1165
+ # initially 60.
1166
+ # If the connection is not made in the given interval,
1167
+ # an exception is raised.
1168
+ #
1169
+ # source://net-http//lib/net/http.rb#1373
1170
+ def open_timeout=(_arg0); end
1171
+
1172
+ # Sends an Options request to the server;
1173
+ # returns an instance of a subclass of Net::HTTPResponse.
1174
+ #
1175
+ # The request is based on the Net::HTTP::Options object
1176
+ # created from string +path+ and initial headers hash +initheader+.
1177
+ #
1178
+ # http = Net::HTTP.new(hostname)
1179
+ # http.options('/')
1180
+ #
1181
+ # source://net-http//lib/net/http.rb#2148
1182
+ def options(path, initheader = T.unsafe(nil)); end
1183
+
1184
+ # :call-seq:
1185
+ # patch(path, data, initheader = nil) {|res| ... }
1186
+ #
1187
+ # Sends a PATCH request to the server;
1188
+ # returns an instance of a subclass of Net::HTTPResponse.
1189
+ #
1190
+ # The request is based on the Net::HTTP::Patch object
1191
+ # created from string +path+, string +data+, and initial headers hash +initheader+.
1192
+ #
1193
+ # With a block given, calls the block with the response body:
1194
+ #
1195
+ # data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}'
1196
+ # http = Net::HTTP.new(hostname)
1197
+ # http.patch('/todos/1', data) do |res|
1198
+ # p res
1199
+ # end # => #<Net::HTTPOK 200 OK readbody=true>
1200
+ #
1201
+ # Output:
1202
+ #
1203
+ # "{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false,\n \"{\\\"userId\\\": 1, \\\"id\\\": 1, \\\"title\\\": \\\"delectus aut autem\\\", \\\"completed\\\": false}\": \"\"\n}"
1204
+ #
1205
+ # With no block given, simply returns the response object:
1206
+ #
1207
+ # http.patch('/todos/1', data) # => #<Net::HTTPCreated 201 Created readbody=true>
1208
+ #
1209
+ # source://net-http//lib/net/http.rb#2074
1210
+ def patch(path, data, initheader = T.unsafe(nil), dest = T.unsafe(nil), &block); end
1211
+
1212
+ # Returns the X509 certificate chain (an array of strings)
1213
+ # for the session's socket peer,
1214
+ # or +nil+ if none.
1215
+ #
1216
+ # source://net-http//lib/net/http.rb#1599
1217
+ def peer_cert; end
1218
+
1219
+ # Returns the integer port number given as argument +port+ in ::new.
1220
+ #
1221
+ # source://net-http//lib/net/http.rb#1273
1222
+ def port; end
1223
+
1224
+ # :call-seq:
1225
+ # post(path, data, initheader = nil) {|res| ... }
1226
+ #
1227
+ # Sends a POST request to the server;
1228
+ # returns an instance of a subclass of Net::HTTPResponse.
1229
+ #
1230
+ # The request is based on the Net::HTTP::Post object
1231
+ # created from string +path+, string +data+, and initial headers hash +initheader+.
1232
+ #
1233
+ # With a block given, calls the block with the response body:
1234
+ #
1235
+ # data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}'
1236
+ # http = Net::HTTP.new(hostname)
1237
+ # http.post('/todos', data) do |res|
1238
+ # p res
1239
+ # end # => #<Net::HTTPCreated 201 Created readbody=true>
1240
+ #
1241
+ # Output:
1242
+ #
1243
+ # "{\n \"{\\\"userId\\\": 1, \\\"id\\\": 1, \\\"title\\\": \\\"delectus aut autem\\\", \\\"completed\\\": false}\": \"\",\n \"id\": 201\n}"
1244
+ #
1245
+ # With no block given, simply returns the response object:
1246
+ #
1247
+ # http.post('/todos', data) # => #<Net::HTTPCreated 201 Created readbody=true>
1248
+ #
1249
+ # Related:
1250
+ #
1251
+ # - Net::HTTP::Post: request class for \HTTP method POST.
1252
+ # - Net::HTTP.post: sends POST request, returns response body.
1253
+ #
1254
+ # source://net-http//lib/net/http.rb#2045
1255
+ def post(path, data, initheader = T.unsafe(nil), dest = T.unsafe(nil), &block); end
1256
+
1257
+ # Sends a POST request to the server;
1258
+ # forms the response into a Net::HTTPResponse object.
1259
+ #
1260
+ # The request is based on the Net::HTTP::Post object
1261
+ # created from string +path+, string +data+, and initial headers hash +initheader+.
1262
+ #
1263
+ # With no block given, returns the response object:
1264
+ #
1265
+ # http = Net::HTTP.new(hostname)
1266
+ # http.post('/todos', 'xyzzy')
1267
+ # # => #<Net::HTTPCreated 201 Created readbody=true>
1268
+ #
1269
+ # With a block given, calls the block with the response body
1270
+ # and returns the response object:
1271
+ #
1272
+ # http.post('/todos', 'xyzzy') do |res|
1273
+ # p res
1274
+ # end # => #<Net::HTTPCreated 201 Created readbody=true>
1275
+ #
1276
+ # Output:
1277
+ #
1278
+ # "{\n \"xyzzy\": \"\",\n \"id\": 201\n}"
1279
+ #
1280
+ # source://net-http//lib/net/http.rb#2294
1281
+ def post2(path, data, initheader = T.unsafe(nil), &block); end
1282
+
1283
+ # Sends a PROPFIND request to the server;
1284
+ # returns an instance of a subclass of Net::HTTPResponse.
1285
+ #
1286
+ # The request is based on the Net::HTTP::Propfind object
1287
+ # created from string +path+, string +body+, and initial headers hash +initheader+.
1288
+ #
1289
+ # data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}'
1290
+ # http = Net::HTTP.new(hostname)
1291
+ # http.propfind('/todos/1', data)
1292
+ #
1293
+ # source://net-http//lib/net/http.rb#2162
1294
+ def propfind(path, body = T.unsafe(nil), initheader = T.unsafe(nil)); end
1295
+
1296
+ # Sends a PROPPATCH request to the server;
1297
+ # returns an instance of a subclass of Net::HTTPResponse.
1298
+ #
1299
+ # The request is based on the Net::HTTP::Proppatch object
1300
+ # created from string +path+, string +body+, and initial headers hash +initheader+.
1301
+ #
1302
+ # data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}'
1303
+ # http = Net::HTTP.new(hostname)
1304
+ # http.proppatch('/todos/1', data)
1305
+ #
1306
+ # source://net-http//lib/net/http.rb#2107
1307
+ def proppatch(path, body, initheader = T.unsafe(nil)); end
1308
+
1309
+ # Returns +true+ if a proxy server is defined, +false+ otherwise;
1310
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1311
+ #
1312
+ # @return [Boolean]
1313
+ #
1314
+ # source://net-http//lib/net/http.rb#1858
1315
+ def proxy?; end
1316
+
1317
+ # Returns the address of the proxy server, if defined, +nil+ otherwise;
1318
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1319
+ #
1320
+ # source://net-http//lib/net/http.rb#1880
1321
+ def proxy_address; end
1322
+
1323
+ # Sets the proxy address;
1324
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1325
+ #
1326
+ # source://net-http//lib/net/http.rb#1317
1327
+ def proxy_address=(_arg0); end
1328
+
1329
+ # Sets whether to determine the proxy from environment variable
1330
+ # '<tt>ENV['http_proxy']</tt>';
1331
+ # see {Proxy Using ENV['http_proxy']}[rdoc-ref:Net::HTTP@Proxy+Using+-27ENV-5B-27http_proxy-27-5D-27].
1332
+ #
1333
+ # source://net-http//lib/net/http.rb#1313
1334
+ def proxy_from_env=(_arg0); end
1335
+
1336
+ # Returns +true+ if the proxy server is defined in the environment,
1337
+ # +false+ otherwise;
1338
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1339
+ #
1340
+ # @return [Boolean]
1341
+ #
1342
+ # source://net-http//lib/net/http.rb#1865
1343
+ def proxy_from_env?; end
1344
+
1345
+ # Returns the password of the proxy server, if defined, +nil+ otherwise;
1346
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1347
+ #
1348
+ # source://net-http//lib/net/http.rb#1911
1349
+ def proxy_pass; end
1350
+
1351
+ # Sets the proxy password;
1352
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1353
+ #
1354
+ # source://net-http//lib/net/http.rb#1329
1355
+ def proxy_pass=(_arg0); end
1356
+
1357
+ # Returns the port number of the proxy server, if defined, +nil+ otherwise;
1358
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1359
+ #
1360
+ # source://net-http//lib/net/http.rb#1890
1361
+ def proxy_port; end
1362
+
1363
+ # Sets the proxy port;
1364
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1365
+ #
1366
+ # source://net-http//lib/net/http.rb#1321
1367
+ def proxy_port=(_arg0); end
1368
+
1369
+ # The proxy URI determined from the environment for this connection.
1370
+ #
1371
+ # source://net-http//lib/net/http.rb#1870
1372
+ def proxy_uri; end
1373
+
1374
+ # Sets the attribute proxy_use_ssl
1375
+ #
1376
+ # @param value the value to set the attribute proxy_use_ssl to.
1377
+ #
1378
+ # source://net-http//lib/net/http.rb#1330
1379
+ def proxy_use_ssl=(_arg0); end
1380
+
1381
+ # Returns the user name of the proxy server, if defined, +nil+ otherwise;
1382
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1383
+ #
1384
+ # source://net-http//lib/net/http.rb#1900
1385
+ def proxy_user; end
1386
+
1387
+ # Sets the proxy user;
1388
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1389
+ #
1390
+ # source://net-http//lib/net/http.rb#1325
1391
+ def proxy_user=(_arg0); end
1392
+
1393
+ # Returns the address of the proxy server, if defined, +nil+ otherwise;
1394
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1395
+ #
1396
+ # source://net-http//lib/net/http.rb#1880
1397
+ def proxyaddr; end
1398
+
1399
+ # Returns the port number of the proxy server, if defined, +nil+ otherwise;
1400
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
1401
+ #
1402
+ # source://net-http//lib/net/http.rb#1890
1403
+ def proxyport; end
1404
+
1405
+ # Sends a PUT request to the server;
1406
+ # returns an instance of a subclass of Net::HTTPResponse.
1407
+ #
1408
+ # The request is based on the Net::HTTP::Put object
1409
+ # created from string +path+, string +data+, and initial headers hash +initheader+.
1410
+ #
1411
+ # data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}'
1412
+ # http = Net::HTTP.new(hostname)
1413
+ # http.put('/todos/1', data) # => #<Net::HTTPOK 200 OK readbody=true>
1414
+ #
1415
+ # Related:
1416
+ #
1417
+ # - Net::HTTP::Put: request class for \HTTP method PUT.
1418
+ # - Net::HTTP.put: sends PUT request, returns response body.
1419
+ #
1420
+ # source://net-http//lib/net/http.rb#2093
1421
+ def put(path, data, initheader = T.unsafe(nil)); end
1422
+
1423
+ # Sends a PUT request to the server;
1424
+ # returns an instance of a subclass of Net::HTTPResponse.
1425
+ #
1426
+ # The request is based on the Net::HTTP::Put object
1427
+ # created from string +path+, string +data+, and initial headers hash +initheader+.
1428
+ #
1429
+ # http = Net::HTTP.new(hostname)
1430
+ # http.put('/todos/1', 'xyzzy')
1431
+ # # => #<Net::HTTPOK 200 OK readbody=true>
1432
+ #
1433
+ # source://net-http//lib/net/http.rb#2308
1434
+ def put2(path, data, initheader = T.unsafe(nil), &block); end
1435
+
1436
+ # Returns the numeric (\Integer or \Float) number of seconds
1437
+ # to wait for one block to be read (via one read(2) call);
1438
+ # see #read_timeout=.
1439
+ #
1440
+ # source://net-http//lib/net/http.rb#1378
1441
+ def read_timeout; end
1442
+
1443
+ # Sets the read timeout, in seconds, for +self+ to integer +sec+;
1444
+ # the initial value is 60.
1445
+ #
1446
+ # Argument +sec+ must be a non-negative numeric value:
1447
+ #
1448
+ # http = Net::HTTP.new(hostname)
1449
+ # http.read_timeout # => 60
1450
+ # http.get('/todos/1') # => #<Net::HTTPOK 200 OK readbody=true>
1451
+ # http.read_timeout = 0
1452
+ # http.get('/todos/1') # Raises Net::ReadTimeout.
1453
+ #
1454
+ # source://net-http//lib/net/http.rb#1420
1455
+ def read_timeout=(sec); end
1456
+
1457
+ # Sends the given request +req+ to the server;
1458
+ # forms the response into a Net::HTTPResponse object.
1459
+ #
1460
+ # The given +req+ must be an instance of a
1461
+ # {subclass of Net::HTTPRequest}[rdoc-ref:Net::HTTPRequest@Request+Subclasses].
1462
+ # Argument +body+ should be given only if needed for the request.
1463
+ #
1464
+ # With no block given, returns the response object:
1465
+ #
1466
+ # http = Net::HTTP.new(hostname)
1467
+ #
1468
+ # req = Net::HTTP::Get.new('/todos/1')
1469
+ # http.request(req)
1470
+ # # => #<Net::HTTPOK 200 OK readbody=true>
1471
+ #
1472
+ # req = Net::HTTP::Post.new('/todos')
1473
+ # http.request(req, 'xyzzy')
1474
+ # # => #<Net::HTTPCreated 201 Created readbody=true>
1475
+ #
1476
+ # With a block given, calls the block with the response and returns the response:
1477
+ #
1478
+ # req = Net::HTTP::Get.new('/todos/1')
1479
+ # http.request(req) do |res|
1480
+ # p res
1481
+ # end # => #<Net::HTTPOK 200 OK readbody=true>
1482
+ #
1483
+ # Output:
1484
+ #
1485
+ # #<Net::HTTPOK 200 OK readbody=false>
1486
+ #
1487
+ # source://net-http//lib/net/http.rb#2373
1488
+ def request(req, body = T.unsafe(nil), &block); end
1489
+
1490
+ # Sends a GET request to the server;
1491
+ # forms the response into a Net::HTTPResponse object.
1492
+ #
1493
+ # The request is based on the Net::HTTP::Get object
1494
+ # created from string +path+ and initial headers hash +initheader+.
1495
+ #
1496
+ # With no block given, returns the response object:
1497
+ #
1498
+ # http = Net::HTTP.new(hostname)
1499
+ # http.request_get('/todos') # => #<Net::HTTPOK 200 OK readbody=true>
1500
+ #
1501
+ # With a block given, calls the block with the response object
1502
+ # and returns the response object:
1503
+ #
1504
+ # http.request_get('/todos') do |res|
1505
+ # p res
1506
+ # end # => #<Net::HTTPOK 200 OK readbody=true>
1507
+ #
1508
+ # Output:
1509
+ #
1510
+ # #<Net::HTTPOK 200 OK readbody=false>
1511
+ #
1512
+ # source://net-http//lib/net/http.rb#2254
1513
+ def request_get(path, initheader = T.unsafe(nil), &block); end
1514
+
1515
+ # Sends a HEAD request to the server;
1516
+ # returns an instance of a subclass of Net::HTTPResponse.
1517
+ #
1518
+ # The request is based on the Net::HTTP::Head object
1519
+ # created from string +path+ and initial headers hash +initheader+.
1520
+ #
1521
+ # http = Net::HTTP.new(hostname)
1522
+ # http.head('/todos/1') # => #<Net::HTTPOK 200 OK readbody=true>
1523
+ #
1524
+ # source://net-http//lib/net/http.rb#2267
1525
+ def request_head(path, initheader = T.unsafe(nil), &block); end
1526
+
1527
+ # Sends a POST request to the server;
1528
+ # forms the response into a Net::HTTPResponse object.
1529
+ #
1530
+ # The request is based on the Net::HTTP::Post object
1531
+ # created from string +path+, string +data+, and initial headers hash +initheader+.
1532
+ #
1533
+ # With no block given, returns the response object:
1534
+ #
1535
+ # http = Net::HTTP.new(hostname)
1536
+ # http.post('/todos', 'xyzzy')
1537
+ # # => #<Net::HTTPCreated 201 Created readbody=true>
1538
+ #
1539
+ # With a block given, calls the block with the response body
1540
+ # and returns the response object:
1541
+ #
1542
+ # http.post('/todos', 'xyzzy') do |res|
1543
+ # p res
1544
+ # end # => #<Net::HTTPCreated 201 Created readbody=true>
1545
+ #
1546
+ # Output:
1547
+ #
1548
+ # "{\n \"xyzzy\": \"\",\n \"id\": 201\n}"
1549
+ #
1550
+ # source://net-http//lib/net/http.rb#2294
1551
+ def request_post(path, data, initheader = T.unsafe(nil), &block); end
1552
+
1553
+ # Sends a PUT request to the server;
1554
+ # returns an instance of a subclass of Net::HTTPResponse.
1555
+ #
1556
+ # The request is based on the Net::HTTP::Put object
1557
+ # created from string +path+, string +data+, and initial headers hash +initheader+.
1558
+ #
1559
+ # http = Net::HTTP.new(hostname)
1560
+ # http.put('/todos/1', 'xyzzy')
1561
+ # # => #<Net::HTTPOK 200 OK readbody=true>
1562
+ #
1563
+ # source://net-http//lib/net/http.rb#2308
1564
+ def request_put(path, data, initheader = T.unsafe(nil), &block); end
1565
+
1566
+ # Returns the encoding to use for the response body;
1567
+ # see #response_body_encoding=.
1568
+ #
1569
+ # source://net-http//lib/net/http.rb#1285
1570
+ def response_body_encoding; end
1571
+
1572
+ # Sets the encoding to be used for the response body;
1573
+ # returns the encoding.
1574
+ #
1575
+ # The given +value+ may be:
1576
+ #
1577
+ # - An Encoding object.
1578
+ # - The name of an encoding.
1579
+ # - An alias for an encoding name.
1580
+ #
1581
+ # See {Encoding}[https://docs.ruby-lang.org/en/master/Encoding.html].
1582
+ #
1583
+ # Examples:
1584
+ #
1585
+ # http = Net::HTTP.new(hostname)
1586
+ # http.response_body_encoding = Encoding::US_ASCII # => #<Encoding:US-ASCII>
1587
+ # http.response_body_encoding = 'US-ASCII' # => "US-ASCII"
1588
+ # http.response_body_encoding = 'ASCII' # => "ASCII"
1589
+ #
1590
+ # source://net-http//lib/net/http.rb#1305
1591
+ def response_body_encoding=(value); end
1592
+
1593
+ # Sends an \HTTP request to the server;
1594
+ # returns an instance of a subclass of Net::HTTPResponse.
1595
+ #
1596
+ # The request is based on the Net::HTTPRequest object
1597
+ # created from string +path+, string +data+, and initial headers hash +header+.
1598
+ # That object is an instance of the
1599
+ # {subclass of Net::HTTPRequest}[rdoc-ref:Net::HTTPRequest@Request+Subclasses],
1600
+ # that corresponds to the given uppercase string +name+,
1601
+ # which must be
1602
+ # an {HTTP request method}[https://en.wikipedia.org/wiki/HTTP#Request_methods]
1603
+ # or a {WebDAV request method}[https://en.wikipedia.org/wiki/WebDAV#Implementation].
1604
+ #
1605
+ # Examples:
1606
+ #
1607
+ # http = Net::HTTP.new(hostname)
1608
+ # http.send_request('GET', '/todos/1')
1609
+ # # => #<Net::HTTPOK 200 OK readbody=true>
1610
+ # http.send_request('POST', '/todos', 'xyzzy')
1611
+ # # => #<Net::HTTPCreated 201 Created readbody=true>
1612
+ #
1613
+ # source://net-http//lib/net/http.rb#2337
1614
+ def send_request(name, path, data = T.unsafe(nil), header = T.unsafe(nil)); end
1615
+
1616
+ # *WARNING* This method opens a serious security hole.
1617
+ # Never use this method in production code.
1618
+ #
1619
+ # Sets the output stream for debugging:
1620
+ #
1621
+ # http = Net::HTTP.new(hostname)
1622
+ # File.open('t.tmp', 'w') do |file|
1623
+ # http.set_debug_output(file)
1624
+ # http.start
1625
+ # http.get('/nosuch/1')
1626
+ # http.finish
1627
+ # end
1628
+ # puts File.read('t.tmp')
1629
+ #
1630
+ # Output:
1631
+ #
1632
+ # opening connection to jsonplaceholder.typicode.com:80...
1633
+ # opened
1634
+ # <- "GET /nosuch/1 HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: Ruby\r\nHost: jsonplaceholder.typicode.com\r\n\r\n"
1635
+ # -> "HTTP/1.1 404 Not Found\r\n"
1636
+ # -> "Date: Mon, 12 Dec 2022 21:14:11 GMT\r\n"
1637
+ # -> "Content-Type: application/json; charset=utf-8\r\n"
1638
+ # -> "Content-Length: 2\r\n"
1639
+ # -> "Connection: keep-alive\r\n"
1640
+ # -> "X-Powered-By: Express\r\n"
1641
+ # -> "X-Ratelimit-Limit: 1000\r\n"
1642
+ # -> "X-Ratelimit-Remaining: 999\r\n"
1643
+ # -> "X-Ratelimit-Reset: 1670879660\r\n"
1644
+ # -> "Vary: Origin, Accept-Encoding\r\n"
1645
+ # -> "Access-Control-Allow-Credentials: true\r\n"
1646
+ # -> "Cache-Control: max-age=43200\r\n"
1647
+ # -> "Pragma: no-cache\r\n"
1648
+ # -> "Expires: -1\r\n"
1649
+ # -> "X-Content-Type-Options: nosniff\r\n"
1650
+ # -> "Etag: W/\"2-vyGp6PvFo4RvsFtPoIWeCReyIC8\"\r\n"
1651
+ # -> "Via: 1.1 vegur\r\n"
1652
+ # -> "CF-Cache-Status: MISS\r\n"
1653
+ # -> "Server-Timing: cf-q-config;dur=1.3000000762986e-05\r\n"
1654
+ # -> "Report-To: {\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=yOr40jo%2BwS1KHzhTlVpl54beJ5Wx2FcG4gGV0XVrh3X9OlR5q4drUn2dkt5DGO4GDcE%2BVXT7CNgJvGs%2BZleIyMu8CLieFiDIvOviOY3EhHg94m0ZNZgrEdpKD0S85S507l1vsEwEHkoTm%2Ff19SiO\"}],\"group\":\"cf-nel\",\"max_age\":604800}\r\n"
1655
+ # -> "NEL: {\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}\r\n"
1656
+ # -> "Server: cloudflare\r\n"
1657
+ # -> "CF-RAY: 778977dc484ce591-DFW\r\n"
1658
+ # -> "alt-svc: h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400\r\n"
1659
+ # -> "\r\n"
1660
+ # reading 2 bytes...
1661
+ # -> "{}"
1662
+ # read 2 bytes
1663
+ # Conn keep-alive
1664
+ #
1665
+ # source://net-http//lib/net/http.rb#1264
1666
+ def set_debug_output(output); end
1667
+
1668
+ # Sets or returns the SSL timeout seconds.
1669
+ #
1670
+ # source://net-http//lib/net/http.rb#1566
1671
+ def ssl_timeout; end
1672
+
1673
+ # Sets or returns the SSL timeout seconds.
1674
+ #
1675
+ # source://net-http//lib/net/http.rb#1566
1676
+ def ssl_timeout=(_arg0); end
1677
+
1678
+ # Sets or returns the SSL version.
1679
+ # See {OpenSSL::SSL::SSLContext#ssl_version=}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-ssl_version-3D].
1680
+ #
1681
+ # source://net-http//lib/net/http.rb#1570
1682
+ def ssl_version; end
1683
+
1684
+ # Sets or returns the SSL version.
1685
+ # See {OpenSSL::SSL::SSLContext#ssl_version=}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-ssl_version-3D].
1686
+ #
1687
+ # source://net-http//lib/net/http.rb#1570
1688
+ def ssl_version=(_arg0); end
1689
+
1690
+ # Starts an \HTTP session.
1691
+ #
1692
+ # Without a block, returns +self+:
1693
+ #
1694
+ # http = Net::HTTP.new(hostname)
1695
+ # # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false>
1696
+ # http.start
1697
+ # # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=true>
1698
+ # http.started? # => true
1699
+ # http.finish
1700
+ #
1701
+ # With a block, calls the block with +self+,
1702
+ # finishes the session when the block exits,
1703
+ # and returns the block's value:
1704
+ #
1705
+ # http.start do |http|
1706
+ # http
1707
+ # end
1708
+ # # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false>
1709
+ # http.started? # => false
1710
+ #
1711
+ # @raise [IOError]
1712
+ #
1713
+ # source://net-http//lib/net/http.rb#1627
1714
+ def start; end
1715
+
1716
+ # Returns +true+ if the \HTTP session has been started:
1717
+ #
1718
+ # http = Net::HTTP.new(hostname)
1719
+ # http.started? # => false
1720
+ # http.start
1721
+ # http.started? # => true
1722
+ # http.finish # => nil
1723
+ # http.started? # => false
1724
+ #
1725
+ # Net::HTTP.start(hostname) do |http|
1726
+ # http.started?
1727
+ # end # => true
1728
+ # http.started? # => false
1729
+ #
1730
+ # @return [Boolean]
1731
+ #
1732
+ # source://net-http//lib/net/http.rb#1490
1733
+ def started?; end
1734
+
1735
+ # Sends a TRACE request to the server;
1736
+ # returns an instance of a subclass of Net::HTTPResponse.
1737
+ #
1738
+ # The request is based on the Net::HTTP::Trace object
1739
+ # created from string +path+ and initial headers hash +initheader+.
1740
+ #
1741
+ # http = Net::HTTP.new(hostname)
1742
+ # http.trace('/todos/1')
1743
+ #
1744
+ # source://net-http//lib/net/http.rb#2228
1745
+ def trace(path, initheader = T.unsafe(nil)); end
1746
+
1747
+ # Sends an UNLOCK request to the server;
1748
+ # returns an instance of a subclass of Net::HTTPResponse.
1749
+ #
1750
+ # The request is based on the Net::HTTP::Unlock object
1751
+ # created from string +path+, string +body+, and initial headers hash +initheader+.
1752
+ #
1753
+ # data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}'
1754
+ # http = Net::HTTP.new(hostname)
1755
+ # http.unlock('/todos/1', data)
1756
+ #
1757
+ # source://net-http//lib/net/http.rb#2135
1758
+ def unlock(path, body, initheader = T.unsafe(nil)); end
1759
+
1760
+ # Sets whether a new session is to use
1761
+ # {Transport Layer Security}[https://en.wikipedia.org/wiki/Transport_Layer_Security]:
1762
+ #
1763
+ # Raises IOError if attempting to change during a session.
1764
+ #
1765
+ # Raises OpenSSL::SSL::SSLError if the port is not an HTTPS port.
1766
+ #
1767
+ # source://net-http//lib/net/http.rb#1512
1768
+ def use_ssl=(flag); end
1769
+
1770
+ # Returns +true+ if +self+ uses SSL, +false+ otherwise.
1771
+ # See Net::HTTP#use_ssl=.
1772
+ #
1773
+ # @return [Boolean]
1774
+ #
1775
+ # source://net-http//lib/net/http.rb#1502
1776
+ def use_ssl?; end
1777
+
1778
+ # Sets or returns the callback for the server certification verification.
1779
+ #
1780
+ # source://net-http//lib/net/http.rb#1581
1781
+ def verify_callback; end
1782
+
1783
+ # Sets or returns the callback for the server certification verification.
1784
+ #
1785
+ # source://net-http//lib/net/http.rb#1581
1786
+ def verify_callback=(_arg0); end
1787
+
1788
+ # Sets or returns the maximum depth for the certificate chain verification.
1789
+ #
1790
+ # source://net-http//lib/net/http.rb#1584
1791
+ def verify_depth; end
1792
+
1793
+ # Sets or returns the maximum depth for the certificate chain verification.
1794
+ #
1795
+ # source://net-http//lib/net/http.rb#1584
1796
+ def verify_depth=(_arg0); end
1797
+
1798
+ # Sets or returns whether to verify that the server certificate is valid
1799
+ # for the hostname.
1800
+ # See {OpenSSL::SSL::SSLContext#verify_hostname=}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#attribute-i-verify_mode].
1801
+ #
1802
+ # source://net-http//lib/net/http.rb#1594
1803
+ def verify_hostname; end
1804
+
1805
+ # Sets or returns whether to verify that the server certificate is valid
1806
+ # for the hostname.
1807
+ # See {OpenSSL::SSL::SSLContext#verify_hostname=}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#attribute-i-verify_mode].
1808
+ #
1809
+ # source://net-http//lib/net/http.rb#1594
1810
+ def verify_hostname=(_arg0); end
1811
+
1812
+ # Sets or returns the flags for server the certification verification
1813
+ # at the beginning of the SSL/TLS session.
1814
+ # OpenSSL::SSL::VERIFY_NONE or OpenSSL::SSL::VERIFY_PEER are acceptable.
1815
+ #
1816
+ # source://net-http//lib/net/http.rb#1589
1817
+ def verify_mode; end
1818
+
1819
+ # Sets or returns the flags for server the certification verification
1820
+ # at the beginning of the SSL/TLS session.
1821
+ # OpenSSL::SSL::VERIFY_NONE or OpenSSL::SSL::VERIFY_PEER are acceptable.
1822
+ #
1823
+ # source://net-http//lib/net/http.rb#1589
1824
+ def verify_mode=(_arg0); end
1825
+
1826
+ # Returns the numeric (\Integer or \Float) number of seconds
1827
+ # to wait for one block to be written (via one write(2) call);
1828
+ # see #write_timeout=.
1829
+ #
1830
+ # source://net-http//lib/net/http.rb#1383
1831
+ def write_timeout; end
1832
+
1833
+ # Sets the write timeout, in seconds, for +self+ to integer +sec+;
1834
+ # the initial value is 60.
1835
+ #
1836
+ # Argument +sec+ must be a non-negative numeric value:
1837
+ #
1838
+ # _uri = uri.dup
1839
+ # _uri.path = '/posts'
1840
+ # body = 'bar' * 200000
1841
+ # data = <<EOF
1842
+ # {"title": "foo", "body": "#{body}", "userId": "1"}
1843
+ # EOF
1844
+ # headers = {'content-type': 'application/json'}
1845
+ # http = Net::HTTP.new(hostname)
1846
+ # http.write_timeout # => 60
1847
+ # http.post(_uri.path, data, headers)
1848
+ # # => #<Net::HTTPCreated 201 Created readbody=true>
1849
+ # http.write_timeout = 0
1850
+ # http.post(_uri.path, data, headers) # Raises Net::WriteTimeout.
1851
+ #
1852
+ # source://net-http//lib/net/http.rb#1444
1853
+ def write_timeout=(sec); end
1854
+
1855
+ private
1856
+
1857
+ # Adds a message to debugging output
1858
+ #
1859
+ # source://net-http//lib/net/http.rb#2553
1860
+ def D(msg); end
1861
+
1862
+ # source://net-http//lib/net/http.rb#2545
1863
+ def addr_port; end
1864
+
1865
+ # source://net-http//lib/net/http.rb#2462
1866
+ def begin_transport(req); end
1867
+
1868
+ # without proxy, obsolete
1869
+ #
1870
+ # source://net-http//lib/net/http.rb#1932
1871
+ def conn_address; end
1872
+
1873
+ # source://net-http//lib/net/http.rb#1936
1874
+ def conn_port; end
1875
+
1876
+ # source://net-http//lib/net/http.rb#1647
1877
+ def connect; end
1878
+
1879
+ # Adds a message to debugging output
1880
+ #
1881
+ # source://net-http//lib/net/http.rb#2553
1882
+ def debug(msg); end
1883
+
1884
+ # source://net-http//lib/net/http.rb#1781
1885
+ def do_finish; end
1886
+
1887
+ # source://net-http//lib/net/http.rb#1641
1888
+ def do_start; end
1889
+
1890
+ # source://net-http//lib/net/http.rb#1940
1891
+ def edit_path(path); end
1892
+
1893
+ # source://net-http//lib/net/http.rb#2485
1894
+ def end_transport(req, res); end
1895
+
1896
+ # @return [Boolean]
1897
+ #
1898
+ # source://net-http//lib/net/http.rb#2502
1899
+ def keep_alive?(req, res); end
1900
+
1901
+ # source://net-http//lib/net/http.rb#1763
1902
+ def on_connect; end
1903
+
1904
+ # Executes a request which uses a representation
1905
+ # and returns its body.
1906
+ #
1907
+ # source://net-http//lib/net/http.rb#2396
1908
+ def send_entity(path, data, initheader, dest, type, &block); end
1909
+
1910
+ # source://net-http//lib/net/http.rb#2526
1911
+ def sspi_auth(req); end
1912
+
1913
+ # @return [Boolean]
1914
+ #
1915
+ # source://net-http//lib/net/http.rb#2511
1916
+ def sspi_auth?(res); end
1917
+
1918
+ # source://net-http//lib/net/http.rb#2407
1919
+ def transport_request(req); end
1920
+
1921
+ # source://net-http//lib/net/http.rb#1925
1922
+ def unescape(value); end
1923
+
1924
+ class << self
1925
+ # Creates an \HTTP proxy class which behaves like \Net::HTTP, but
1926
+ # performs all access via the specified proxy.
1927
+ #
1928
+ # This class is obsolete. You may pass these same parameters directly to
1929
+ # \Net::HTTP.new. See Net::HTTP.new for details of the arguments.
1930
+ #
1931
+ # source://net-http//lib/net/http.rb#1808
1932
+ def Proxy(p_addr = T.unsafe(nil), p_port = T.unsafe(nil), p_user = T.unsafe(nil), p_pass = T.unsafe(nil), p_use_ssl = T.unsafe(nil)); end
1933
+
1934
+ # Allows to set the default configuration that will be used
1935
+ # when creating a new connection.
1936
+ #
1937
+ # Example:
1938
+ #
1939
+ # Net::HTTP.default_configuration = {
1940
+ # read_timeout: 1,
1941
+ # write_timeout: 1
1942
+ # }
1943
+ # http = Net::HTTP.new(hostname)
1944
+ # http.open_timeout # => 60
1945
+ # http.read_timeout # => 1
1946
+ # http.write_timeout # => 1
1947
+ #
1948
+ # source://net-http//lib/net/http.rb#1148
1949
+ def default_configuration; end
1950
+
1951
+ # Allows to set the default configuration that will be used
1952
+ # when creating a new connection.
1953
+ #
1954
+ # Example:
1955
+ #
1956
+ # Net::HTTP.default_configuration = {
1957
+ # read_timeout: 1,
1958
+ # write_timeout: 1
1959
+ # }
1960
+ # http = Net::HTTP.new(hostname)
1961
+ # http.open_timeout # => 60
1962
+ # http.read_timeout # => 1
1963
+ # http.write_timeout # => 1
1964
+ #
1965
+ # source://net-http//lib/net/http.rb#1148
1966
+ def default_configuration=(_arg0); end
1967
+
1968
+ # Returns integer +80+, the default port to use for \HTTP requests:
1969
+ #
1970
+ # Net::HTTP.default_port # => 80
1971
+ #
1972
+ # source://net-http//lib/net/http.rb#941
1973
+ def default_port; end
1974
+
1975
+ # :call-seq:
1976
+ # Net::HTTP.get(hostname, path, port = 80) -> body
1977
+ # Net::HTTP:get(uri, headers = {}, port = uri.port) -> body
1978
+ #
1979
+ # Sends a GET request and returns the \HTTP response body as a string.
1980
+ #
1981
+ # With string arguments +hostname+ and +path+:
1982
+ #
1983
+ # hostname = 'jsonplaceholder.typicode.com'
1984
+ # path = '/todos/1'
1985
+ # puts Net::HTTP.get(hostname, path)
1986
+ #
1987
+ # Output:
1988
+ #
1989
+ # {
1990
+ # "userId": 1,
1991
+ # "id": 1,
1992
+ # "title": "delectus aut autem",
1993
+ # "completed": false
1994
+ # }
1995
+ #
1996
+ # With URI object +uri+ and optional hash argument +headers+:
1997
+ #
1998
+ # uri = URI('https://jsonplaceholder.typicode.com/todos/1')
1999
+ # headers = {'Content-type' => 'application/json; charset=UTF-8'}
2000
+ # Net::HTTP.get(uri, headers)
2001
+ #
2002
+ # Related:
2003
+ #
2004
+ # - Net::HTTP::Get: request class for \HTTP method +GET+.
2005
+ # - Net::HTTP#get: convenience method for \HTTP method +GET+.
2006
+ #
2007
+ # source://net-http//lib/net/http.rb#810
2008
+ def get(uri_or_host, path_or_headers = T.unsafe(nil), port = T.unsafe(nil)); end
2009
+
2010
+ # :call-seq:
2011
+ # Net::HTTP.get_print(hostname, path, port = 80) -> nil
2012
+ # Net::HTTP:get_print(uri, headers = {}, port = uri.port) -> nil
2013
+ #
2014
+ # Like Net::HTTP.get, but writes the returned body to $stdout;
2015
+ # returns +nil+.
2016
+ #
2017
+ # source://net-http//lib/net/http.rb#769
2018
+ def get_print(uri_or_host, path_or_headers = T.unsafe(nil), port = T.unsafe(nil)); end
2019
+
2020
+ # :call-seq:
2021
+ # Net::HTTP.get_response(hostname, path, port = 80) -> http_response
2022
+ # Net::HTTP:get_response(uri, headers = {}, port = uri.port) -> http_response
2023
+ #
2024
+ # Like Net::HTTP.get, but returns a Net::HTTPResponse object
2025
+ # instead of the body string.
2026
+ #
2027
+ # source://net-http//lib/net/http.rb#820
2028
+ def get_response(uri_or_host, path_or_headers = T.unsafe(nil), port = T.unsafe(nil), &block); end
2029
+
2030
+ # Returns integer +80+, the default port to use for \HTTP requests:
2031
+ #
2032
+ # Net::HTTP.http_default_port # => 80
2033
+ #
2034
+ # source://net-http//lib/net/http.rb#949
2035
+ def http_default_port; end
2036
+
2037
+ # Returns integer +443+, the default port to use for HTTPS requests:
2038
+ #
2039
+ # Net::HTTP.https_default_port # => 443
2040
+ #
2041
+ # source://net-http//lib/net/http.rb#957
2042
+ def https_default_port; end
2043
+
2044
+ # Returns +false+; retained for compatibility.
2045
+ #
2046
+ # @return [Boolean]
2047
+ #
2048
+ # source://net-http//lib/net/http.rb#754
2049
+ def is_version_1_1?; end
2050
+
2051
+ # Returns +true+; retained for compatibility.
2052
+ #
2053
+ # @return [Boolean]
2054
+ #
2055
+ # source://net-http//lib/net/http.rb#749
2056
+ def is_version_1_2?; end
2057
+
2058
+ # Returns a new \Net::HTTP object +http+
2059
+ # (but does not open a TCP connection or \HTTP session).
2060
+ #
2061
+ # With only string argument +address+ given
2062
+ # (and <tt>ENV['http_proxy']</tt> undefined or +nil+),
2063
+ # the returned +http+:
2064
+ #
2065
+ # - Has the given address.
2066
+ # - Has the default port number, Net::HTTP.default_port (80).
2067
+ # - Has no proxy.
2068
+ #
2069
+ # Example:
2070
+ #
2071
+ # http = Net::HTTP.new(hostname)
2072
+ # # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false>
2073
+ # http.address # => "jsonplaceholder.typicode.com"
2074
+ # http.port # => 80
2075
+ # http.proxy? # => false
2076
+ #
2077
+ # With integer argument +port+ also given,
2078
+ # the returned +http+ has the given port:
2079
+ #
2080
+ # http = Net::HTTP.new(hostname, 8000)
2081
+ # # => #<Net::HTTP jsonplaceholder.typicode.com:8000 open=false>
2082
+ # http.port # => 8000
2083
+ #
2084
+ # For proxy-defining arguments +p_addr+ through +p_no_proxy+,
2085
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
2086
+ #
2087
+ # source://net-http//lib/net/http.rb#1106
2088
+ def new(address, port = T.unsafe(nil), p_addr = T.unsafe(nil), p_port = T.unsafe(nil), p_user = T.unsafe(nil), p_pass = T.unsafe(nil), p_no_proxy = T.unsafe(nil), p_use_ssl = T.unsafe(nil)); end
2089
+
2090
+ # Posts data to a host; returns a Net::HTTPResponse object.
2091
+ #
2092
+ # Argument +url+ must be a URL;
2093
+ # argument +data+ must be a string:
2094
+ #
2095
+ # _uri = uri.dup
2096
+ # _uri.path = '/posts'
2097
+ # data = '{"title": "foo", "body": "bar", "userId": 1}'
2098
+ # headers = {'content-type': 'application/json'}
2099
+ # res = Net::HTTP.post(_uri, data, headers) # => #<Net::HTTPCreated 201 Created readbody=true>
2100
+ # puts res.body
2101
+ #
2102
+ # Output:
2103
+ #
2104
+ # {
2105
+ # "title": "foo",
2106
+ # "body": "bar",
2107
+ # "userId": 1,
2108
+ # "id": 101
2109
+ # }
2110
+ #
2111
+ # Related:
2112
+ #
2113
+ # - Net::HTTP::Post: request class for \HTTP method +POST+.
2114
+ # - Net::HTTP#post: convenience method for \HTTP method +POST+.
2115
+ #
2116
+ # source://net-http//lib/net/http.rb#863
2117
+ def post(url, data, header = T.unsafe(nil)); end
2118
+
2119
+ # Posts data to a host; returns a Net::HTTPResponse object.
2120
+ #
2121
+ # Argument +url+ must be a URI;
2122
+ # argument +data+ must be a hash:
2123
+ #
2124
+ # _uri = uri.dup
2125
+ # _uri.path = '/posts'
2126
+ # data = {title: 'foo', body: 'bar', userId: 1}
2127
+ # res = Net::HTTP.post_form(_uri, data) # => #<Net::HTTPCreated 201 Created readbody=true>
2128
+ # puts res.body
2129
+ #
2130
+ # Output:
2131
+ #
2132
+ # {
2133
+ # "title": "foo",
2134
+ # "body": "bar",
2135
+ # "userId": "1",
2136
+ # "id": 101
2137
+ # }
2138
+ #
2139
+ # source://net-http//lib/net/http.rb#890
2140
+ def post_form(url, params); end
2141
+
2142
+ # Returns the address of the proxy host, or +nil+ if none;
2143
+ # see Net::HTTP@Proxy+Server.
2144
+ #
2145
+ # source://net-http//lib/net/http.rb#1838
2146
+ def proxy_address; end
2147
+
2148
+ # Returns true if self is a class which was created by HTTP::Proxy.
2149
+ #
2150
+ # @return [Boolean]
2151
+ #
2152
+ # source://net-http//lib/net/http.rb#1832
2153
+ def proxy_class?; end
2154
+
2155
+ # Returns the password for accessing the proxy, or +nil+ if none;
2156
+ # see Net::HTTP@Proxy+Server.
2157
+ #
2158
+ # source://net-http//lib/net/http.rb#1850
2159
+ def proxy_pass; end
2160
+
2161
+ # Returns the port number of the proxy host, or +nil+ if none;
2162
+ # see Net::HTTP@Proxy+Server.
2163
+ #
2164
+ # source://net-http//lib/net/http.rb#1842
2165
+ def proxy_port; end
2166
+
2167
+ # Use SSL when talking to the proxy. If Net::HTTP does not use a proxy, nil.
2168
+ #
2169
+ # source://net-http//lib/net/http.rb#1853
2170
+ def proxy_use_ssl; end
2171
+
2172
+ # Returns the user name for accessing the proxy, or +nil+ if none;
2173
+ # see Net::HTTP@Proxy+Server.
2174
+ #
2175
+ # source://net-http//lib/net/http.rb#1846
2176
+ def proxy_user; end
2177
+
2178
+ # Sends a PUT request to the server; returns a Net::HTTPResponse object.
2179
+ #
2180
+ # Argument +url+ must be a URL;
2181
+ # argument +data+ must be a string:
2182
+ #
2183
+ # _uri = uri.dup
2184
+ # _uri.path = '/posts'
2185
+ # data = '{"title": "foo", "body": "bar", "userId": 1}'
2186
+ # headers = {'content-type': 'application/json'}
2187
+ # res = Net::HTTP.put(_uri, data, headers) # => #<Net::HTTPCreated 201 Created readbody=true>
2188
+ # puts res.body
2189
+ #
2190
+ # Output:
2191
+ #
2192
+ # {
2193
+ # "title": "foo",
2194
+ # "body": "bar",
2195
+ # "userId": 1,
2196
+ # "id": 101
2197
+ # }
2198
+ #
2199
+ # Related:
2200
+ #
2201
+ # - Net::HTTP::Put: request class for \HTTP method +PUT+.
2202
+ # - Net::HTTP#put: convenience method for \HTTP method +PUT+.
2203
+ #
2204
+ # source://net-http//lib/net/http.rb#926
2205
+ def put(url, data, header = T.unsafe(nil)); end
2206
+
2207
+ # source://net-http//lib/net/http.rb#961
2208
+ def socket_type; end
2209
+
2210
+ # :call-seq:
2211
+ # HTTP.start(address, port = nil, p_addr = :ENV, p_port = nil, p_user = nil, p_pass = nil, opts) -> http
2212
+ # HTTP.start(address, port = nil, p_addr = :ENV, p_port = nil, p_user = nil, p_pass = nil, opts) {|http| ... } -> object
2213
+ #
2214
+ # Creates a new \Net::HTTP object, +http+, via \Net::HTTP.new:
2215
+ #
2216
+ # - For arguments +address+ and +port+, see Net::HTTP.new.
2217
+ # - For proxy-defining arguments +p_addr+ through +p_pass+,
2218
+ # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
2219
+ # - For argument +opts+, see below.
2220
+ #
2221
+ # With no block given:
2222
+ #
2223
+ # - Calls <tt>http.start</tt> with no block (see #start),
2224
+ # which opens a TCP connection and \HTTP session.
2225
+ # - Returns +http+.
2226
+ # - The caller should call #finish to close the session:
2227
+ #
2228
+ # http = Net::HTTP.start(hostname)
2229
+ # http.started? # => true
2230
+ # http.finish
2231
+ # http.started? # => false
2232
+ #
2233
+ # With a block given:
2234
+ #
2235
+ # - Calls <tt>http.start</tt> with the block (see #start), which:
2236
+ #
2237
+ # - Opens a TCP connection and \HTTP session.
2238
+ # - Calls the block,
2239
+ # which may make any number of requests to the host.
2240
+ # - Closes the \HTTP session and TCP connection on block exit.
2241
+ # - Returns the block's value +object+.
2242
+ #
2243
+ # - Returns +object+.
2244
+ #
2245
+ # Example:
2246
+ #
2247
+ # hostname = 'jsonplaceholder.typicode.com'
2248
+ # Net::HTTP.start(hostname) do |http|
2249
+ # puts http.get('/todos/1').body
2250
+ # puts http.get('/todos/2').body
2251
+ # end
2252
+ #
2253
+ # Output:
2254
+ #
2255
+ # {
2256
+ # "userId": 1,
2257
+ # "id": 1,
2258
+ # "title": "delectus aut autem",
2259
+ # "completed": false
2260
+ # }
2261
+ # {
2262
+ # "userId": 1,
2263
+ # "id": 2,
2264
+ # "title": "quis ut nam facilis et officia qui",
2265
+ # "completed": false
2266
+ # }
2267
+ #
2268
+ # If the last argument given is a hash, it is the +opts+ hash,
2269
+ # where each key is a method or accessor to be called,
2270
+ # and its value is the value to be set.
2271
+ #
2272
+ # The keys may include:
2273
+ #
2274
+ # - #ca_file
2275
+ # - #ca_path
2276
+ # - #cert
2277
+ # - #cert_store
2278
+ # - #ciphers
2279
+ # - #close_on_empty_response
2280
+ # - +ipaddr+ (calls #ipaddr=)
2281
+ # - #keep_alive_timeout
2282
+ # - #key
2283
+ # - #open_timeout
2284
+ # - #read_timeout
2285
+ # - #ssl_timeout
2286
+ # - #ssl_version
2287
+ # - +use_ssl+ (calls #use_ssl=)
2288
+ # - #verify_callback
2289
+ # - #verify_depth
2290
+ # - #verify_mode
2291
+ # - #write_timeout
2292
+ #
2293
+ # Note: If +port+ is +nil+ and <tt>opts[:use_ssl]</tt> is a truthy value,
2294
+ # the value passed to +new+ is Net::HTTP.https_default_port, not +port+.
2295
+ #
2296
+ # source://net-http//lib/net/http.rb#1051
2297
+ def start(address, *arg, &block); end
2298
+
2299
+ # Returns +false+; retained for compatibility.
2300
+ #
2301
+ # @return [Boolean]
2302
+ #
2303
+ # source://net-http//lib/net/http.rb#754
2304
+ def version_1_1?; end
2305
+
2306
+ # Returns +true+; retained for compatibility.
2307
+ #
2308
+ # source://net-http//lib/net/http.rb#744
2309
+ def version_1_2; end
2310
+
2311
+ # Returns +true+; retained for compatibility.
2312
+ #
2313
+ # @return [Boolean]
2314
+ #
2315
+ # source://net-http//lib/net/http.rb#749
2316
+ def version_1_2?; end
2317
+ end
2318
+ end
2319
+
2320
+ # source://net-http//lib/net/http/proxy_delta.rb#2
2321
+ module Net::HTTP::ProxyDelta
2322
+ private
2323
+
2324
+ # source://net-http//lib/net/http/proxy_delta.rb#5
2325
+ def conn_address; end
2326
+
2327
+ # source://net-http//lib/net/http/proxy_delta.rb#9
2328
+ def conn_port; end
2329
+
2330
+ # source://net-http//lib/net/http/proxy_delta.rb#13
2331
+ def edit_path(path); end
2332
+ end
2333
+
2334
+ # :stopdoc:
2335
+ #
2336
+ # source://net-http//lib/net/http.rb#733
2337
+ Net::HTTP::VERSION = T.let(T.unsafe(nil), String)
2338
+
2339
+ # Response class for <tt>Already Reported (WebDAV)</tt> responses (status code 208).
2340
+ #
2341
+ # The <tt>Already Reported (WebDAV)</tt> response indicates that the server
2342
+ # has received the request,
2343
+ # and that the members of a DAV binding have already been enumerated
2344
+ # in a preceding part of the (multi-status) response,
2345
+ # and are not being included again.
2346
+ #
2347
+ # :include: doc/net-http/included_getters.rdoc
2348
+ #
2349
+ # References:
2350
+ #
2351
+ # - {RFC 5842}[https://www.rfc-editor.org/rfc/rfc5842.html#section-7.1].
2352
+ # - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#208].
2353
+ #
2354
+ # source://net-http//lib/net/http/responses.rb#306
2355
+ class Net::HTTPAlreadyReported < ::Net::HTTPSuccess; end
2356
+
2357
+ # source://net-http//lib/net/http/responses.rb#307
2358
+ Net::HTTPAlreadyReported::HAS_BODY = T.let(T.unsafe(nil), TrueClass)
2359
+
2360
+ # source://net-http//lib/net/http/responses.rb#67
2361
+ Net::HTTPClientError::EXCEPTION_TYPE = Net::HTTPClientException
2362
+
2363
+ # source://net-http//lib/net/http/exceptions.rb#23
2364
+ class Net::HTTPClientException < ::Net::ProtoServerError
2365
+ include ::Net::HTTPExceptions
2366
+ end
2367
+
2368
+ # Response class for <tt>Early Hints</tt> responses (status code 103).
2369
+ #
2370
+ # The <tt>Early Hints</tt> indicates that the server has received
2371
+ # and is processing the request, and contains certain headers;
2372
+ # the final response is not available yet.
2373
+ #
2374
+ # :include: doc/net-http/included_getters.rdoc
2375
+ #
2376
+ # References:
2377
+ #
2378
+ # - {Mozilla}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103].
2379
+ # - {RFC 8297}[https://www.rfc-editor.org/rfc/rfc8297.html#section-2].
2380
+ # - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#103].
2381
+ #
2382
+ # source://net-http//lib/net/http/responses.rb#147
2383
+ class Net::HTTPEarlyHints < ::Net::HTTPInformation; end
2384
+
2385
+ # source://net-http//lib/net/http/responses.rb#148
2386
+ Net::HTTPEarlyHints::HAS_BODY = T.let(T.unsafe(nil), FalseClass)
2387
+
2388
+ # source://net-http//lib/net/http/exceptions.rb#15
2389
+ class Net::HTTPError < ::Net::ProtocolError
2390
+ include ::Net::HTTPExceptions
2391
+ end
2392
+
2393
+ # Net::HTTP exception class.
2394
+ # You cannot use Net::HTTPExceptions directly; instead, you must use
2395
+ # its subclasses.
2396
+ #
2397
+ # source://net-http//lib/net/http/exceptions.rb#6
2398
+ module Net::HTTPExceptions
2399
+ # source://net-http//lib/net/http/exceptions.rb#7
2400
+ def initialize(msg, res); end
2401
+
2402
+ # Returns the value of attribute response.
2403
+ #
2404
+ # source://net-http//lib/net/http/exceptions.rb#11
2405
+ def response; end
2406
+ end
2407
+
2408
+ # source://net-http//lib/net/http/exceptions.rb#27
2409
+ class Net::HTTPFatalError < ::Net::ProtoFatalError
2410
+ include ::Net::HTTPExceptions
2411
+ end
2412
+
2413
+ # \HTTPGenericRequest is the parent of the Net::HTTPRequest class.
2414
+ #
2415
+ # Do not use this directly; instead, use a subclass of Net::HTTPRequest.
2416
+ #
2417
+ # == About the Examples
2418
+ #
2419
+ # :include: doc/net-http/examples.rdoc
2420
+ #
2421
+ # source://net-http//lib/net/http/generic_request.rb#11
2422
+ class Net::HTTPGenericRequest
2423
+ include ::Net::HTTPHeader
2424
+
2425
+ # @return [HTTPGenericRequest] a new instance of HTTPGenericRequest
2426
+ #
2427
+ # source://net-http//lib/net/http/generic_request.rb#15
2428
+ def initialize(m, reqbody, resbody, uri_or_path, initheader = T.unsafe(nil)); end
2429
+
2430
+ # Don't automatically decode response content-encoding if the user indicates
2431
+ # they want to handle it.
2432
+ #
2433
+ # source://net-http//lib/net/http/generic_request.rb#109
2434
+ def []=(key, val); end
2435
+
2436
+ # Returns the string body for the request, or +nil+ if there is none:
2437
+ #
2438
+ # req = Net::HTTP::Post.new(uri)
2439
+ # req.body # => nil
2440
+ # req.body = '{"title": "foo","body": "bar","userId": 1}'
2441
+ # req.body # => "{\"title\": \"foo\",\"body\": \"bar\",\"userId\": 1}"
2442
+ #
2443
+ # source://net-http//lib/net/http/generic_request.rb#145
2444
+ def body; end
2445
+
2446
+ # Sets the body for the request:
2447
+ #
2448
+ # req = Net::HTTP::Post.new(uri)
2449
+ # req.body # => nil
2450
+ # req.body = '{"title": "foo","body": "bar","userId": 1}'
2451
+ # req.body # => "{\"title\": \"foo\",\"body\": \"bar\",\"userId\": 1}"
2452
+ #
2453
+ # source://net-http//lib/net/http/generic_request.rb#154
2454
+ def body=(str); end
2455
+
2456
+ # @return [Boolean]
2457
+ #
2458
+ # source://net-http//lib/net/http/generic_request.rb#133
2459
+ def body_exist?; end
2460
+
2461
+ # Returns the body stream object for the request, or +nil+ if there is none:
2462
+ #
2463
+ # req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST>
2464
+ # req.body_stream # => nil
2465
+ # require 'stringio'
2466
+ # req.body_stream = StringIO.new('xyzzy') # => #<StringIO:0x0000027d1e5affa8>
2467
+ # req.body_stream # => #<StringIO:0x0000027d1e5affa8>
2468
+ #
2469
+ # source://net-http//lib/net/http/generic_request.rb#169
2470
+ def body_stream; end
2471
+
2472
+ # Sets the body stream for the request:
2473
+ #
2474
+ # req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST>
2475
+ # req.body_stream # => nil
2476
+ # require 'stringio'
2477
+ # req.body_stream = StringIO.new('xyzzy') # => #<StringIO:0x0000027d1e5affa8>
2478
+ # req.body_stream # => #<StringIO:0x0000027d1e5affa8>
2479
+ #
2480
+ # source://net-http//lib/net/http/generic_request.rb#179
2481
+ def body_stream=(input); end
2482
+
2483
+ # Returns +false+ if the request's header <tt>'Accept-Encoding'</tt>
2484
+ # has been set manually or deleted
2485
+ # (indicating that the user intends to handle encoding in the response),
2486
+ # +true+ otherwise:
2487
+ #
2488
+ # req = Net::HTTP::Get.new(uri) # => #<Net::HTTP::Get GET>
2489
+ # req['Accept-Encoding'] # => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
2490
+ # req.decode_content # => true
2491
+ # req['Accept-Encoding'] = 'foo'
2492
+ # req.decode_content # => false
2493
+ # req.delete('Accept-Encoding')
2494
+ # req.decode_content # => false
2495
+ #
2496
+ # source://net-http//lib/net/http/generic_request.rb#95
2497
+ def decode_content; end
2498
+
2499
+ # write
2500
+ #
2501
+ # source://net-http//lib/net/http/generic_request.rb#198
2502
+ def exec(sock, ver, path); end
2503
+
2504
+ # Returns a string representation of the request:
2505
+ #
2506
+ # Net::HTTP::Post.new(uri).inspect # => "#<Net::HTTP::Post POST>"
2507
+ #
2508
+ # source://net-http//lib/net/http/generic_request.rb#101
2509
+ def inspect; end
2510
+
2511
+ # Returns the string method name for the request:
2512
+ #
2513
+ # Net::HTTP::Get.new(uri).method # => "GET"
2514
+ # Net::HTTP::Post.new(uri).method # => "POST"
2515
+ #
2516
+ # source://net-http//lib/net/http/generic_request.rb#65
2517
+ def method; end
2518
+
2519
+ # Returns the string path for the request:
2520
+ #
2521
+ # Net::HTTP::Get.new(uri).path # => "/"
2522
+ # Net::HTTP::Post.new('example.com').path # => "example.com"
2523
+ #
2524
+ # source://net-http//lib/net/http/generic_request.rb#72
2525
+ def path; end
2526
+
2527
+ # Returns whether the request may have a body:
2528
+ #
2529
+ # Net::HTTP::Post.new(uri).request_body_permitted? # => true
2530
+ # Net::HTTP::Get.new(uri).request_body_permitted? # => false
2531
+ #
2532
+ # @return [Boolean]
2533
+ #
2534
+ # source://net-http//lib/net/http/generic_request.rb#120
2535
+ def request_body_permitted?; end
2536
+
2537
+ # Returns whether the response may have a body:
2538
+ #
2539
+ # Net::HTTP::Post.new(uri).response_body_permitted? # => true
2540
+ # Net::HTTP::Head.new(uri).response_body_permitted? # => false
2541
+ #
2542
+ # @return [Boolean]
2543
+ #
2544
+ # source://net-http//lib/net/http/generic_request.rb#129
2545
+ def response_body_permitted?; end
2546
+
2547
+ # @raise [ArgumentError]
2548
+ #
2549
+ # source://net-http//lib/net/http/generic_request.rb#186
2550
+ def set_body_internal(str); end
2551
+
2552
+ # source://net-http//lib/net/http/generic_request.rb#210
2553
+ def update_uri(addr, port, ssl); end
2554
+
2555
+ # Returns the URI object for the request, or +nil+ if none:
2556
+ #
2557
+ # Net::HTTP::Get.new(uri).uri
2558
+ # # => #<URI::HTTPS https://jsonplaceholder.typicode.com/>
2559
+ # Net::HTTP::Get.new('example.com').uri # => nil
2560
+ #
2561
+ # source://net-http//lib/net/http/generic_request.rb#80
2562
+ def uri; end
2563
+
2564
+ private
2565
+
2566
+ # source://net-http//lib/net/http/generic_request.rb#312
2567
+ def encode_multipart_form_data(out, params, opt); end
2568
+
2569
+ # source://net-http//lib/net/http/generic_request.rb#368
2570
+ def flush_buffer(out, buf, chunked_p); end
2571
+
2572
+ # source://net-http//lib/net/http/generic_request.rb#363
2573
+ def quote_string(str, charset); end
2574
+
2575
+ # source://net-http//lib/net/http/generic_request.rb#260
2576
+ def send_request_with_body(sock, ver, path, body); end
2577
+
2578
+ # source://net-http//lib/net/http/generic_request.rb#286
2579
+ def send_request_with_body_data(sock, ver, path, params); end
2580
+
2581
+ # source://net-http//lib/net/http/generic_request.rb#269
2582
+ def send_request_with_body_stream(sock, ver, path, f); end
2583
+
2584
+ # source://net-http//lib/net/http/generic_request.rb#376
2585
+ def supply_default_content_type; end
2586
+
2587
+ # Waits up to the continue timeout for a response from the server provided
2588
+ # we're speaking HTTP 1.1 and are expecting a 100-continue response.
2589
+ #
2590
+ # source://net-http//lib/net/http/generic_request.rb#386
2591
+ def wait_for_continue(sock, ver); end
2592
+
2593
+ # source://net-http//lib/net/http/generic_request.rb#399
2594
+ def write_header(sock, ver, path); end
2595
+ end
2596
+
2597
+ # source://net-http//lib/net/http/generic_request.rb#242
2598
+ class Net::HTTPGenericRequest::Chunker
2599
+ # @return [Chunker] a new instance of Chunker
2600
+ #
2601
+ # source://net-http//lib/net/http/generic_request.rb#243
2602
+ def initialize(sock); end
2603
+
2604
+ # source://net-http//lib/net/http/generic_request.rb#255
2605
+ def finish; end
2606
+
2607
+ # source://net-http//lib/net/http/generic_request.rb#248
2608
+ def write(buf); end
2609
+ end
2610
+
2611
+ # The \HTTPHeader module provides access to \HTTP headers.
2612
+ #
2613
+ # The module is included in:
2614
+ #
2615
+ # - Net::HTTPGenericRequest (and therefore Net::HTTPRequest).
2616
+ # - Net::HTTPResponse.
2617
+ #
2618
+ # The headers are a hash-like collection of key/value pairs called _fields_.
2619
+ #
2620
+ # == Request and Response Fields
2621
+ #
2622
+ # Headers may be included in:
2623
+ #
2624
+ # - A Net::HTTPRequest object:
2625
+ # the object's headers will be sent with the request.
2626
+ # Any fields may be defined in the request;
2627
+ # see {Setters}[rdoc-ref:Net::HTTPHeader@Setters].
2628
+ # - A Net::HTTPResponse object:
2629
+ # the objects headers are usually those returned from the host.
2630
+ # Fields may be retrieved from the object;
2631
+ # see {Getters}[rdoc-ref:Net::HTTPHeader@Getters]
2632
+ # and {Iterators}[rdoc-ref:Net::HTTPHeader@Iterators].
2633
+ #
2634
+ # Exactly which fields should be sent or expected depends on the host;
2635
+ # see:
2636
+ #
2637
+ # - {Request fields}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields].
2638
+ # - {Response fields}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_fields].
2639
+ #
2640
+ # == About the Examples
2641
+ #
2642
+ # :include: doc/net-http/examples.rdoc
2643
+ #
2644
+ # == Fields
2645
+ #
2646
+ # A header field is a key/value pair.
2647
+ #
2648
+ # === Field Keys
2649
+ #
2650
+ # A field key may be:
2651
+ #
2652
+ # - A string: Key <tt>'Accept'</tt> is treated as if it were
2653
+ # <tt>'Accept'.downcase</tt>; i.e., <tt>'accept'</tt>.
2654
+ # - A symbol: Key <tt>:Accept</tt> is treated as if it were
2655
+ # <tt>:Accept.to_s.downcase</tt>; i.e., <tt>'accept'</tt>.
2656
+ #
2657
+ # Examples:
2658
+ #
2659
+ # req = Net::HTTP::Get.new(uri)
2660
+ # req[:accept] # => "*/*"
2661
+ # req['Accept'] # => "*/*"
2662
+ # req['ACCEPT'] # => "*/*"
2663
+ #
2664
+ # req['accept'] = 'text/html'
2665
+ # req[:accept] = 'text/html'
2666
+ # req['ACCEPT'] = 'text/html'
2667
+ #
2668
+ # === Field Values
2669
+ #
2670
+ # A field value may be returned as an array of strings or as a string:
2671
+ #
2672
+ # - These methods return field values as arrays:
2673
+ #
2674
+ # - #get_fields: Returns the array value for the given key,
2675
+ # or +nil+ if it does not exist.
2676
+ # - #to_hash: Returns a hash of all header fields:
2677
+ # each key is a field name; its value is the array value for the field.
2678
+ #
2679
+ # - These methods return field values as string;
2680
+ # the string value for a field is equivalent to
2681
+ # <tt>self[key.downcase.to_s].join(', '))</tt>:
2682
+ #
2683
+ # - #[]: Returns the string value for the given key,
2684
+ # or +nil+ if it does not exist.
2685
+ # - #fetch: Like #[], but accepts a default value
2686
+ # to be returned if the key does not exist.
2687
+ #
2688
+ # The field value may be set:
2689
+ #
2690
+ # - #[]=: Sets the value for the given key;
2691
+ # the given value may be a string, a symbol, an array, or a hash.
2692
+ # - #add_field: Adds a given value to a value for the given key
2693
+ # (not overwriting the existing value).
2694
+ # - #delete: Deletes the field for the given key.
2695
+ #
2696
+ # Example field values:
2697
+ #
2698
+ # - \String:
2699
+ #
2700
+ # req['Accept'] = 'text/html' # => "text/html"
2701
+ # req['Accept'] # => "text/html"
2702
+ # req.get_fields('Accept') # => ["text/html"]
2703
+ #
2704
+ # - \Symbol:
2705
+ #
2706
+ # req['Accept'] = :text # => :text
2707
+ # req['Accept'] # => "text"
2708
+ # req.get_fields('Accept') # => ["text"]
2709
+ #
2710
+ # - Simple array:
2711
+ #
2712
+ # req[:foo] = %w[bar baz bat]
2713
+ # req[:foo] # => "bar, baz, bat"
2714
+ # req.get_fields(:foo) # => ["bar", "baz", "bat"]
2715
+ #
2716
+ # - Simple hash:
2717
+ #
2718
+ # req[:foo] = {bar: 0, baz: 1, bat: 2}
2719
+ # req[:foo] # => "bar, 0, baz, 1, bat, 2"
2720
+ # req.get_fields(:foo) # => ["bar", "0", "baz", "1", "bat", "2"]
2721
+ #
2722
+ # - Nested:
2723
+ #
2724
+ # req[:foo] = [%w[bar baz], {bat: 0, bam: 1}]
2725
+ # req[:foo] # => "bar, baz, bat, 0, bam, 1"
2726
+ # req.get_fields(:foo) # => ["bar", "baz", "bat", "0", "bam", "1"]
2727
+ #
2728
+ # req[:foo] = {bar: %w[baz bat], bam: {bah: 0, bad: 1}}
2729
+ # req[:foo] # => "bar, baz, bat, bam, bah, 0, bad, 1"
2730
+ # req.get_fields(:foo) # => ["bar", "baz", "bat", "bam", "bah", "0", "bad", "1"]
2731
+ #
2732
+ # == Convenience Methods
2733
+ #
2734
+ # Various convenience methods retrieve values, set values, query values,
2735
+ # set form values, or iterate over fields.
2736
+ #
2737
+ # === Setters
2738
+ #
2739
+ # \Method #[]= can set any field, but does little to validate the new value;
2740
+ # some of the other setter methods provide some validation:
2741
+ #
2742
+ # - #[]=: Sets the string or array value for the given key.
2743
+ # - #add_field: Creates or adds to the array value for the given key.
2744
+ # - #basic_auth: Sets the string authorization header for <tt>'Authorization'</tt>.
2745
+ # - #content_length=: Sets the integer length for field <tt>'Content-Length</tt>.
2746
+ # - #content_type=: Sets the string value for field <tt>'Content-Type'</tt>.
2747
+ # - #proxy_basic_auth: Sets the string authorization header for <tt>'Proxy-Authorization'</tt>.
2748
+ # - #set_range: Sets the value for field <tt>'Range'</tt>.
2749
+ #
2750
+ # === Form Setters
2751
+ #
2752
+ # - #set_form: Sets an HTML form data set.
2753
+ # - #set_form_data: Sets header fields and a body from HTML form data.
2754
+ #
2755
+ # === Getters
2756
+ #
2757
+ # \Method #[] can retrieve the value of any field that exists,
2758
+ # but always as a string;
2759
+ # some of the other getter methods return something different
2760
+ # from the simple string value:
2761
+ #
2762
+ # - #[]: Returns the string field value for the given key.
2763
+ # - #content_length: Returns the integer value of field <tt>'Content-Length'</tt>.
2764
+ # - #content_range: Returns the Range value of field <tt>'Content-Range'</tt>.
2765
+ # - #content_type: Returns the string value of field <tt>'Content-Type'</tt>.
2766
+ # - #fetch: Returns the string field value for the given key.
2767
+ # - #get_fields: Returns the array field value for the given +key+.
2768
+ # - #main_type: Returns first part of the string value of field <tt>'Content-Type'</tt>.
2769
+ # - #sub_type: Returns second part of the string value of field <tt>'Content-Type'</tt>.
2770
+ # - #range: Returns an array of Range objects of field <tt>'Range'</tt>, or +nil+.
2771
+ # - #range_length: Returns the integer length of the range given in field <tt>'Content-Range'</tt>.
2772
+ # - #type_params: Returns the string parameters for <tt>'Content-Type'</tt>.
2773
+ #
2774
+ # === Queries
2775
+ #
2776
+ # - #chunked?: Returns whether field <tt>'Transfer-Encoding'</tt> is set to <tt>'chunked'</tt>.
2777
+ # - #connection_close?: Returns whether field <tt>'Connection'</tt> is set to <tt>'close'</tt>.
2778
+ # - #connection_keep_alive?: Returns whether field <tt>'Connection'</tt> is set to <tt>'keep-alive'</tt>.
2779
+ # - #key?: Returns whether a given key exists.
2780
+ #
2781
+ # === Iterators
2782
+ #
2783
+ # - #each_capitalized: Passes each field capitalized-name/value pair to the block.
2784
+ # - #each_capitalized_name: Passes each capitalized field name to the block.
2785
+ # - #each_header: Passes each field name/value pair to the block.
2786
+ # - #each_name: Passes each field name to the block.
2787
+ # - #each_value: Passes each string field value to the block.
2788
+ #
2789
+ # source://net-http//lib/net/http/header.rb#181
2790
+ module Net::HTTPHeader
2791
+ # Returns the string field value for the case-insensitive field +key+,
2792
+ # or +nil+ if there is no such key;
2793
+ # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
2794
+ #
2795
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
2796
+ # res['Connection'] # => "keep-alive"
2797
+ # res['Nosuch'] # => nil
2798
+ #
2799
+ # Note that some field values may be retrieved via convenience methods;
2800
+ # see {Getters}[rdoc-ref:Net::HTTPHeader@Getters].
2801
+ #
2802
+ # source://net-http//lib/net/http/header.rb#224
2803
+ def [](key); end
2804
+
2805
+ # Sets the value for the case-insensitive +key+ to +val+,
2806
+ # overwriting the previous value if the field exists;
2807
+ # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
2808
+ #
2809
+ # req = Net::HTTP::Get.new(uri)
2810
+ # req['Accept'] # => "*/*"
2811
+ # req['Accept'] = 'text/html'
2812
+ # req['Accept'] # => "text/html"
2813
+ #
2814
+ # Note that some field values may be set via convenience methods;
2815
+ # see {Setters}[rdoc-ref:Net::HTTPHeader@Setters].
2816
+ #
2817
+ # source://net-http//lib/net/http/header.rb#240
2818
+ def []=(key, val); end
2819
+
2820
+ # Adds value +val+ to the value array for field +key+ if the field exists;
2821
+ # creates the field with the given +key+ and +val+ if it does not exist.
2822
+ # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
2823
+ #
2824
+ # req = Net::HTTP::Get.new(uri)
2825
+ # req.add_field('Foo', 'bar')
2826
+ # req['Foo'] # => "bar"
2827
+ # req.add_field('Foo', 'baz')
2828
+ # req['Foo'] # => "bar, baz"
2829
+ # req.add_field('Foo', %w[baz bam])
2830
+ # req['Foo'] # => "bar, baz, baz, bam"
2831
+ # req.get_fields('Foo') # => ["bar", "baz", "baz", "bam"]
2832
+ #
2833
+ # source://net-http//lib/net/http/header.rb#261
2834
+ def add_field(key, val); end
2835
+
2836
+ # Sets header <tt>'Authorization'</tt> using the given
2837
+ # +account+ and +password+ strings:
2838
+ #
2839
+ # req.basic_auth('my_account', 'my_password')
2840
+ # req['Authorization']
2841
+ # # => "Basic bXlfYWNjb3VudDpteV9wYXNzd29yZA=="
2842
+ #
2843
+ # source://net-http//lib/net/http/header.rb#945
2844
+ def basic_auth(account, password); end
2845
+
2846
+ # Like #each_header, but the keys are returned in capitalized form.
2847
+ #
2848
+ # Net::HTTPHeader#canonical_each is an alias for Net::HTTPHeader#each_capitalized.
2849
+ #
2850
+ # source://net-http//lib/net/http/header.rb#484
2851
+ def canonical_each; end
2852
+
2853
+ # Returns +true+ if field <tt>'Transfer-Encoding'</tt>
2854
+ # exists and has value <tt>'chunked'</tt>,
2855
+ # +false+ otherwise;
2856
+ # see {Transfer-Encoding response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#transfer-encoding-response-header]:
2857
+ #
2858
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
2859
+ # res['Transfer-Encoding'] # => "chunked"
2860
+ # res.chunked? # => true
2861
+ #
2862
+ # @return [Boolean]
2863
+ #
2864
+ # source://net-http//lib/net/http/header.rb#654
2865
+ def chunked?; end
2866
+
2867
+ # Returns whether the HTTP session is to be closed.
2868
+ #
2869
+ # @return [Boolean]
2870
+ #
2871
+ # source://net-http//lib/net/http/header.rb#966
2872
+ def connection_close?; end
2873
+
2874
+ # Returns whether the HTTP session is to be kept alive.
2875
+ #
2876
+ # @return [Boolean]
2877
+ #
2878
+ # source://net-http//lib/net/http/header.rb#974
2879
+ def connection_keep_alive?; end
2880
+
2881
+ # Returns the value of field <tt>'Content-Length'</tt> as an integer,
2882
+ # or +nil+ if there is no such field;
2883
+ # see {Content-Length request header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-length-request-header]:
2884
+ #
2885
+ # res = Net::HTTP.get_response(hostname, '/nosuch/1')
2886
+ # res.content_length # => 2
2887
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
2888
+ # res.content_length # => nil
2889
+ #
2890
+ # source://net-http//lib/net/http/header.rb#616
2891
+ def content_length; end
2892
+
2893
+ # Sets the value of field <tt>'Content-Length'</tt> to the given numeric;
2894
+ # see {Content-Length response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-length-response-header]:
2895
+ #
2896
+ # _uri = uri.dup
2897
+ # hostname = _uri.hostname # => "jsonplaceholder.typicode.com"
2898
+ # _uri.path = '/posts' # => "/posts"
2899
+ # req = Net::HTTP::Post.new(_uri) # => #<Net::HTTP::Post POST>
2900
+ # req.body = '{"title": "foo","body": "bar","userId": 1}'
2901
+ # req.content_length = req.body.size # => 42
2902
+ # req.content_type = 'application/json'
2903
+ # res = Net::HTTP.start(hostname) do |http|
2904
+ # http.request(req)
2905
+ # end # => #<Net::HTTPCreated 201 Created readbody=true>
2906
+ #
2907
+ # source://net-http//lib/net/http/header.rb#637
2908
+ def content_length=(len); end
2909
+
2910
+ # Returns a Range object representing the value of field
2911
+ # <tt>'Content-Range'</tt>, or +nil+ if no such field exists;
2912
+ # see {Content-Range response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-range-response-header]:
2913
+ #
2914
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
2915
+ # res['Content-Range'] # => nil
2916
+ # res['Content-Range'] = 'bytes 0-499/1000'
2917
+ # res['Content-Range'] # => "bytes 0-499/1000"
2918
+ # res.content_range # => 0..499
2919
+ #
2920
+ # source://net-http//lib/net/http/header.rb#670
2921
+ def content_range; end
2922
+
2923
+ # Returns the {media type}[https://en.wikipedia.org/wiki/Media_type]
2924
+ # from the value of field <tt>'Content-Type'</tt>,
2925
+ # or +nil+ if no such field exists;
2926
+ # see {Content-Type response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-response-header]:
2927
+ #
2928
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
2929
+ # res['content-type'] # => "application/json; charset=utf-8"
2930
+ # res.content_type # => "application/json"
2931
+ #
2932
+ # source://net-http//lib/net/http/header.rb#701
2933
+ def content_type; end
2934
+
2935
+ # Sets the value of field <tt>'Content-Type'</tt>;
2936
+ # returns the new value;
2937
+ # see {Content-Type request header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-request-header]:
2938
+ #
2939
+ # req = Net::HTTP::Get.new(uri)
2940
+ # req.set_content_type('application/json') # => ["application/json"]
2941
+ #
2942
+ # Net::HTTPHeader#content_type= is an alias for Net::HTTPHeader#set_content_type.
2943
+ #
2944
+ # source://net-http//lib/net/http/header.rb#772
2945
+ def content_type=(type, params = T.unsafe(nil)); end
2946
+
2947
+ # Removes the header for the given case-insensitive +key+
2948
+ # (see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]);
2949
+ # returns the deleted value, or +nil+ if no such field exists:
2950
+ #
2951
+ # req = Net::HTTP::Get.new(uri)
2952
+ # req.delete('Accept') # => ["*/*"]
2953
+ # req.delete('Nosuch') # => nil
2954
+ #
2955
+ # source://net-http//lib/net/http/header.rb#453
2956
+ def delete(key); end
2957
+
2958
+ # Calls the block with each key/value pair:
2959
+ #
2960
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
2961
+ # res.each_header do |key, value|
2962
+ # p [key, value] if key.start_with?('c')
2963
+ # end
2964
+ #
2965
+ # Output:
2966
+ #
2967
+ # ["content-type", "application/json; charset=utf-8"]
2968
+ # ["connection", "keep-alive"]
2969
+ # ["cache-control", "max-age=43200"]
2970
+ # ["cf-cache-status", "HIT"]
2971
+ # ["cf-ray", "771d17e9bc542cf5-ORD"]
2972
+ #
2973
+ # Returns an enumerator if no block is given.
2974
+ #
2975
+ # Net::HTTPHeader#each is an alias for Net::HTTPHeader#each_header.
2976
+ #
2977
+ # source://net-http//lib/net/http/header.rb#364
2978
+ def each; end
2979
+
2980
+ # Like #each_header, but the keys are returned in capitalized form.
2981
+ #
2982
+ # Net::HTTPHeader#canonical_each is an alias for Net::HTTPHeader#each_capitalized.
2983
+ #
2984
+ # source://net-http//lib/net/http/header.rb#484
2985
+ def each_capitalized; end
2986
+
2987
+ # Calls the block with each capitalized field name:
2988
+ #
2989
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
2990
+ # res.each_capitalized_name do |key|
2991
+ # p key if key.start_with?('C')
2992
+ # end
2993
+ #
2994
+ # Output:
2995
+ #
2996
+ # "Content-Type"
2997
+ # "Connection"
2998
+ # "Cache-Control"
2999
+ # "Cf-Cache-Status"
3000
+ # "Cf-Ray"
3001
+ #
3002
+ # The capitalization is system-dependent;
3003
+ # see {Case Mapping}[https://docs.ruby-lang.org/en/master/case_mapping_rdoc.html].
3004
+ #
3005
+ # Returns an enumerator if no block is given.
3006
+ #
3007
+ # source://net-http//lib/net/http/header.rb#417
3008
+ def each_capitalized_name; end
3009
+
3010
+ # Calls the block with each key/value pair:
3011
+ #
3012
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
3013
+ # res.each_header do |key, value|
3014
+ # p [key, value] if key.start_with?('c')
3015
+ # end
3016
+ #
3017
+ # Output:
3018
+ #
3019
+ # ["content-type", "application/json; charset=utf-8"]
3020
+ # ["connection", "keep-alive"]
3021
+ # ["cache-control", "max-age=43200"]
3022
+ # ["cf-cache-status", "HIT"]
3023
+ # ["cf-ray", "771d17e9bc542cf5-ORD"]
3024
+ #
3025
+ # Returns an enumerator if no block is given.
3026
+ #
3027
+ # Net::HTTPHeader#each is an alias for Net::HTTPHeader#each_header.
3028
+ #
3029
+ # source://net-http//lib/net/http/header.rb#364
3030
+ def each_header; end
3031
+
3032
+ # Calls the block with each field key:
3033
+ #
3034
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
3035
+ # res.each_key do |key|
3036
+ # p key if key.start_with?('c')
3037
+ # end
3038
+ #
3039
+ # Output:
3040
+ #
3041
+ # "content-type"
3042
+ # "connection"
3043
+ # "cache-control"
3044
+ # "cf-cache-status"
3045
+ # "cf-ray"
3046
+ #
3047
+ # Returns an enumerator if no block is given.
3048
+ #
3049
+ # Net::HTTPHeader#each_name is an alias for Net::HTTPHeader#each_key.
3050
+ #
3051
+ # source://net-http//lib/net/http/header.rb#391
3052
+ def each_key(&block); end
3053
+
3054
+ # Calls the block with each field key:
3055
+ #
3056
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
3057
+ # res.each_key do |key|
3058
+ # p key if key.start_with?('c')
3059
+ # end
3060
+ #
3061
+ # Output:
3062
+ #
3063
+ # "content-type"
3064
+ # "connection"
3065
+ # "cache-control"
3066
+ # "cf-cache-status"
3067
+ # "cf-ray"
3068
+ #
3069
+ # Returns an enumerator if no block is given.
3070
+ #
3071
+ # Net::HTTPHeader#each_name is an alias for Net::HTTPHeader#each_key.
3072
+ #
3073
+ # source://net-http//lib/net/http/header.rb#391
3074
+ def each_name(&block); end
3075
+
3076
+ # Calls the block with each string field value:
3077
+ #
3078
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
3079
+ # res.each_value do |value|
3080
+ # p value if value.start_with?('c')
3081
+ # end
3082
+ #
3083
+ # Output:
3084
+ #
3085
+ # "chunked"
3086
+ # "cf-q-config;dur=6.0000002122251e-06"
3087
+ # "cloudflare"
3088
+ #
3089
+ # Returns an enumerator if no block is given.
3090
+ #
3091
+ # source://net-http//lib/net/http/header.rb#438
3092
+ def each_value; end
3093
+
3094
+ # call-seq:
3095
+ # fetch(key, default_val = nil) {|key| ... } -> object
3096
+ # fetch(key, default_val = nil) -> value or default_val
3097
+ #
3098
+ # With a block, returns the string value for +key+ if it exists;
3099
+ # otherwise returns the value of the block;
3100
+ # ignores the +default_val+;
3101
+ # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
3102
+ #
3103
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
3104
+ #
3105
+ # # Field exists; block not called.
3106
+ # res.fetch('Connection') do |value|
3107
+ # fail 'Cannot happen'
3108
+ # end # => "keep-alive"
3109
+ #
3110
+ # # Field does not exist; block called.
3111
+ # res.fetch('Nosuch') do |value|
3112
+ # value.downcase
3113
+ # end # => "nosuch"
3114
+ #
3115
+ # With no block, returns the string value for +key+ if it exists;
3116
+ # otherwise, returns +default_val+ if it was given;
3117
+ # otherwise raises an exception:
3118
+ #
3119
+ # res.fetch('Connection', 'Foo') # => "keep-alive"
3120
+ # res.fetch('Nosuch', 'Foo') # => "Foo"
3121
+ # res.fetch('Nosuch') # Raises KeyError.
3122
+ #
3123
+ # source://net-http//lib/net/http/header.rb#341
3124
+ def fetch(key, *args, &block); end
3125
+
3126
+ # Sets the request body to a URL-encoded string derived from argument +params+,
3127
+ # and sets request header field <tt>'Content-Type'</tt>
3128
+ # to <tt>'application/x-www-form-urlencoded'</tt>.
3129
+ #
3130
+ # The resulting request is suitable for HTTP request +POST+ or +PUT+.
3131
+ #
3132
+ # Argument +params+ must be suitable for use as argument +enum+ to
3133
+ # {URI.encode_www_form}[https://docs.ruby-lang.org/en/master/URI.html#method-c-encode_www_form].
3134
+ #
3135
+ # With only argument +params+ given,
3136
+ # sets the body to a URL-encoded string with the default separator <tt>'&'</tt>:
3137
+ #
3138
+ # req = Net::HTTP::Post.new('example.com')
3139
+ #
3140
+ # req.set_form_data(q: 'ruby', lang: 'en')
3141
+ # req.body # => "q=ruby&lang=en"
3142
+ # req['Content-Type'] # => "application/x-www-form-urlencoded"
3143
+ #
3144
+ # req.set_form_data([['q', 'ruby'], ['lang', 'en']])
3145
+ # req.body # => "q=ruby&lang=en"
3146
+ #
3147
+ # req.set_form_data(q: ['ruby', 'perl'], lang: 'en')
3148
+ # req.body # => "q=ruby&q=perl&lang=en"
3149
+ #
3150
+ # req.set_form_data([['q', 'ruby'], ['q', 'perl'], ['lang', 'en']])
3151
+ # req.body # => "q=ruby&q=perl&lang=en"
3152
+ #
3153
+ # With string argument +sep+ also given,
3154
+ # uses that string as the separator:
3155
+ #
3156
+ # req.set_form_data({q: 'ruby', lang: 'en'}, '|')
3157
+ # req.body # => "q=ruby|lang=en"
3158
+ #
3159
+ # Net::HTTPHeader#form_data= is an alias for Net::HTTPHeader#set_form_data.
3160
+ #
3161
+ # source://net-http//lib/net/http/header.rb#812
3162
+ def form_data=(params, sep = T.unsafe(nil)); end
3163
+
3164
+ # Returns the array field value for the given +key+,
3165
+ # or +nil+ if there is no such field;
3166
+ # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
3167
+ #
3168
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
3169
+ # res.get_fields('Connection') # => ["keep-alive"]
3170
+ # res.get_fields('Nosuch') # => nil
3171
+ #
3172
+ # source://net-http//lib/net/http/header.rb#306
3173
+ def get_fields(key); end
3174
+
3175
+ # source://net-http//lib/net/http/header.rb#185
3176
+ def initialize_http_header(initheader); end
3177
+
3178
+ # Returns +true+ if the field for the case-insensitive +key+ exists, +false+ otherwise:
3179
+ #
3180
+ # req = Net::HTTP::Get.new(uri)
3181
+ # req.key?('Accept') # => true
3182
+ # req.key?('Nosuch') # => false
3183
+ #
3184
+ # @return [Boolean]
3185
+ #
3186
+ # source://net-http//lib/net/http/header.rb#463
3187
+ def key?(key); end
3188
+
3189
+ # source://net-http//lib/net/http/header.rb#208
3190
+ def length; end
3191
+
3192
+ # Returns the leading ('type') part of the
3193
+ # {media type}[https://en.wikipedia.org/wiki/Media_type]
3194
+ # from the value of field <tt>'Content-Type'</tt>,
3195
+ # or +nil+ if no such field exists;
3196
+ # see {Content-Type response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-response-header]:
3197
+ #
3198
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
3199
+ # res['content-type'] # => "application/json; charset=utf-8"
3200
+ # res.main_type # => "application"
3201
+ #
3202
+ # source://net-http//lib/net/http/header.rb#723
3203
+ def main_type; end
3204
+
3205
+ # Sets header <tt>'Proxy-Authorization'</tt> using the given
3206
+ # +account+ and +password+ strings:
3207
+ #
3208
+ # req.proxy_basic_auth('my_account', 'my_password')
3209
+ # req['Proxy-Authorization']
3210
+ # # => "Basic bXlfYWNjb3VudDpteV9wYXNzd29yZA=="
3211
+ #
3212
+ # source://net-http//lib/net/http/header.rb#956
3213
+ def proxy_basic_auth(account, password); end
3214
+
3215
+ # Returns an array of Range objects that represent
3216
+ # the value of field <tt>'Range'</tt>,
3217
+ # or +nil+ if there is no such field;
3218
+ # see {Range request header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#range-request-header]:
3219
+ #
3220
+ # req = Net::HTTP::Get.new(uri)
3221
+ # req['Range'] = 'bytes=0-99,200-299,400-499'
3222
+ # req.range # => [0..99, 200..299, 400..499]
3223
+ # req.delete('Range')
3224
+ # req.range # # => nil
3225
+ #
3226
+ # source://net-http//lib/net/http/header.rb#509
3227
+ def range; end
3228
+
3229
+ # call-seq:
3230
+ # set_range(length) -> length
3231
+ # set_range(offset, length) -> range
3232
+ # set_range(begin..length) -> range
3233
+ #
3234
+ # Sets the value for field <tt>'Range'</tt>;
3235
+ # see {Range request header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#range-request-header]:
3236
+ #
3237
+ # With argument +length+:
3238
+ #
3239
+ # req = Net::HTTP::Get.new(uri)
3240
+ # req.set_range(100) # => 100
3241
+ # req['Range'] # => "bytes=0-99"
3242
+ #
3243
+ # With arguments +offset+ and +length+:
3244
+ #
3245
+ # req.set_range(100, 100) # => 100...200
3246
+ # req['Range'] # => "bytes=100-199"
3247
+ #
3248
+ # With argument +range+:
3249
+ #
3250
+ # req.set_range(100..199) # => 100..199
3251
+ # req['Range'] # => "bytes=100-199"
3252
+ #
3253
+ # Net::HTTPHeader#range= is an alias for Net::HTTPHeader#set_range.
3254
+ #
3255
+ # source://net-http//lib/net/http/header.rb#576
3256
+ def range=(r, e = T.unsafe(nil)); end
3257
+
3258
+ # Returns the integer representing length of the value of field
3259
+ # <tt>'Content-Range'</tt>, or +nil+ if no such field exists;
3260
+ # see {Content-Range response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-range-response-header]:
3261
+ #
3262
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
3263
+ # res['Content-Range'] # => nil
3264
+ # res['Content-Range'] = 'bytes 0-499/1000'
3265
+ # res.range_length # => 500
3266
+ #
3267
+ # source://net-http//lib/net/http/header.rb#687
3268
+ def range_length; end
3269
+
3270
+ # Sets the value of field <tt>'Content-Type'</tt>;
3271
+ # returns the new value;
3272
+ # see {Content-Type request header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-request-header]:
3273
+ #
3274
+ # req = Net::HTTP::Get.new(uri)
3275
+ # req.set_content_type('application/json') # => ["application/json"]
3276
+ #
3277
+ # Net::HTTPHeader#content_type= is an alias for Net::HTTPHeader#set_content_type.
3278
+ #
3279
+ # source://net-http//lib/net/http/header.rb#772
3280
+ def set_content_type(type, params = T.unsafe(nil)); end
3281
+
3282
+ # Stores form data to be used in a +POST+ or +PUT+ request.
3283
+ #
3284
+ # The form data given in +params+ consists of zero or more fields;
3285
+ # each field is:
3286
+ #
3287
+ # - A scalar value.
3288
+ # - A name/value pair.
3289
+ # - An IO stream opened for reading.
3290
+ #
3291
+ # Argument +params+ should be an
3292
+ # {Enumerable}[https://docs.ruby-lang.org/en/master/Enumerable.html#module-Enumerable-label-Enumerable+in+Ruby+Classes]
3293
+ # (method <tt>params.map</tt> will be called),
3294
+ # and is often an array or hash.
3295
+ #
3296
+ # First, we set up a request:
3297
+ #
3298
+ # _uri = uri.dup
3299
+ # _uri.path ='/posts'
3300
+ # req = Net::HTTP::Post.new(_uri)
3301
+ #
3302
+ # <b>Argument +params+ As an Array</b>
3303
+ #
3304
+ # When +params+ is an array,
3305
+ # each of its elements is a subarray that defines a field;
3306
+ # the subarray may contain:
3307
+ #
3308
+ # - One string:
3309
+ #
3310
+ # req.set_form([['foo'], ['bar'], ['baz']])
3311
+ #
3312
+ # - Two strings:
3313
+ #
3314
+ # req.set_form([%w[foo 0], %w[bar 1], %w[baz 2]])
3315
+ #
3316
+ # - When argument +enctype+ (see below) is given as
3317
+ # <tt>'multipart/form-data'</tt>:
3318
+ #
3319
+ # - A string name and an IO stream opened for reading:
3320
+ #
3321
+ # require 'stringio'
3322
+ # req.set_form([['file', StringIO.new('Ruby is cool.')]])
3323
+ #
3324
+ # - A string name, an IO stream opened for reading,
3325
+ # and an options hash, which may contain these entries:
3326
+ #
3327
+ # - +:filename+: The name of the file to use.
3328
+ # - +:content_type+: The content type of the uploaded file.
3329
+ #
3330
+ # Example:
3331
+ #
3332
+ # req.set_form([['file', file, {filename: "other-filename.foo"}]]
3333
+ #
3334
+ # The various forms may be mixed:
3335
+ #
3336
+ # req.set_form(['foo', %w[bar 1], ['file', file]])
3337
+ #
3338
+ # <b>Argument +params+ As a Hash</b>
3339
+ #
3340
+ # When +params+ is a hash,
3341
+ # each of its entries is a name/value pair that defines a field:
3342
+ #
3343
+ # - The name is a string.
3344
+ # - The value may be:
3345
+ #
3346
+ # - +nil+.
3347
+ # - Another string.
3348
+ # - An IO stream opened for reading
3349
+ # (only when argument +enctype+ -- see below -- is given as
3350
+ # <tt>'multipart/form-data'</tt>).
3351
+ #
3352
+ # Examples:
3353
+ #
3354
+ # # Nil-valued fields.
3355
+ # req.set_form({'foo' => nil, 'bar' => nil, 'baz' => nil})
3356
+ #
3357
+ # # String-valued fields.
3358
+ # req.set_form({'foo' => 0, 'bar' => 1, 'baz' => 2})
3359
+ #
3360
+ # # IO-valued field.
3361
+ # require 'stringio'
3362
+ # req.set_form({'file' => StringIO.new('Ruby is cool.')})
3363
+ #
3364
+ # # Mixture of fields.
3365
+ # req.set_form({'foo' => nil, 'bar' => 1, 'file' => file})
3366
+ #
3367
+ # Optional argument +enctype+ specifies the value to be given
3368
+ # to field <tt>'Content-Type'</tt>, and must be one of:
3369
+ #
3370
+ # - <tt>'application/x-www-form-urlencoded'</tt> (the default).
3371
+ # - <tt>'multipart/form-data'</tt>;
3372
+ # see {RFC 7578}[https://www.rfc-editor.org/rfc/rfc7578].
3373
+ #
3374
+ # Optional argument +formopt+ is a hash of options
3375
+ # (applicable only when argument +enctype+
3376
+ # is <tt>'multipart/form-data'</tt>)
3377
+ # that may include the following entries:
3378
+ #
3379
+ # - +:boundary+: The value is the boundary string for the multipart message.
3380
+ # If not given, the boundary is a random string.
3381
+ # See {Boundary}[https://www.rfc-editor.org/rfc/rfc7578#section-4.1].
3382
+ # - +:charset+: Value is the character set for the form submission.
3383
+ # Field names and values of non-file fields should be encoded with this charset.
3384
+ #
3385
+ # source://net-http//lib/net/http/header.rb#924
3386
+ def set_form(params, enctype = T.unsafe(nil), formopt = T.unsafe(nil)); end
3387
+
3388
+ # Sets the request body to a URL-encoded string derived from argument +params+,
3389
+ # and sets request header field <tt>'Content-Type'</tt>
3390
+ # to <tt>'application/x-www-form-urlencoded'</tt>.
3391
+ #
3392
+ # The resulting request is suitable for HTTP request +POST+ or +PUT+.
3393
+ #
3394
+ # Argument +params+ must be suitable for use as argument +enum+ to
3395
+ # {URI.encode_www_form}[https://docs.ruby-lang.org/en/master/URI.html#method-c-encode_www_form].
3396
+ #
3397
+ # With only argument +params+ given,
3398
+ # sets the body to a URL-encoded string with the default separator <tt>'&'</tt>:
3399
+ #
3400
+ # req = Net::HTTP::Post.new('example.com')
3401
+ #
3402
+ # req.set_form_data(q: 'ruby', lang: 'en')
3403
+ # req.body # => "q=ruby&lang=en"
3404
+ # req['Content-Type'] # => "application/x-www-form-urlencoded"
3405
+ #
3406
+ # req.set_form_data([['q', 'ruby'], ['lang', 'en']])
3407
+ # req.body # => "q=ruby&lang=en"
3408
+ #
3409
+ # req.set_form_data(q: ['ruby', 'perl'], lang: 'en')
3410
+ # req.body # => "q=ruby&q=perl&lang=en"
3411
+ #
3412
+ # req.set_form_data([['q', 'ruby'], ['q', 'perl'], ['lang', 'en']])
3413
+ # req.body # => "q=ruby&q=perl&lang=en"
3414
+ #
3415
+ # With string argument +sep+ also given,
3416
+ # uses that string as the separator:
3417
+ #
3418
+ # req.set_form_data({q: 'ruby', lang: 'en'}, '|')
3419
+ # req.body # => "q=ruby|lang=en"
3420
+ #
3421
+ # Net::HTTPHeader#form_data= is an alias for Net::HTTPHeader#set_form_data.
3422
+ #
3423
+ # source://net-http//lib/net/http/header.rb#812
3424
+ def set_form_data(params, sep = T.unsafe(nil)); end
3425
+
3426
+ # call-seq:
3427
+ # set_range(length) -> length
3428
+ # set_range(offset, length) -> range
3429
+ # set_range(begin..length) -> range
3430
+ #
3431
+ # Sets the value for field <tt>'Range'</tt>;
3432
+ # see {Range request header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#range-request-header]:
3433
+ #
3434
+ # With argument +length+:
3435
+ #
3436
+ # req = Net::HTTP::Get.new(uri)
3437
+ # req.set_range(100) # => 100
3438
+ # req['Range'] # => "bytes=0-99"
3439
+ #
3440
+ # With arguments +offset+ and +length+:
3441
+ #
3442
+ # req.set_range(100, 100) # => 100...200
3443
+ # req['Range'] # => "bytes=100-199"
3444
+ #
3445
+ # With argument +range+:
3446
+ #
3447
+ # req.set_range(100..199) # => 100..199
3448
+ # req['Range'] # => "bytes=100-199"
3449
+ #
3450
+ # Net::HTTPHeader#range= is an alias for Net::HTTPHeader#set_range.
3451
+ #
3452
+ # source://net-http//lib/net/http/header.rb#576
3453
+ def set_range(r, e = T.unsafe(nil)); end
3454
+
3455
+ # source://net-http//lib/net/http/header.rb#208
3456
+ def size; end
3457
+
3458
+ # Returns the trailing ('subtype') part of the
3459
+ # {media type}[https://en.wikipedia.org/wiki/Media_type]
3460
+ # from the value of field <tt>'Content-Type'</tt>,
3461
+ # or +nil+ if no such field exists;
3462
+ # see {Content-Type response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-response-header]:
3463
+ #
3464
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
3465
+ # res['content-type'] # => "application/json; charset=utf-8"
3466
+ # res.sub_type # => "json"
3467
+ #
3468
+ # source://net-http//lib/net/http/header.rb#738
3469
+ def sub_type; end
3470
+
3471
+ # Returns a hash of the key/value pairs:
3472
+ #
3473
+ # req = Net::HTTP::Get.new(uri)
3474
+ # req.to_hash
3475
+ # # =>
3476
+ # {"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],
3477
+ # "accept"=>["*/*"],
3478
+ # "user-agent"=>["Ruby"],
3479
+ # "host"=>["jsonplaceholder.typicode.com"]}
3480
+ #
3481
+ # source://net-http//lib/net/http/header.rb#477
3482
+ def to_hash; end
3483
+
3484
+ # Returns the trailing ('parameters') part of the value of field <tt>'Content-Type'</tt>,
3485
+ # or +nil+ if no such field exists;
3486
+ # see {Content-Type response header}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-type-response-header]:
3487
+ #
3488
+ # res = Net::HTTP.get_response(hostname, '/todos/1')
3489
+ # res['content-type'] # => "application/json; charset=utf-8"
3490
+ # res.type_params # => {"charset"=>"utf-8"}
3491
+ #
3492
+ # source://net-http//lib/net/http/header.rb#753
3493
+ def type_params; end
3494
+
3495
+ private
3496
+
3497
+ # source://net-http//lib/net/http/header.rb#285
3498
+ def append_field_value(ary, val); end
3499
+
3500
+ # source://net-http//lib/net/http/header.rb#960
3501
+ def basic_encode(account, password); end
3502
+
3503
+ # source://net-http//lib/net/http/header.rb#493
3504
+ def capitalize(name); end
3505
+
3506
+ # source://net-http//lib/net/http/header.rb#270
3507
+ def set_field(key, val); end
3508
+ end
3509
+
3510
+ # source://net-http//lib/net/http/header.rb#183
3511
+ Net::HTTPHeader::MAX_FIELD_LENGTH = T.let(T.unsafe(nil), Integer)
3512
+
3513
+ # source://net-http//lib/net/http/header.rb#182
3514
+ Net::HTTPHeader::MAX_KEY_LENGTH = T.let(T.unsafe(nil), Integer)
3515
+
3516
+ # source://net-http//lib/net/http/responses.rb#23
3517
+ Net::HTTPInformation::EXCEPTION_TYPE = Net::HTTPError
3518
+
3519
+ # Response class for <tt>Loop Detected (WebDAV)</tt> responses (status code 508).
3520
+ #
3521
+ # The server detected an infinite loop while processing the request.
3522
+ #
3523
+ # :include: doc/net-http/included_getters.rdoc
3524
+ #
3525
+ # References:
3526
+ #
3527
+ # - {Mozilla}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/508].
3528
+ # - {RFC 5942}[https://www.rfc-editor.org/rfc/rfc5842.html#section-7.2].
3529
+ # - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#508].
3530
+ #
3531
+ # source://net-http//lib/net/http/responses.rb#1061
3532
+ class Net::HTTPLoopDetected < ::Net::HTTPServerError; end
3533
+
3534
+ # source://net-http//lib/net/http/responses.rb#1062
3535
+ Net::HTTPLoopDetected::HAS_BODY = T.let(T.unsafe(nil), TrueClass)
3536
+
3537
+ # Response class for <tt>Misdirected Request</tt> responses (status code 421).
3538
+ #
3539
+ # The request was directed at a server that is not able to produce a response.
3540
+ #
3541
+ # :include: doc/net-http/included_getters.rdoc
3542
+ #
3543
+ # References:
3544
+ #
3545
+ # - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#name-421-misdirected-request].
3546
+ # - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#421].
3547
+ #
3548
+ # source://net-http//lib/net/http/responses.rb#776
3549
+ class Net::HTTPMisdirectedRequest < ::Net::HTTPClientError; end
3550
+
3551
+ # source://net-http//lib/net/http/responses.rb#777
3552
+ Net::HTTPMisdirectedRequest::HAS_BODY = T.let(T.unsafe(nil), TrueClass)
3553
+
3554
+ # source://net-http//lib/net/http/responses.rb#378
3555
+ Net::HTTPMovedTemporarily = Net::HTTPFound
3556
+
3557
+ # source://net-http//lib/net/http/responses.rb#343
3558
+ Net::HTTPMultipleChoice = Net::HTTPMultipleChoices
3559
+
3560
+ # Response class for <tt>Not Extended</tt> responses (status code 510).
3561
+ #
3562
+ # Further extensions to the request are required for the server to fulfill it.
3563
+ #
3564
+ # :include: doc/net-http/included_getters.rdoc
3565
+ #
3566
+ # References:
3567
+ #
3568
+ # - {Mozilla}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/510].
3569
+ # - {RFC 2774}[https://www.rfc-editor.org/rfc/rfc2774.html#section-7].
3570
+ # - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#510].
3571
+ #
3572
+ # source://net-http//lib/net/http/responses.rb#1078
3573
+ class Net::HTTPNotExtended < ::Net::HTTPServerError; end
3574
+
3575
+ # source://net-http//lib/net/http/responses.rb#1079
3576
+ Net::HTTPNotExtended::HAS_BODY = T.let(T.unsafe(nil), TrueClass)
3577
+
3578
+ # Response class for <tt>Payload Too Large</tt> responses (status code 413).
3579
+ #
3580
+ # The request is larger than the server is willing or able to process.
3581
+ #
3582
+ # :include: doc/net-http/included_getters.rdoc
3583
+ #
3584
+ # References:
3585
+ #
3586
+ # - {Mozilla}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413].
3587
+ # - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#name-413-content-too-large].
3588
+ # - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#413].
3589
+ #
3590
+ # source://net-http//lib/net/http/responses.rb#688
3591
+ class Net::HTTPPayloadTooLarge < ::Net::HTTPClientError; end
3592
+
3593
+ # source://net-http//lib/net/http/responses.rb#689
3594
+ Net::HTTPPayloadTooLarge::HAS_BODY = T.let(T.unsafe(nil), TrueClass)
3595
+
3596
+ # Response class for +Processing+ responses (status code 102).
3597
+ #
3598
+ # The +Processing+ response indicates that the server has received
3599
+ # and is processing the request, but no response is available yet.
3600
+ #
3601
+ # :include: doc/net-http/included_getters.rdoc
3602
+ #
3603
+ # References:
3604
+ #
3605
+ # - {RFC 2518}[https://www.rfc-editor.org/rfc/rfc2518#section-10.1].
3606
+ # - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#102].
3607
+ #
3608
+ # source://net-http//lib/net/http/responses.rb#129
3609
+ class Net::HTTPProcessing < ::Net::HTTPInformation; end
3610
+
3611
+ # source://net-http//lib/net/http/responses.rb#130
3612
+ Net::HTTPProcessing::HAS_BODY = T.let(T.unsafe(nil), FalseClass)
3613
+
3614
+ # Response class for <tt>Range Not Satisfiable</tt> responses (status code 416).
3615
+ #
3616
+ # The request entity has a media type which the server or resource does not support.
3617
+ #
3618
+ # :include: doc/net-http/included_getters.rdoc
3619
+ #
3620
+ # References:
3621
+ #
3622
+ # - {Mozilla}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416].
3623
+ # - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#name-416-range-not-satisfiable].
3624
+ # - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#416].
3625
+ #
3626
+ # source://net-http//lib/net/http/responses.rb#739
3627
+ class Net::HTTPRangeNotSatisfiable < ::Net::HTTPClientError; end
3628
+
3629
+ # source://net-http//lib/net/http/responses.rb#740
3630
+ Net::HTTPRangeNotSatisfiable::HAS_BODY = T.let(T.unsafe(nil), TrueClass)
3631
+
3632
+ # source://net-http//lib/net/http/responses.rb#53
3633
+ Net::HTTPRedirection::EXCEPTION_TYPE = Net::HTTPRetriableError
3634
+
3635
+ # This class is the base class for \Net::HTTP request classes.
3636
+ # The class should not be used directly;
3637
+ # instead you should use its subclasses, listed below.
3638
+ #
3639
+ # == Creating a Request
3640
+ #
3641
+ # An request object may be created with either a URI or a string hostname:
3642
+ #
3643
+ # require 'net/http'
3644
+ # uri = URI('https://jsonplaceholder.typicode.com/')
3645
+ # req = Net::HTTP::Get.new(uri) # => #<Net::HTTP::Get GET>
3646
+ # req = Net::HTTP::Get.new(uri.hostname) # => #<Net::HTTP::Get GET>
3647
+ #
3648
+ # And with any of the subclasses:
3649
+ #
3650
+ # req = Net::HTTP::Head.new(uri) # => #<Net::HTTP::Head HEAD>
3651
+ # req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST>
3652
+ # req = Net::HTTP::Put.new(uri) # => #<Net::HTTP::Put PUT>
3653
+ # # ...
3654
+ #
3655
+ # The new instance is suitable for use as the argument to Net::HTTP#request.
3656
+ #
3657
+ # == Request Headers
3658
+ #
3659
+ # A new request object has these header fields by default:
3660
+ #
3661
+ # req.to_hash
3662
+ # # =>
3663
+ # {"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],
3664
+ # "accept"=>["*/*"],
3665
+ # "user-agent"=>["Ruby"],
3666
+ # "host"=>["jsonplaceholder.typicode.com"]}
3667
+ #
3668
+ # See:
3669
+ #
3670
+ # - {Request header Accept-Encoding}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Accept-Encoding]
3671
+ # and {Compression and Decompression}[rdoc-ref:Net::HTTP@Compression+and+Decompression].
3672
+ # - {Request header Accept}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#accept-request-header].
3673
+ # - {Request header User-Agent}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#user-agent-request-header].
3674
+ # - {Request header Host}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#host-request-header].
3675
+ #
3676
+ # You can add headers or override default headers:
3677
+ #
3678
+ # # res = Net::HTTP::Get.new(uri, {'foo' => '0', 'bar' => '1'})
3679
+ #
3680
+ # This class (and therefore its subclasses) also includes (indirectly)
3681
+ # module Net::HTTPHeader, which gives access to its
3682
+ # {methods for setting headers}[rdoc-ref:Net::HTTPHeader@Setters].
3683
+ #
3684
+ # == Request Subclasses
3685
+ #
3686
+ # Subclasses for HTTP requests:
3687
+ #
3688
+ # - Net::HTTP::Get
3689
+ # - Net::HTTP::Head
3690
+ # - Net::HTTP::Post
3691
+ # - Net::HTTP::Put
3692
+ # - Net::HTTP::Delete
3693
+ # - Net::HTTP::Options
3694
+ # - Net::HTTP::Trace
3695
+ # - Net::HTTP::Patch
3696
+ #
3697
+ # Subclasses for WebDAV requests:
3698
+ #
3699
+ # - Net::HTTP::Propfind
3700
+ # - Net::HTTP::Proppatch
3701
+ # - Net::HTTP::Mkcol
3702
+ # - Net::HTTP::Copy
3703
+ # - Net::HTTP::Move
3704
+ # - Net::HTTP::Lock
3705
+ # - Net::HTTP::Unlock
3706
+ #
3707
+ # source://net-http//lib/net/http/request.rb#75
3708
+ class Net::HTTPRequest < ::Net::HTTPGenericRequest
3709
+ # Creates an HTTP request object for +path+.
3710
+ #
3711
+ # +initheader+ are the default headers to use. Net::HTTP adds
3712
+ # Accept-Encoding to enable compression of the response body unless
3713
+ # Accept-Encoding or Range are supplied in +initheader+.
3714
+ #
3715
+ # @return [HTTPRequest] a new instance of HTTPRequest
3716
+ #
3717
+ # source://net-http//lib/net/http/request.rb#82
3718
+ def initialize(path, initheader = T.unsafe(nil)); end
3719
+ end
3720
+
3721
+ # source://net-http//lib/net/http/responses.rb#709
3722
+ Net::HTTPRequestURITooLarge = Net::HTTPURITooLong
3723
+
3724
+ # This class is the base class for \Net::HTTP response classes.
3725
+ #
3726
+ # == About the Examples
3727
+ #
3728
+ # :include: doc/net-http/examples.rdoc
3729
+ #
3730
+ # == Returned Responses
3731
+ #
3732
+ # \Method Net::HTTP.get_response returns
3733
+ # an instance of one of the subclasses of \Net::HTTPResponse:
3734
+ #
3735
+ # Net::HTTP.get_response(uri)
3736
+ # # => #<Net::HTTPOK 200 OK readbody=true>
3737
+ # Net::HTTP.get_response(hostname, '/nosuch')
3738
+ # # => #<Net::HTTPNotFound 404 Not Found readbody=true>
3739
+ #
3740
+ # As does method Net::HTTP#request:
3741
+ #
3742
+ # req = Net::HTTP::Get.new(uri)
3743
+ # Net::HTTP.start(hostname) do |http|
3744
+ # http.request(req)
3745
+ # end # => #<Net::HTTPOK 200 OK readbody=true>
3746
+ #
3747
+ # \Class \Net::HTTPResponse includes module Net::HTTPHeader,
3748
+ # which provides access to response header values via (among others):
3749
+ #
3750
+ # - \Hash-like method <tt>[]</tt>.
3751
+ # - Specific reader methods, such as +content_type+.
3752
+ #
3753
+ # Examples:
3754
+ #
3755
+ # res = Net::HTTP.get_response(uri) # => #<Net::HTTPOK 200 OK readbody=true>
3756
+ # res['Content-Type'] # => "text/html; charset=UTF-8"
3757
+ # res.content_type # => "text/html"
3758
+ #
3759
+ # == Response Subclasses
3760
+ #
3761
+ # \Class \Net::HTTPResponse has a subclass for each
3762
+ # {HTTP status code}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes].
3763
+ # You can look up the response class for a given code:
3764
+ #
3765
+ # Net::HTTPResponse::CODE_TO_OBJ['200'] # => Net::HTTPOK
3766
+ # Net::HTTPResponse::CODE_TO_OBJ['400'] # => Net::HTTPBadRequest
3767
+ # Net::HTTPResponse::CODE_TO_OBJ['404'] # => Net::HTTPNotFound
3768
+ #
3769
+ # And you can retrieve the status code for a response object:
3770
+ #
3771
+ # Net::HTTP.get_response(uri).code # => "200"
3772
+ # Net::HTTP.get_response(hostname, '/nosuch').code # => "404"
3773
+ #
3774
+ # The response subclasses (indentation shows class hierarchy):
3775
+ #
3776
+ # - Net::HTTPUnknownResponse (for unhandled \HTTP extensions).
3777
+ #
3778
+ # - Net::HTTPInformation:
3779
+ #
3780
+ # - Net::HTTPContinue (100)
3781
+ # - Net::HTTPSwitchProtocol (101)
3782
+ # - Net::HTTPProcessing (102)
3783
+ # - Net::HTTPEarlyHints (103)
3784
+ #
3785
+ # - Net::HTTPSuccess:
3786
+ #
3787
+ # - Net::HTTPOK (200)
3788
+ # - Net::HTTPCreated (201)
3789
+ # - Net::HTTPAccepted (202)
3790
+ # - Net::HTTPNonAuthoritativeInformation (203)
3791
+ # - Net::HTTPNoContent (204)
3792
+ # - Net::HTTPResetContent (205)
3793
+ # - Net::HTTPPartialContent (206)
3794
+ # - Net::HTTPMultiStatus (207)
3795
+ # - Net::HTTPAlreadyReported (208)
3796
+ # - Net::HTTPIMUsed (226)
3797
+ #
3798
+ # - Net::HTTPRedirection:
3799
+ #
3800
+ # - Net::HTTPMultipleChoices (300)
3801
+ # - Net::HTTPMovedPermanently (301)
3802
+ # - Net::HTTPFound (302)
3803
+ # - Net::HTTPSeeOther (303)
3804
+ # - Net::HTTPNotModified (304)
3805
+ # - Net::HTTPUseProxy (305)
3806
+ # - Net::HTTPTemporaryRedirect (307)
3807
+ # - Net::HTTPPermanentRedirect (308)
3808
+ #
3809
+ # - Net::HTTPClientError:
3810
+ #
3811
+ # - Net::HTTPBadRequest (400)
3812
+ # - Net::HTTPUnauthorized (401)
3813
+ # - Net::HTTPPaymentRequired (402)
3814
+ # - Net::HTTPForbidden (403)
3815
+ # - Net::HTTPNotFound (404)
3816
+ # - Net::HTTPMethodNotAllowed (405)
3817
+ # - Net::HTTPNotAcceptable (406)
3818
+ # - Net::HTTPProxyAuthenticationRequired (407)
3819
+ # - Net::HTTPRequestTimeOut (408)
3820
+ # - Net::HTTPConflict (409)
3821
+ # - Net::HTTPGone (410)
3822
+ # - Net::HTTPLengthRequired (411)
3823
+ # - Net::HTTPPreconditionFailed (412)
3824
+ # - Net::HTTPRequestEntityTooLarge (413)
3825
+ # - Net::HTTPRequestURITooLong (414)
3826
+ # - Net::HTTPUnsupportedMediaType (415)
3827
+ # - Net::HTTPRequestedRangeNotSatisfiable (416)
3828
+ # - Net::HTTPExpectationFailed (417)
3829
+ # - Net::HTTPMisdirectedRequest (421)
3830
+ # - Net::HTTPUnprocessableEntity (422)
3831
+ # - Net::HTTPLocked (423)
3832
+ # - Net::HTTPFailedDependency (424)
3833
+ # - Net::HTTPUpgradeRequired (426)
3834
+ # - Net::HTTPPreconditionRequired (428)
3835
+ # - Net::HTTPTooManyRequests (429)
3836
+ # - Net::HTTPRequestHeaderFieldsTooLarge (431)
3837
+ # - Net::HTTPUnavailableForLegalReasons (451)
3838
+ #
3839
+ # - Net::HTTPServerError:
3840
+ #
3841
+ # - Net::HTTPInternalServerError (500)
3842
+ # - Net::HTTPNotImplemented (501)
3843
+ # - Net::HTTPBadGateway (502)
3844
+ # - Net::HTTPServiceUnavailable (503)
3845
+ # - Net::HTTPGatewayTimeOut (504)
3846
+ # - Net::HTTPVersionNotSupported (505)
3847
+ # - Net::HTTPVariantAlsoNegotiates (506)
3848
+ # - Net::HTTPInsufficientStorage (507)
3849
+ # - Net::HTTPLoopDetected (508)
3850
+ # - Net::HTTPNotExtended (510)
3851
+ # - Net::HTTPNetworkAuthenticationRequired (511)
3852
+ #
3853
+ # There is also the Net::HTTPBadResponse exception which is raised when
3854
+ # there is a protocol error.
3855
+ #
3856
+ # source://net-http//lib/net/http/response.rb#135
3857
+ class Net::HTTPResponse
3858
+ include ::Net::HTTPHeader
3859
+
3860
+ # @return [HTTPResponse] a new instance of HTTPResponse
3861
+ #
3862
+ # source://net-http//lib/net/http/response.rb#194
3863
+ def initialize(httpv, code, msg); end
3864
+
3865
+ # Returns the string response body;
3866
+ # note that repeated calls for the unmodified body return a cached string:
3867
+ #
3868
+ # path = '/todos/1'
3869
+ # Net::HTTP.start(hostname) do |http|
3870
+ # res = http.get(path)
3871
+ # p res.body
3872
+ # p http.head(path).body # No body.
3873
+ # end
3874
+ #
3875
+ # Output:
3876
+ #
3877
+ # "{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false\n}"
3878
+ # nil
3879
+ #
3880
+ # source://net-http//lib/net/http/response.rb#400
3881
+ def body; end
3882
+
3883
+ # Sets the body of the response to the given value.
3884
+ #
3885
+ # source://net-http//lib/net/http/response.rb#405
3886
+ def body=(value); end
3887
+
3888
+ # Returns the value set by body_encoding=, or +false+ if none;
3889
+ # see #body_encoding=.
3890
+ #
3891
+ # source://net-http//lib/net/http/response.rb#229
3892
+ def body_encoding; end
3893
+
3894
+ # Sets the encoding that should be used when reading the body:
3895
+ #
3896
+ # - If the given value is an Encoding object, that encoding will be used.
3897
+ # - Otherwise if the value is a string, the value of
3898
+ # {Encoding#find(value)}[https://docs.ruby-lang.org/en/master/Encoding.html#method-c-find]
3899
+ # will be used.
3900
+ # - Otherwise an encoding will be deduced from the body itself.
3901
+ #
3902
+ # Examples:
3903
+ #
3904
+ # http = Net::HTTP.new(hostname)
3905
+ # req = Net::HTTP::Get.new('/')
3906
+ #
3907
+ # http.request(req) do |res|
3908
+ # p res.body.encoding # => #<Encoding:ASCII-8BIT>
3909
+ # end
3910
+ #
3911
+ # http.request(req) do |res|
3912
+ # res.body_encoding = "UTF-8"
3913
+ # p res.body.encoding # => #<Encoding:UTF-8>
3914
+ # end
3915
+ #
3916
+ # source://net-http//lib/net/http/response.rb#253
3917
+ def body_encoding=(value); end
3918
+
3919
+ # The HTTP result code string. For example, '302'. You can also
3920
+ # determine the response type by examining which response subclass
3921
+ # the response object is an instance of.
3922
+ #
3923
+ # source://net-http//lib/net/http/response.rb#213
3924
+ def code; end
3925
+
3926
+ # response <-> exception relationship
3927
+ #
3928
+ # source://net-http//lib/net/http/response.rb#270
3929
+ def code_type; end
3930
+
3931
+ # Set to true automatically when the request did not contain an
3932
+ # Accept-Encoding header from the user.
3933
+ #
3934
+ # source://net-http//lib/net/http/response.rb#225
3935
+ def decode_content; end
3936
+
3937
+ # Set to true automatically when the request did not contain an
3938
+ # Accept-Encoding header from the user.
3939
+ #
3940
+ # source://net-http//lib/net/http/response.rb#225
3941
+ def decode_content=(_arg0); end
3942
+
3943
+ # Returns the string response body;
3944
+ # note that repeated calls for the unmodified body return a cached string:
3945
+ #
3946
+ # path = '/todos/1'
3947
+ # Net::HTTP.start(hostname) do |http|
3948
+ # res = http.get(path)
3949
+ # p res.body
3950
+ # p http.head(path).body # No body.
3951
+ # end
3952
+ #
3953
+ # Output:
3954
+ #
3955
+ # "{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false\n}"
3956
+ # nil
3957
+ #
3958
+ # source://net-http//lib/net/http/response.rb#400
3959
+ def entity; end
3960
+
3961
+ # @raise [error_type()]
3962
+ #
3963
+ # source://net-http//lib/net/http/response.rb#274
3964
+ def error!; end
3965
+
3966
+ # source://net-http//lib/net/http/response.rb#280
3967
+ def error_type; end
3968
+
3969
+ # source://net-http//lib/net/http/response.rb#302
3970
+ def header; end
3971
+
3972
+ # The HTTP version supported by the server.
3973
+ #
3974
+ # source://net-http//lib/net/http/response.rb#208
3975
+ def http_version; end
3976
+
3977
+ # Whether to ignore EOF when reading bodies with a specified Content-Length
3978
+ # header.
3979
+ #
3980
+ # source://net-http//lib/net/http/response.rb#260
3981
+ def ignore_eof; end
3982
+
3983
+ # Whether to ignore EOF when reading bodies with a specified Content-Length
3984
+ # header.
3985
+ #
3986
+ # source://net-http//lib/net/http/response.rb#260
3987
+ def ignore_eof=(_arg0); end
3988
+
3989
+ # source://net-http//lib/net/http/response.rb#262
3990
+ def inspect; end
3991
+
3992
+ # The HTTP result message sent by the server. For example, 'Not Found'.
3993
+ #
3994
+ # source://net-http//lib/net/http/response.rb#216
3995
+ def message; end
3996
+
3997
+ # The HTTP result message sent by the server. For example, 'Not Found'.
3998
+ #
3999
+ # source://net-http//lib/net/http/response.rb#216
4000
+ def msg; end
4001
+
4002
+ # Gets the entity body returned by the remote HTTP server.
4003
+ #
4004
+ # If a block is given, the body is passed to the block, and
4005
+ # the body is provided in fragments, as it is read in from the socket.
4006
+ #
4007
+ # If +dest+ argument is given, response is read into that variable,
4008
+ # with <code>dest#<<</code> method (it could be String or IO, or any
4009
+ # other object responding to <code><<</code>).
4010
+ #
4011
+ # Calling this method a second or subsequent time for the same
4012
+ # HTTPResponse object will return the value already read.
4013
+ #
4014
+ # http.request_get('/index.html') {|res|
4015
+ # puts res.read_body
4016
+ # }
4017
+ #
4018
+ # http.request_get('/index.html') {|res|
4019
+ # p res.read_body.object_id # 538149362
4020
+ # p res.read_body.object_id # 538149362
4021
+ # }
4022
+ #
4023
+ # # using iterator
4024
+ # http.request_get('/index.html') {|res|
4025
+ # res.read_body do |segment|
4026
+ # print segment
4027
+ # end
4028
+ # }
4029
+ #
4030
+ # source://net-http//lib/net/http/response.rb#355
4031
+ def read_body(dest = T.unsafe(nil), &block); end
4032
+
4033
+ # source://net-http//lib/net/http/response.rb#307
4034
+ def read_header; end
4035
+
4036
+ # body
4037
+ #
4038
+ # source://net-http//lib/net/http/response.rb#316
4039
+ def reading_body(sock, reqmethodallowbody); end
4040
+
4041
+ # header (for backward compatibility only; DO NOT USE)
4042
+ #
4043
+ # source://net-http//lib/net/http/response.rb#297
4044
+ def response; end
4045
+
4046
+ # The URI used to fetch this response. The response URI is only available
4047
+ # if a URI was used to create the request.
4048
+ #
4049
+ # source://net-http//lib/net/http/response.rb#221
4050
+ def uri; end
4051
+
4052
+ # source://net-http//lib/net/http/response.rb#289
4053
+ def uri=(uri); end
4054
+
4055
+ # Raises an HTTP error if the response is not 2xx (success).
4056
+ #
4057
+ # source://net-http//lib/net/http/response.rb#285
4058
+ def value; end
4059
+
4060
+ private
4061
+
4062
+ # source://net-http//lib/net/http/response.rb#450
4063
+ def check_bom(str); end
4064
+
4065
+ # source://net-http//lib/net/http/response.rb#414
4066
+ def detect_encoding(str, encoding = T.unsafe(nil)); end
4067
+
4068
+ # source://net-http//lib/net/http/response.rb#540
4069
+ def extracting_encodings_from_meta_elements(value); end
4070
+
4071
+ # source://net-http//lib/net/http/response.rb#505
4072
+ def get_attribute(ss); end
4073
+
4074
+ # Checks for a supported Content-Encoding header and yields an Inflate
4075
+ # wrapper for this response's socket when zlib is present. If the
4076
+ # Content-Encoding is not supported or zlib is missing, the plain socket is
4077
+ # yielded.
4078
+ #
4079
+ # If a Content-Range header is present, a plain socket is yielded as the
4080
+ # bytes in the range may not be a complete deflate block.
4081
+ #
4082
+ # source://net-http//lib/net/http/response.rb#557
4083
+ def inflater; end
4084
+
4085
+ # @raise [ArgumentError]
4086
+ #
4087
+ # source://net-http//lib/net/http/response.rb#646
4088
+ def procdest(dest, block); end
4089
+
4090
+ # source://net-http//lib/net/http/response.rb#592
4091
+ def read_body_0(dest); end
4092
+
4093
+ # read_chunked reads from +@socket+ for chunk-size, chunk-extension, CRLF,
4094
+ # etc. and +chunk_data_io+ for chunk-data which may be deflate or gzip
4095
+ # encoded.
4096
+ #
4097
+ # See RFC 2616 section 3.6.1 for definitions
4098
+ #
4099
+ # source://net-http//lib/net/http/response.rb#622
4100
+ def read_chunked(dest, chunk_data_io); end
4101
+
4102
+ # source://net-http//lib/net/http/response.rb#464
4103
+ def scanning_meta(str); end
4104
+
4105
+ # source://net-http//lib/net/http/response.rb#434
4106
+ def sniff_encoding(str, encoding = T.unsafe(nil)); end
4107
+
4108
+ # @raise [IOError]
4109
+ #
4110
+ # source://net-http//lib/net/http/response.rb#642
4111
+ def stream_check; end
4112
+
4113
+ class << self
4114
+ # true if the response has a body.
4115
+ #
4116
+ # @return [Boolean]
4117
+ #
4118
+ # source://net-http//lib/net/http/response.rb#138
4119
+ def body_permitted?; end
4120
+
4121
+ # source://net-http//lib/net/http/response.rb#142
4122
+ def exception_type; end
4123
+
4124
+ # source://net-http//lib/net/http/response.rb#146
4125
+ def read_new(sock); end
4126
+
4127
+ private
4128
+
4129
+ # @yield [key, value]
4130
+ #
4131
+ # source://net-http//lib/net/http/response.rb#170
4132
+ def each_response_header(sock); end
4133
+
4134
+ # source://net-http//lib/net/http/response.rb#157
4135
+ def read_status_line(sock); end
4136
+
4137
+ # source://net-http//lib/net/http/response.rb#164
4138
+ def response_class(code); end
4139
+ end
4140
+ end
4141
+
4142
+ # Inflater is a wrapper around Net::BufferedIO that transparently inflates
4143
+ # zlib and gzip streams.
4144
+ #
4145
+ # source://net-http//lib/net/http/response.rb#660
4146
+ class Net::HTTPResponse::Inflater
4147
+ # Creates a new Inflater wrapping +socket+
4148
+ #
4149
+ # @return [Inflater] a new instance of Inflater
4150
+ #
4151
+ # source://net-http//lib/net/http/response.rb#665
4152
+ def initialize(socket); end
4153
+
4154
+ # The number of bytes inflated, used to update the Content-Length of
4155
+ # the response.
4156
+ #
4157
+ # source://net-http//lib/net/http/response.rb#683
4158
+ def bytes_inflated; end
4159
+
4160
+ # Finishes the inflate stream.
4161
+ #
4162
+ # source://net-http//lib/net/http/response.rb#674
4163
+ def finish; end
4164
+
4165
+ # Returns a Net::ReadAdapter that inflates each read chunk into +dest+.
4166
+ #
4167
+ # This allows a large response body to be inflated without storing the
4168
+ # entire body in memory.
4169
+ #
4170
+ # source://net-http//lib/net/http/response.rb#693
4171
+ def inflate_adapter(dest); end
4172
+
4173
+ # Reads +clen+ bytes from the socket, inflates them, then writes them to
4174
+ # +dest+. +ignore_eof+ is passed down to Net::BufferedIO#read
4175
+ #
4176
+ # Unlike Net::BufferedIO#read, this method returns more than +clen+ bytes.
4177
+ # At this time there is no way for a user of Net::HTTPResponse to read a
4178
+ # specific number of bytes from the HTTP response body, so this internal
4179
+ # API does not return the same number of bytes as were requested.
4180
+ #
4181
+ # See https://bugs.ruby-lang.org/issues/6492 for further discussion.
4182
+ #
4183
+ # source://net-http//lib/net/http/response.rb#720
4184
+ def read(clen, dest, ignore_eof = T.unsafe(nil)); end
4185
+
4186
+ # Reads the rest of the socket, inflates it, then writes it to +dest+.
4187
+ #
4188
+ # source://net-http//lib/net/http/response.rb#729
4189
+ def read_all(dest); end
4190
+ end
4191
+
4192
+ # source://net-http//lib/net/http/exceptions.rb#19
4193
+ class Net::HTTPRetriableError < ::Net::ProtoRetriableError
4194
+ include ::Net::HTTPExceptions
4195
+ end
4196
+
4197
+ # source://net-http//lib/net/http/responses.rb#81
4198
+ Net::HTTPServerError::EXCEPTION_TYPE = Net::HTTPFatalError
4199
+
4200
+ # for backward compatibility until Ruby 3.5
4201
+ # https://bugs.ruby-lang.org/issues/20900
4202
+ # https://github.com/bblimke/webmock/pull/1081
4203
+ #
4204
+ # source://net-http//lib/net/http.rb#2565
4205
+ Net::HTTPSession = Net::HTTP
4206
+
4207
+ # source://net-http//lib/net/http/responses.rb#38
4208
+ Net::HTTPSuccess::EXCEPTION_TYPE = Net::HTTPError
4209
+
4210
+ # Response class for <tt>URI Too Long</tt> responses (status code 414).
4211
+ #
4212
+ # The URI provided was too long for the server to process.
4213
+ #
4214
+ # :include: doc/net-http/included_getters.rdoc
4215
+ #
4216
+ # References:
4217
+ #
4218
+ # - {Mozilla}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/414].
4219
+ # - {RFC 9110}[https://www.rfc-editor.org/rfc/rfc9110.html#name-414-uri-too-long].
4220
+ # - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#414].
4221
+ #
4222
+ # source://net-http//lib/net/http/responses.rb#705
4223
+ class Net::HTTPURITooLong < ::Net::HTTPClientError; end
4224
+
4225
+ # source://net-http//lib/net/http/responses.rb#706
4226
+ Net::HTTPURITooLong::HAS_BODY = T.let(T.unsafe(nil), TrueClass)
4227
+
4228
+ # source://net-http//lib/net/http/responses.rb#9
4229
+ Net::HTTPUnknownResponse::EXCEPTION_TYPE = Net::HTTPError
4230
+
4231
+ # Response class for <tt>Variant Also Negotiates</tt> responses (status code 506).
4232
+ #
4233
+ # Transparent content negotiation for the request results in a circular reference.
4234
+ #
4235
+ # :include: doc/net-http/included_getters.rdoc
4236
+ #
4237
+ # References:
4238
+ #
4239
+ # - {Mozilla}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/506].
4240
+ # - {RFC 2295}[https://www.rfc-editor.org/rfc/rfc2295#section-8.1].
4241
+ # - {Wikipedia}[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#506].
4242
+ #
4243
+ # source://net-http//lib/net/http/responses.rb#1029
4244
+ class Net::HTTPVariantAlsoNegotiates < ::Net::HTTPServerError; end
4245
+
4246
+ # source://net-http//lib/net/http/responses.rb#1030
4247
+ Net::HTTPVariantAlsoNegotiates::HAS_BODY = T.let(T.unsafe(nil), TrueClass)