rbs 3.7.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/ruby.yml +7 -7
- data/CHANGELOG.md +68 -0
- data/core/array.rbs +1756 -1591
- data/core/basic_object.rbs +38 -35
- data/core/comparable.rbs +1 -1
- data/core/complex.rbs +166 -94
- data/core/data.rbs +1 -1
- data/core/dir.rbs +1 -17
- data/core/encoding.rbs +12 -32
- data/core/enumerable.rbs +270 -266
- data/core/enumerator.rbs +0 -2
- data/core/env.rbs +1 -1
- data/core/errno.rbs +33 -16
- data/core/errors.rbs +6 -2
- data/core/exception.rbs +235 -169
- data/core/fiber.rbs +3 -2
- data/core/file.rbs +26 -75
- data/core/float.rbs +125 -72
- data/core/gc.rbs +156 -40
- data/core/hash.rbs +122 -143
- data/core/integer.rbs +79 -50
- data/core/io/buffer.rbs +49 -43
- data/core/io.rbs +99 -146
- data/core/kernel.rbs +292 -202
- data/core/match_data.rbs +76 -2
- data/core/math.rbs +0 -36
- data/core/module.rbs +28 -23
- data/core/nil_class.rbs +2 -2
- data/core/numeric.rbs +101 -104
- data/core/object.rbs +0 -4
- data/core/object_space/weak_key_map.rbs +3 -4
- data/core/object_space.rbs +3 -3
- data/core/proc.rbs +80 -12
- data/core/process.rbs +109 -57
- data/core/ractor.rbs +54 -4
- data/core/range.rbs +114 -87
- data/core/rational.rbs +0 -2
- data/core/rbs/unnamed/argf.rbs +234 -33
- data/core/rbs/unnamed/env_class.rbs +35 -53
- data/core/rbs/unnamed/random.rbs +1 -2
- data/core/regexp.rbs +6 -54
- data/core/ruby_vm.rbs +88 -9
- data/core/rubygems/config_file.rbs +3 -0
- data/core/rubygems/errors.rbs +3 -6
- data/core/rubygems/platform.rbs +0 -9
- data/core/rubygems/rubygems.rbs +3 -6
- data/core/rubygems/version.rbs +6 -6
- data/core/set.rbs +3 -15
- data/core/string.rbs +256 -260
- data/core/struct.rbs +6 -18
- data/core/symbol.rbs +14 -21
- data/core/thread.rbs +32 -35
- data/core/time.rbs +131 -50
- data/core/trace_point.rbs +124 -113
- data/core/true_class.rbs +0 -1
- data/core/warning.rbs +9 -2
- data/docs/architecture.md +1 -1
- data/docs/syntax.md +1 -1
- data/ext/rbs_extension/location.c +29 -19
- data/ext/rbs_extension/parser.c +268 -293
- data/ext/rbs_extension/parserstate.c +56 -22
- data/lib/rbs/annotate/annotations.rb +3 -3
- data/lib/rbs/annotate/rdoc_source.rb +2 -2
- data/lib/rbs/cli/diff.rb +3 -3
- data/lib/rbs/cli/validate.rb +1 -1
- data/lib/rbs/cli.rb +13 -13
- data/lib/rbs/collection/config.rb +3 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +3 -3
- data/lib/rbs/environment_loader.rb +1 -1
- data/lib/rbs/namespace.rb +1 -0
- data/lib/rbs/parser_aux.rb +2 -2
- data/lib/rbs/prototype/rb.rb +11 -8
- data/lib/rbs/prototype/rbi.rb +9 -5
- data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
- data/lib/rbs/prototype/runtime.rb +4 -5
- data/lib/rbs/type_name.rb +14 -9
- data/lib/rbs/types.rb +2 -1
- data/lib/rbs/unit_test/type_assertions.rb +2 -2
- data/lib/rbs/validator.rb +3 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +2 -2
- data/rbs.gemspec +4 -0
- data/sig/ancestor_graph.rbs +4 -4
- data/sig/namespace.rbs +2 -3
- data/sig/resolver/constant_resolver.rbs +2 -2
- data/sig/resolver/context.rbs +1 -1
- data/sig/type_alias_regularity.rbs +5 -5
- data/sig/typename.rbs +8 -5
- data/sig/use_map.rbs +1 -1
- data/sig/validator.rbs +2 -2
- data/stdlib/base64/0/base64.rbs +0 -9
- data/stdlib/benchmark/0/benchmark.rbs +11 -2
- data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
- data/stdlib/cgi/0/core.rbs +47 -0
- data/stdlib/coverage/0/coverage.rbs +0 -3
- data/stdlib/csv/0/csv.rbs +18 -58
- data/stdlib/date/0/date.rbs +27 -42
- data/stdlib/did_you_mean/0/did_you_mean.rbs +0 -5
- data/stdlib/digest/0/digest.rbs +25 -2
- data/stdlib/erb/0/erb.rbs +0 -1
- data/stdlib/etc/0/etc.rbs +51 -34
- data/stdlib/fileutils/0/fileutils.rbs +3 -44
- data/stdlib/io-console/0/io-console.rbs +69 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +8 -4
- data/stdlib/json/0/json.rbs +56 -71
- data/stdlib/logger/0/log_device.rbs +1 -1
- data/stdlib/logger/0/logger.rbs +3 -18
- data/stdlib/net-http/0/net-http.rbs +39 -106
- data/stdlib/nkf/0/nkf.rbs +30 -0
- data/stdlib/objspace/0/objspace.rbs +1 -2
- data/stdlib/observable/0/observable.rbs +1 -1
- data/stdlib/open-uri/0/open-uri.rbs +52 -0
- data/stdlib/open3/0/open3.rbs +0 -8
- data/stdlib/openssl/0/openssl.rbs +136 -69
- data/stdlib/optparse/0/optparse.rbs +58 -18
- data/stdlib/pathname/0/pathname.rbs +2 -8
- data/stdlib/pp/0/pp.rbs +3 -1
- data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
- data/stdlib/pstore/0/pstore.rbs +0 -6
- data/stdlib/psych/0/psych.rbs +15 -4
- data/stdlib/pty/0/pty.rbs +46 -4
- data/stdlib/rdoc/0/code_object.rbs +0 -4
- data/stdlib/rdoc/0/markup.rbs +10 -12
- data/stdlib/rdoc/0/rdoc.rbs +13 -8
- data/stdlib/resolv/0/resolv.rbs +13 -4
- data/stdlib/ripper/0/ripper.rbs +0 -2
- data/stdlib/securerandom/0/securerandom.rbs +7 -2
- data/stdlib/shellwords/0/shellwords.rbs +11 -12
- data/stdlib/singleton/0/singleton.rbs +0 -1
- data/stdlib/socket/0/addrinfo.rbs +0 -1
- data/stdlib/socket/0/basic_socket.rbs +0 -5
- data/stdlib/socket/0/socket.rbs +32 -27
- data/stdlib/socket/0/tcp_server.rbs +0 -3
- data/stdlib/socket/0/tcp_socket.rbs +36 -3
- data/stdlib/socket/0/udp_socket.rbs +0 -1
- data/stdlib/socket/0/unix_server.rbs +0 -3
- data/stdlib/strscan/0/string_scanner.rbs +1265 -422
- data/stdlib/tempfile/0/tempfile.rbs +135 -28
- data/stdlib/time/0/time.rbs +48 -35
- data/stdlib/timeout/0/timeout.rbs +11 -8
- data/stdlib/tmpdir/0/tmpdir.rbs +10 -3
- data/stdlib/tsort/0/tsort.rbs +0 -4
- data/stdlib/uri/0/common.rbs +11 -30
- data/stdlib/uri/0/ftp.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +22 -18
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
- data/stdlib/zlib/0/buf_error.rbs +1 -70
- data/stdlib/zlib/0/data_error.rbs +1 -70
- data/stdlib/zlib/0/deflate.rbs +8 -72
- data/stdlib/zlib/0/error.rbs +1 -70
- data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
- data/stdlib/zlib/0/gzip_file.rbs +1 -71
- data/stdlib/zlib/0/gzip_reader.rbs +3 -74
- data/stdlib/zlib/0/gzip_writer.rbs +1 -70
- data/stdlib/zlib/0/inflate.rbs +4 -71
- data/stdlib/zlib/0/mem_error.rbs +1 -70
- data/stdlib/zlib/0/need_dict.rbs +1 -70
- data/stdlib/zlib/0/stream_end.rbs +1 -70
- data/stdlib/zlib/0/stream_error.rbs +1 -70
- data/stdlib/zlib/0/version_error.rbs +1 -70
- data/stdlib/zlib/0/zlib.rbs +0 -2
- data/stdlib/zlib/0/zstream.rbs +4 -72
- metadata +3 -6
@@ -18,7 +18,6 @@ module Net
|
|
18
18
|
# overview](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Techni
|
19
19
|
# cal_overview).
|
20
20
|
#
|
21
|
-
#
|
22
21
|
# ## About the Examples
|
23
22
|
#
|
24
23
|
# Examples here assume that `net/http` has been required (which also requires
|
@@ -31,7 +30,6 @@ module Net
|
|
31
30
|
# * https://jsonplaceholder.typicode.com.
|
32
31
|
# * http://example.com.
|
33
32
|
#
|
34
|
-
#
|
35
33
|
# Some examples also assume these variables:
|
36
34
|
#
|
37
35
|
# uri = URI('https://jsonplaceholder.typicode.com/')
|
@@ -79,6 +77,8 @@ module Net
|
|
79
77
|
# Net::HTTP.post(uri, data)
|
80
78
|
# params = {title: 'foo', body: 'bar', userId: 1}
|
81
79
|
# Net::HTTP.post_form(uri, params)
|
80
|
+
# data = '{"title": "foo", "body": "bar", "userId": 1}'
|
81
|
+
# Net::HTTP.put(uri, data)
|
82
82
|
#
|
83
83
|
# * If performance is important, consider using sessions, which lower request
|
84
84
|
# overhead. This [session](rdoc-ref:Net::HTTP@Sessions) has multiple
|
@@ -108,7 +108,6 @@ module Net
|
|
108
108
|
# # Session finished automatically at block exit.
|
109
109
|
# end
|
110
110
|
#
|
111
|
-
#
|
112
111
|
# The methods cited above are convenience methods that, via their few arguments,
|
113
112
|
# allow minimal control over the requests. For greater control, consider using
|
114
113
|
# [request objects](rdoc-ref:Net::HTTPRequest).
|
@@ -196,7 +195,6 @@ module Net
|
|
196
195
|
# * May contain any number of requests.
|
197
196
|
# * Is ended by instance method Net::HTTP#finish.
|
198
197
|
#
|
199
|
-
#
|
200
198
|
# See example sessions at [Strategies](rdoc-ref:Net::HTTP@Strategies).
|
201
199
|
#
|
202
200
|
# ### Session Using Net::HTTP.start
|
@@ -209,7 +207,6 @@ module Net
|
|
209
207
|
# * Executing the block.
|
210
208
|
# * Calling #finish after block execution.
|
211
209
|
#
|
212
|
-
#
|
213
210
|
# In the block, you can use these instance methods, each of which that sends a
|
214
211
|
# single request:
|
215
212
|
#
|
@@ -225,7 +222,6 @@ module Net
|
|
225
222
|
# * #trace: TRACE.
|
226
223
|
# * #patch: PATCH.
|
227
224
|
#
|
228
|
-
#
|
229
225
|
# * [WebDAV methods](https://en.wikipedia.org/wiki/WebDAV#Implementation):
|
230
226
|
#
|
231
227
|
# * #copy: COPY.
|
@@ -236,8 +232,6 @@ module Net
|
|
236
232
|
# * #proppatch: PROPPATCH.
|
237
233
|
# * #unlock: UNLOCK.
|
238
234
|
#
|
239
|
-
#
|
240
|
-
#
|
241
235
|
# ### Session Using Net::HTTP.start and Net::HTTP.finish
|
242
236
|
#
|
243
237
|
# You can manage a session manually using methods #start and #finish:
|
@@ -259,20 +253,17 @@ module Net
|
|
259
253
|
# * Finishing the session.
|
260
254
|
# * Destroying the object.
|
261
255
|
#
|
262
|
-
#
|
263
256
|
# Such methods that send GET requests:
|
264
257
|
#
|
265
258
|
# * ::get: Returns the string response body.
|
266
259
|
# * ::get_print: Writes the string response body to $stdout.
|
267
260
|
# * ::get_response: Returns a Net::HTTPResponse object.
|
268
261
|
#
|
269
|
-
#
|
270
262
|
# Such methods that send POST requests:
|
271
263
|
#
|
272
264
|
# * ::post: Posts data to the host.
|
273
265
|
# * ::post_form: Posts form data to the host.
|
274
266
|
#
|
275
|
-
#
|
276
267
|
# ## HTTP Requests and Responses
|
277
268
|
#
|
278
269
|
# Many of the methods above are convenience methods, each of which sends a
|
@@ -285,7 +276,6 @@ module Net
|
|
285
276
|
# * Net::HTTPRequest.
|
286
277
|
# * Net::HTTPResponse.
|
287
278
|
#
|
288
|
-
#
|
289
279
|
# ## Following Redirection
|
290
280
|
#
|
291
281
|
# Each returned response is an instance of a subclass of Net::HTTPResponse. See
|
@@ -453,7 +443,6 @@ module Net
|
|
453
443
|
# http = Net::HTTP.new('example.com', nil, 'my.proxy', 8000, 'pname', 'ppass', 'my.proxy,proxy.example:8000')
|
454
444
|
# http.proxy_address # => nil
|
455
445
|
#
|
456
|
-
#
|
457
446
|
# ## Compression and Decompression
|
458
447
|
#
|
459
448
|
# Net::HTTP does not compress the body of a request before sending.
|
@@ -480,9 +469,12 @@ module Net
|
|
480
469
|
# header.
|
481
470
|
# * Any other value: leaves the body and header unchanged.
|
482
471
|
#
|
483
|
-
#
|
484
472
|
# ## What's Here
|
485
473
|
#
|
474
|
+
# First, what's elsewhere. Class Net::HTTP:
|
475
|
+
#
|
476
|
+
# * Inherits from [class Object](rdoc-ref:Object@What-27s+Here).
|
477
|
+
#
|
486
478
|
# This is a categorized summary of methods and attributes.
|
487
479
|
#
|
488
480
|
# ### Net::HTTP Objects
|
@@ -491,18 +483,15 @@ module Net
|
|
491
483
|
# * [#inspect](rdoc-ref:Net::HTTP#inspect): Returns a string representation of
|
492
484
|
# `self`.
|
493
485
|
#
|
494
|
-
#
|
495
486
|
# ### Sessions
|
496
487
|
#
|
497
488
|
# * [::start](rdoc-ref:Net::HTTP.start): Begins a new session in a new
|
498
489
|
# Net::HTTP object.
|
499
|
-
# * [#started?](rdoc-ref:Net::HTTP#started?)
|
500
|
-
# [#active?](rdoc-ref:Net::HTTP#active?)): Returns whether in a session.
|
490
|
+
# * [#started?](rdoc-ref:Net::HTTP#started?): Returns whether in a session.
|
501
491
|
# * [#finish](rdoc-ref:Net::HTTP#finish): Ends an active session.
|
502
492
|
# * [#start](rdoc-ref:Net::HTTP#start): Begins a new session in an existing
|
503
493
|
# Net::HTTP object (`self`).
|
504
494
|
#
|
505
|
-
#
|
506
495
|
# ### Connections
|
507
496
|
#
|
508
497
|
# * [:continue_timeout](rdoc-ref:Net::HTTP#continue_timeout): Returns the
|
@@ -530,7 +519,6 @@ module Net
|
|
530
519
|
# * [write_timeout=](rdoc-ref:Net::HTTP#write_timeout=): Sets the write
|
531
520
|
# timeout.
|
532
521
|
#
|
533
|
-
#
|
534
522
|
# ### Requests
|
535
523
|
#
|
536
524
|
# * [::get](rdoc-ref:Net::HTTP.get): Sends a GET request and returns the
|
@@ -543,6 +531,8 @@ module Net
|
|
543
531
|
# form data and returns a response object.
|
544
532
|
# * [::post](rdoc-ref:Net::HTTP.post): Sends a POST request with data and
|
545
533
|
# returns a response object.
|
534
|
+
# * [::put](rdoc-ref:Net::HTTP.put): Sends a PUT request with data and returns
|
535
|
+
# a response object.
|
546
536
|
# * [#copy](rdoc-ref:Net::HTTP#copy): Sends a COPY request and returns a
|
547
537
|
# response object.
|
548
538
|
# * [#delete](rdoc-ref:Net::HTTP#delete): Sends a DELETE request and returns a
|
@@ -571,18 +561,15 @@ module Net
|
|
571
561
|
# object.
|
572
562
|
# * [#request](rdoc-ref:Net::HTTP#request): Sends a request and returns a
|
573
563
|
# response object.
|
574
|
-
# * [#request_get](rdoc-ref:Net::HTTP#request_get)
|
575
|
-
#
|
576
|
-
#
|
577
|
-
#
|
578
|
-
#
|
579
|
-
#
|
580
|
-
#
|
581
|
-
#
|
582
|
-
#
|
583
|
-
# [#post2](rdoc-ref:Net::HTTP#post2)): Sends a POST request and forms a
|
584
|
-
# response object; if a block given, calls the block with the object,
|
585
|
-
# otherwise returns the object.
|
564
|
+
# * [#request_get](rdoc-ref:Net::HTTP#request_get): Sends a GET request and
|
565
|
+
# forms a response object; if a block given, calls the block with the
|
566
|
+
# object, otherwise returns the object.
|
567
|
+
# * [#request_head](rdoc-ref:Net::HTTP#request_head): Sends a HEAD request and
|
568
|
+
# forms a response object; if a block given, calls the block with the
|
569
|
+
# object, otherwise returns the object.
|
570
|
+
# * [#request_post](rdoc-ref:Net::HTTP#request_post): Sends a POST request and
|
571
|
+
# forms a response object; if a block given, calls the block with the
|
572
|
+
# object, otherwise returns the object.
|
586
573
|
# * [#send_request](rdoc-ref:Net::HTTP#send_request): Sends a request and
|
587
574
|
# returns a response object.
|
588
575
|
# * [#trace](rdoc-ref:Net::HTTP#trace): Sends a TRACE request and returns a
|
@@ -590,7 +577,6 @@ module Net
|
|
590
577
|
# * [#unlock](rdoc-ref:Net::HTTP#unlock): Sends an UNLOCK request and returns
|
591
578
|
# a response object.
|
592
579
|
#
|
593
|
-
#
|
594
580
|
# ### Responses
|
595
581
|
#
|
596
582
|
# * [:close_on_empty_response](rdoc-ref:Net::HTTP#close_on_empty_response):
|
@@ -606,7 +592,6 @@ module Net
|
|
606
592
|
# * [#response_body_encoding=](rdoc-ref:Net::HTTP#response_body_encoding=):
|
607
593
|
# Sets the response body encoding.
|
608
594
|
#
|
609
|
-
#
|
610
595
|
# ### Proxies
|
611
596
|
#
|
612
597
|
# * [:proxy_address](rdoc-ref:Net::HTTP#proxy_address): Returns the proxy
|
@@ -616,8 +601,8 @@ module Net
|
|
616
601
|
# * [::proxy_class?](rdoc-ref:Net::HTTP.proxy_class?): Returns whether `self`
|
617
602
|
# is a proxy class.
|
618
603
|
# * [#proxy?](rdoc-ref:Net::HTTP#proxy?): Returns whether `self` has a proxy.
|
619
|
-
# * [#proxy_address](rdoc-ref:Net::HTTP#proxy_address)
|
620
|
-
#
|
604
|
+
# * [#proxy_address](rdoc-ref:Net::HTTP#proxy_address): Returns the proxy
|
605
|
+
# address.
|
621
606
|
# * [#proxy_from_env?](rdoc-ref:Net::HTTP#proxy_from_env?): Returns whether
|
622
607
|
# the proxy is taken from an environment variable.
|
623
608
|
# * [:proxy_from_env=](rdoc-ref:Net::HTTP#proxy_from_env=): Sets whether the
|
@@ -629,7 +614,6 @@ module Net
|
|
629
614
|
# * [#proxy_user](rdoc-ref:Net::HTTP#proxy_user): Returns the proxy user name.
|
630
615
|
# * [:proxy_user=](rdoc-ref:Net::HTTP#proxy_user=): Sets the proxy user.
|
631
616
|
#
|
632
|
-
#
|
633
617
|
# ### Security
|
634
618
|
#
|
635
619
|
# * [:ca_file](rdoc-ref:Net::HTTP#ca_file): Returns the path to a CA
|
@@ -694,7 +678,6 @@ module Net
|
|
694
678
|
# server the certification verification at the beginning of the SSL/TLS
|
695
679
|
# session.
|
696
680
|
#
|
697
|
-
#
|
698
681
|
# ### Addresses and Ports
|
699
682
|
#
|
700
683
|
# * [:address](rdoc-ref:Net::HTTP#address): Returns the string host name or
|
@@ -719,15 +702,12 @@ module Net
|
|
719
702
|
# port used to establish the connection.
|
720
703
|
# * [:port](rdoc-ref:Net::HTTP#port): Returns the integer port number.
|
721
704
|
#
|
722
|
-
#
|
723
705
|
# ### HTTP Version
|
724
706
|
#
|
725
707
|
# * [::version_1_2?](rdoc-ref:Net::HTTP.version_1_2?) (aliased as
|
726
|
-
# [::is_version_1_2?](rdoc-ref:Net::HTTP.is_version_1_2?) and
|
727
708
|
# [::version_1_2](rdoc-ref:Net::HTTP.version_1_2)): Returns true; retained
|
728
709
|
# for compatibility.
|
729
710
|
#
|
730
|
-
#
|
731
711
|
# ### Debugging
|
732
712
|
#
|
733
713
|
# * [#set_debug_output](rdoc-ref:Net::HTTP#set_debug_output): Sets the output
|
@@ -925,7 +905,6 @@ module Net
|
|
925
905
|
# Server](rdoc-ref:Net::HTTP@Proxy+Server).
|
926
906
|
# * For argument `opts`, see below.
|
927
907
|
#
|
928
|
-
#
|
929
908
|
# With no block given:
|
930
909
|
#
|
931
910
|
# * Calls `http.start` with no block (see #start), which opens a TCP
|
@@ -938,7 +917,6 @@ module Net
|
|
938
917
|
# http.finish
|
939
918
|
# http.started? # => false
|
940
919
|
#
|
941
|
-
#
|
942
920
|
# With a block given:
|
943
921
|
#
|
944
922
|
# * Calls `http.start` with the block (see #start), which:
|
@@ -948,10 +926,8 @@ module Net
|
|
948
926
|
# * Closes the HTTP session and TCP connection on block exit.
|
949
927
|
# * Returns the block's value `object`.
|
950
928
|
#
|
951
|
-
#
|
952
929
|
# * Returns `object`.
|
953
930
|
#
|
954
|
-
#
|
955
931
|
# Example:
|
956
932
|
#
|
957
933
|
# hostname = 'jsonplaceholder.typicode.com'
|
@@ -999,7 +975,6 @@ module Net
|
|
999
975
|
# * #verify_mode
|
1000
976
|
# * #write_timeout
|
1001
977
|
#
|
1002
|
-
#
|
1003
978
|
# Note: If `port` is `nil` and `opts[:use_ssl]` is a truthy value, the value
|
1004
979
|
# passed to `new` is Net::HTTP.https_default_port, not `port`.
|
1005
980
|
#
|
@@ -1015,7 +990,7 @@ module Net
|
|
1015
990
|
|
1016
991
|
# <!--
|
1017
992
|
# rdoc-file=lib/net/http.rb
|
1018
|
-
# - new(address, port = nil, p_addr = :ENV, p_port = nil, p_user = nil, p_pass = nil, p_no_proxy = nil)
|
993
|
+
# - new(address, port = nil, p_addr = :ENV, p_port = nil, p_user = nil, p_pass = nil, p_no_proxy = nil, p_use_ssl = nil)
|
1019
994
|
# -->
|
1020
995
|
# Returns a new Net::HTTP object `http` (but does not open a TCP connection or
|
1021
996
|
# HTTP session).
|
@@ -1027,7 +1002,6 @@ module Net
|
|
1027
1002
|
# * Has the default port number, Net::HTTP.default_port (80).
|
1028
1003
|
# * Has no proxy.
|
1029
1004
|
#
|
1030
|
-
#
|
1031
1005
|
# Example:
|
1032
1006
|
#
|
1033
1007
|
# http = Net::HTTP.new(hostname)
|
@@ -1380,16 +1354,15 @@ module Net
|
|
1380
1354
|
|
1381
1355
|
# <!-- rdoc-file=lib/net/http.rb -->
|
1382
1356
|
# Sets or returns the available SSL ciphers. See
|
1383
|
-
# [
|
1384
|
-
# 3D).
|
1357
|
+
# [:SSL::SSLContext#ciphers=](OpenSSL::SSL::SSL::Context#ciphers=).
|
1385
1358
|
#
|
1386
1359
|
attr_accessor ciphers: untyped
|
1387
1360
|
|
1388
1361
|
# <!-- rdoc-file=lib/net/http.rb -->
|
1389
1362
|
# Sets or returns the extra X509 certificates to be added to the certificate
|
1390
1363
|
# chain. See
|
1391
|
-
# [
|
1392
|
-
#
|
1364
|
+
# [:SSL::SSLContext#add_certificate](OpenSSL::SSL::SSL::Context#add_certificate)
|
1365
|
+
# .
|
1393
1366
|
#
|
1394
1367
|
attr_accessor extra_chain_cert: untyped
|
1395
1368
|
|
@@ -1405,22 +1378,19 @@ module Net
|
|
1405
1378
|
|
1406
1379
|
# <!-- rdoc-file=lib/net/http.rb -->
|
1407
1380
|
# Sets or returns the SSL version. See
|
1408
|
-
# [
|
1409
|
-
# version-3D).
|
1381
|
+
# [:SSL::SSLContext#ssl_version=](OpenSSL::SSL::SSL::Context#ssl_version=).
|
1410
1382
|
#
|
1411
1383
|
attr_accessor ssl_version: untyped
|
1412
1384
|
|
1413
1385
|
# <!-- rdoc-file=lib/net/http.rb -->
|
1414
1386
|
# Sets or returns the minimum SSL version. See
|
1415
|
-
# [
|
1416
|
-
# version-3D).
|
1387
|
+
# [:SSL::SSLContext#min_version=](OpenSSL::SSL::SSL::Context#min_version=).
|
1417
1388
|
#
|
1418
1389
|
attr_accessor min_version: untyped
|
1419
1390
|
|
1420
1391
|
# <!-- rdoc-file=lib/net/http.rb -->
|
1421
1392
|
# Sets or returns the maximum SSL version. See
|
1422
|
-
# [
|
1423
|
-
# version-3D).
|
1393
|
+
# [:SSL::SSLContext#max_version=](OpenSSL::SSL::SSL::Context#max_version=).
|
1424
1394
|
#
|
1425
1395
|
attr_accessor max_version: untyped
|
1426
1396
|
|
@@ -1444,8 +1414,8 @@ module Net
|
|
1444
1414
|
# <!-- rdoc-file=lib/net/http.rb -->
|
1445
1415
|
# Sets or returns whether to verify that the server certificate is valid for the
|
1446
1416
|
# hostname. See
|
1447
|
-
# [
|
1448
|
-
#
|
1417
|
+
# [:SSL::SSLContext#verify_hostname=](OpenSSL::SSL::SSL::Context#verify_hostname
|
1418
|
+
# =).
|
1449
1419
|
#
|
1450
1420
|
attr_accessor verify_hostname: untyped
|
1451
1421
|
|
@@ -1706,6 +1676,11 @@ module Net
|
|
1706
1676
|
# http = Net::HTTP.new(hostname)
|
1707
1677
|
# http.put('/todos/1', data) # => #<Net::HTTPOK 200 OK readbody=true>
|
1708
1678
|
#
|
1679
|
+
# Related:
|
1680
|
+
#
|
1681
|
+
# * Net::HTTP::Put: request class for HTTP method PUT.
|
1682
|
+
# * Net::HTTP.put: sends PUT request, returns response body.
|
1683
|
+
#
|
1709
1684
|
def put: (String path, String data, ?headers initheader) -> Net::HTTPResponse
|
1710
1685
|
|
1711
1686
|
# <!--
|
@@ -2040,7 +2015,6 @@ module Net
|
|
2040
2015
|
# * https://jsonplaceholder.typicode.com.
|
2041
2016
|
# * http://example.com.
|
2042
2017
|
#
|
2043
|
-
#
|
2044
2018
|
# Some examples also assume these variables:
|
2045
2019
|
#
|
2046
2020
|
# uri = URI('https://jsonplaceholder.typicode.com/')
|
@@ -2208,7 +2182,6 @@ module Net
|
|
2208
2182
|
# * Net::HTTPGenericRequest (and therefore Net::HTTPRequest).
|
2209
2183
|
# * Net::HTTPResponse.
|
2210
2184
|
#
|
2211
|
-
#
|
2212
2185
|
# The headers are a hash-like collection of key/value pairs called *fields*.
|
2213
2186
|
#
|
2214
2187
|
# ## Request and Response Fields
|
@@ -2223,7 +2196,6 @@ module Net
|
|
2223
2196
|
# [Getters](rdoc-ref:Net::HTTPHeader@Getters) and
|
2224
2197
|
# [Iterators](rdoc-ref:Net::HTTPHeader@Iterators).
|
2225
2198
|
#
|
2226
|
-
#
|
2227
2199
|
# Exactly which fields should be sent or expected depends on the host; see:
|
2228
2200
|
#
|
2229
2201
|
# * [Request
|
@@ -2233,7 +2205,6 @@ module Net
|
|
2233
2205
|
# fields](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_
|
2234
2206
|
# fields).
|
2235
2207
|
#
|
2236
|
-
#
|
2237
2208
|
# ## About the Examples
|
2238
2209
|
#
|
2239
2210
|
# Examples here assume that `net/http` has been required (which also requires
|
@@ -2246,7 +2217,6 @@ module Net
|
|
2246
2217
|
# * https://jsonplaceholder.typicode.com.
|
2247
2218
|
# * http://example.com.
|
2248
2219
|
#
|
2249
|
-
#
|
2250
2220
|
# Some examples also assume these variables:
|
2251
2221
|
#
|
2252
2222
|
# uri = URI('https://jsonplaceholder.typicode.com/')
|
@@ -2283,7 +2253,6 @@ module Net
|
|
2283
2253
|
# * A symbol: Key `:Accept` is treated as if it were `:Accept.to_s.downcase`;
|
2284
2254
|
# i.e., `'accept'`.
|
2285
2255
|
#
|
2286
|
-
#
|
2287
2256
|
# Examples:
|
2288
2257
|
#
|
2289
2258
|
# req = Net::HTTP::Get.new(uri)
|
@@ -2306,7 +2275,6 @@ module Net
|
|
2306
2275
|
# * #to_hash: Returns a hash of all header fields: each key is a field
|
2307
2276
|
# name; its value is the array value for the field.
|
2308
2277
|
#
|
2309
|
-
#
|
2310
2278
|
# * These methods return field values as string; the string value for a field
|
2311
2279
|
# is equivalent to `self[key.downcase.to_s].join(', '))`:
|
2312
2280
|
#
|
@@ -2315,8 +2283,6 @@ module Net
|
|
2315
2283
|
# * #fetch: Like #[], but accepts a default value to be returned if the
|
2316
2284
|
# key does not exist.
|
2317
2285
|
#
|
2318
|
-
#
|
2319
|
-
#
|
2320
2286
|
# The field value may be set:
|
2321
2287
|
#
|
2322
2288
|
# * #[]=: Sets the value for the given key; the given value may be a string, a
|
@@ -2325,7 +2291,6 @@ module Net
|
|
2325
2291
|
# overwriting the existing value).
|
2326
2292
|
# * #delete: Deletes the field for the given key.
|
2327
2293
|
#
|
2328
|
-
#
|
2329
2294
|
# Example field values:
|
2330
2295
|
#
|
2331
2296
|
# * String:
|
@@ -2362,7 +2327,6 @@ module Net
|
|
2362
2327
|
# req[:foo] # => "bar, baz, bat, bam, bah, 0, bad, 1"
|
2363
2328
|
# req.get_fields(:foo) # => ["bar", "baz", "bat", "bam", "bah", "0", "bad", "1"]
|
2364
2329
|
#
|
2365
|
-
#
|
2366
2330
|
# ## Convenience Methods
|
2367
2331
|
#
|
2368
2332
|
# Various convenience methods retrieve values, set values, query values, set
|
@@ -2382,13 +2346,11 @@ module Net
|
|
2382
2346
|
# `'Proxy-Authorization'`.
|
2383
2347
|
# * #set_range: Sets the value for field `'Range'`.
|
2384
2348
|
#
|
2385
|
-
#
|
2386
2349
|
# ### Form Setters
|
2387
2350
|
#
|
2388
2351
|
# * #set_form: Sets an HTML form data set.
|
2389
2352
|
# * #set_form_data: Sets header fields and a body from HTML form data.
|
2390
2353
|
#
|
2391
|
-
#
|
2392
2354
|
# ### Getters
|
2393
2355
|
#
|
2394
2356
|
# Method #[] can retrieve the value of any field that exists, but always as a
|
@@ -2410,7 +2372,6 @@ module Net
|
|
2410
2372
|
# `'Content-Range'`.
|
2411
2373
|
# * #type_params: Returns the string parameters for `'Content-Type'`.
|
2412
2374
|
#
|
2413
|
-
#
|
2414
2375
|
# ### Queries
|
2415
2376
|
#
|
2416
2377
|
# * #chunked?: Returns whether field `'Transfer-Encoding'` is set to
|
@@ -2421,7 +2382,6 @@ module Net
|
|
2421
2382
|
# `'keep-alive'`.
|
2422
2383
|
# * #key?: Returns whether a given key exists.
|
2423
2384
|
#
|
2424
|
-
#
|
2425
2385
|
# ### Iterators
|
2426
2386
|
#
|
2427
2387
|
# * #each_capitalized: Passes each field capitalized-name/value pair to the
|
@@ -3039,7 +2999,6 @@ module Net
|
|
3039
2999
|
# * A name/value pair.
|
3040
3000
|
# * An IO stream opened for reading.
|
3041
3001
|
#
|
3042
|
-
#
|
3043
3002
|
# Argument `params` should be an
|
3044
3003
|
# [Enumerable](rdoc-ref:Enumerable@Enumerable+in+Ruby+Classes) (method
|
3045
3004
|
# `params.map` will be called), and is often an array or hash.
|
@@ -3076,13 +3035,10 @@ module Net
|
|
3076
3035
|
# * `:filename`: The name of the file to use.
|
3077
3036
|
# * `:content_type`: The content type of the uploaded file.
|
3078
3037
|
#
|
3079
|
-
#
|
3080
3038
|
# Example:
|
3081
3039
|
#
|
3082
3040
|
# req.set_form([['file', file, {filename: "other-filename.foo"}]]
|
3083
3041
|
#
|
3084
|
-
#
|
3085
|
-
#
|
3086
3042
|
# The various forms may be mixed:
|
3087
3043
|
#
|
3088
3044
|
# req.set_form(['foo', %w[bar 1], ['file', file]])
|
@@ -3100,8 +3056,6 @@ module Net
|
|
3100
3056
|
# * An IO stream opened for reading (only when argument `enctype` -- see
|
3101
3057
|
# below -- is given as `'multipart/form-data'`).
|
3102
3058
|
#
|
3103
|
-
#
|
3104
|
-
#
|
3105
3059
|
# Examples:
|
3106
3060
|
#
|
3107
3061
|
# # Nil-valued fields.
|
@@ -3124,7 +3078,6 @@ module Net
|
|
3124
3078
|
# * `'multipart/form-data'`; see [RFC
|
3125
3079
|
# 7578](https://www.rfc-editor.org/rfc/rfc7578).
|
3126
3080
|
#
|
3127
|
-
#
|
3128
3081
|
# Optional argument `formopt` is a hash of options (applicable only when
|
3129
3082
|
# argument `enctype` is `'multipart/form-data'`) that may include the following
|
3130
3083
|
# entries:
|
@@ -3240,7 +3193,6 @@ module Net
|
|
3240
3193
|
# Host](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#host-reques
|
3241
3194
|
# t-header).
|
3242
3195
|
#
|
3243
|
-
#
|
3244
3196
|
# You can add headers or override default headers:
|
3245
3197
|
#
|
3246
3198
|
# # res = Net::HTTP::Get.new(uri, {'foo' => '0', 'bar' => '1'})
|
@@ -3262,7 +3214,6 @@ module Net
|
|
3262
3214
|
# * Net::HTTP::Trace
|
3263
3215
|
# * Net::HTTP::Patch
|
3264
3216
|
#
|
3265
|
-
#
|
3266
3217
|
# Subclasses for WebDAV requests:
|
3267
3218
|
#
|
3268
3219
|
# * Net::HTTP::Propfind
|
@@ -3314,7 +3265,6 @@ module Net
|
|
3314
3265
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3315
3266
|
# eable_methods): yes.
|
3316
3267
|
#
|
3317
|
-
#
|
3318
3268
|
# Related:
|
3319
3269
|
#
|
3320
3270
|
# * Net::HTTP.get: sends `GET` request, returns response body.
|
@@ -3354,7 +3304,6 @@ module Net
|
|
3354
3304
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3355
3305
|
# eable_methods): yes.
|
3356
3306
|
#
|
3357
|
-
#
|
3358
3307
|
# Related:
|
3359
3308
|
#
|
3360
3309
|
# * Net::HTTP#head: sends `HEAD` request, returns response object.
|
@@ -3396,7 +3345,6 @@ module Net
|
|
3396
3345
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3397
3346
|
# eable_methods): yes.
|
3398
3347
|
#
|
3399
|
-
#
|
3400
3348
|
# Related:
|
3401
3349
|
#
|
3402
3350
|
# * Net::HTTP.post: sends `POST` request, returns response object.
|
@@ -3439,6 +3387,11 @@ module Net
|
|
3439
3387
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3440
3388
|
# eable_methods): no.
|
3441
3389
|
#
|
3390
|
+
# Related:
|
3391
|
+
#
|
3392
|
+
# * Net::HTTP.put: sends `PUT` request, returns response object.
|
3393
|
+
# * Net::HTTP#put: sends `PUT` request, returns response object.
|
3394
|
+
#
|
3442
3395
|
class HTTP::Put < HTTPRequest
|
3443
3396
|
METHOD: String
|
3444
3397
|
|
@@ -3474,7 +3427,6 @@ module Net
|
|
3474
3427
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3475
3428
|
# eable_methods): no.
|
3476
3429
|
#
|
3477
|
-
#
|
3478
3430
|
# Related:
|
3479
3431
|
#
|
3480
3432
|
# * Net::HTTP#delete: sends `DELETE` request, returns response object.
|
@@ -3513,7 +3465,6 @@ module Net
|
|
3513
3465
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3514
3466
|
# eable_methods): no.
|
3515
3467
|
#
|
3516
|
-
#
|
3517
3468
|
# Related:
|
3518
3469
|
#
|
3519
3470
|
# * Net::HTTP#options: sends `OPTIONS` request, returns response object.
|
@@ -3552,7 +3503,6 @@ module Net
|
|
3552
3503
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3553
3504
|
# eable_methods): no.
|
3554
3505
|
#
|
3555
|
-
#
|
3556
3506
|
# Related:
|
3557
3507
|
#
|
3558
3508
|
# * Net::HTTP#trace: sends `TRACE` request, returns response object.
|
@@ -3594,7 +3544,6 @@ module Net
|
|
3594
3544
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3595
3545
|
# eable_methods): no.
|
3596
3546
|
#
|
3597
|
-
#
|
3598
3547
|
# Related:
|
3599
3548
|
#
|
3600
3549
|
# * Net::HTTP#patch: sends `PATCH` request, returns response object.
|
@@ -3804,7 +3753,6 @@ module Net
|
|
3804
3753
|
# * https://jsonplaceholder.typicode.com.
|
3805
3754
|
# * http://example.com.
|
3806
3755
|
#
|
3807
|
-
#
|
3808
3756
|
# Some examples also assume these variables:
|
3809
3757
|
#
|
3810
3758
|
# uri = URI('https://jsonplaceholder.typicode.com/')
|
@@ -3851,7 +3799,6 @@ module Net
|
|
3851
3799
|
# * Hash-like method `[]`.
|
3852
3800
|
# * Specific reader methods, such as `content_type`.
|
3853
3801
|
#
|
3854
|
-
#
|
3855
3802
|
# Examples:
|
3856
3803
|
#
|
3857
3804
|
# res = Net::HTTP.get_response(uri) # => #<Net::HTTPOK 200 OK readbody=true>
|
@@ -3884,7 +3831,6 @@ module Net
|
|
3884
3831
|
# * Net::HTTPProcessing (102)
|
3885
3832
|
# * Net::HTTPEarlyHints (103)
|
3886
3833
|
#
|
3887
|
-
#
|
3888
3834
|
# * Net::HTTPSuccess:
|
3889
3835
|
#
|
3890
3836
|
# * Net::HTTPOK (200)
|
@@ -3898,7 +3844,6 @@ module Net
|
|
3898
3844
|
# * Net::HTTPAlreadyReported (208)
|
3899
3845
|
# * Net::HTTPIMUsed (226)
|
3900
3846
|
#
|
3901
|
-
#
|
3902
3847
|
# * Net::HTTPRedirection:
|
3903
3848
|
#
|
3904
3849
|
# * Net::HTTPMultipleChoices (300)
|
@@ -3910,7 +3855,6 @@ module Net
|
|
3910
3855
|
# * Net::HTTPTemporaryRedirect (307)
|
3911
3856
|
# * Net::HTTPPermanentRedirect (308)
|
3912
3857
|
#
|
3913
|
-
#
|
3914
3858
|
# * Net::HTTPClientError:
|
3915
3859
|
#
|
3916
3860
|
# * Net::HTTPBadRequest (400)
|
@@ -3941,7 +3885,6 @@ module Net
|
|
3941
3885
|
# * Net::HTTPRequestHeaderFieldsTooLarge (431)
|
3942
3886
|
# * Net::HTTPUnavailableForLegalReasons (451)
|
3943
3887
|
#
|
3944
|
-
#
|
3945
3888
|
# * Net::HTTPServerError:
|
3946
3889
|
#
|
3947
3890
|
# * Net::HTTPInternalServerError (500)
|
@@ -3956,8 +3899,6 @@ module Net
|
|
3956
3899
|
# * Net::HTTPNotExtended (510)
|
3957
3900
|
# * Net::HTTPNetworkAuthenticationRequired (511)
|
3958
3901
|
#
|
3959
|
-
#
|
3960
|
-
#
|
3961
3902
|
# There is also the Net::HTTPBadResponse exception which is raised when there is
|
3962
3903
|
# a protocol error.
|
3963
3904
|
#
|
@@ -5423,7 +5364,6 @@ module Net
|
|
5423
5364
|
# * https://jsonplaceholder.typicode.com.
|
5424
5365
|
# * http://example.com.
|
5425
5366
|
#
|
5426
|
-
#
|
5427
5367
|
# Some examples also assume these variables:
|
5428
5368
|
#
|
5429
5369
|
# uri = URI('https://jsonplaceholder.typicode.com/')
|
@@ -5470,7 +5410,6 @@ module Net
|
|
5470
5410
|
# * Hash-like method `[]`.
|
5471
5411
|
# * Specific reader methods, such as `content_type`.
|
5472
5412
|
#
|
5473
|
-
#
|
5474
5413
|
# Examples:
|
5475
5414
|
#
|
5476
5415
|
# res = Net::HTTP.get_response(uri) # => #<Net::HTTPOK 200 OK readbody=true>
|
@@ -5503,7 +5442,6 @@ module Net
|
|
5503
5442
|
# * Net::HTTPProcessing (102)
|
5504
5443
|
# * Net::HTTPEarlyHints (103)
|
5505
5444
|
#
|
5506
|
-
#
|
5507
5445
|
# * Net::HTTPSuccess:
|
5508
5446
|
#
|
5509
5447
|
# * Net::HTTPOK (200)
|
@@ -5517,7 +5455,6 @@ module Net
|
|
5517
5455
|
# * Net::HTTPAlreadyReported (208)
|
5518
5456
|
# * Net::HTTPIMUsed (226)
|
5519
5457
|
#
|
5520
|
-
#
|
5521
5458
|
# * Net::HTTPRedirection:
|
5522
5459
|
#
|
5523
5460
|
# * Net::HTTPMultipleChoices (300)
|
@@ -5529,7 +5466,6 @@ module Net
|
|
5529
5466
|
# * Net::HTTPTemporaryRedirect (307)
|
5530
5467
|
# * Net::HTTPPermanentRedirect (308)
|
5531
5468
|
#
|
5532
|
-
#
|
5533
5469
|
# * Net::HTTPClientError:
|
5534
5470
|
#
|
5535
5471
|
# * Net::HTTPBadRequest (400)
|
@@ -5560,7 +5496,6 @@ module Net
|
|
5560
5496
|
# * Net::HTTPRequestHeaderFieldsTooLarge (431)
|
5561
5497
|
# * Net::HTTPUnavailableForLegalReasons (451)
|
5562
5498
|
#
|
5563
|
-
#
|
5564
5499
|
# * Net::HTTPServerError:
|
5565
5500
|
#
|
5566
5501
|
# * Net::HTTPInternalServerError (500)
|
@@ -5575,8 +5510,6 @@ module Net
|
|
5575
5510
|
# * Net::HTTPNotExtended (510)
|
5576
5511
|
# * Net::HTTPNetworkAuthenticationRequired (511)
|
5577
5512
|
#
|
5578
|
-
#
|
5579
|
-
#
|
5580
5513
|
# There is also the Net::HTTPBadResponse exception which is raised when there is
|
5581
5514
|
# a protocol error.
|
5582
5515
|
#
|