rbs 3.7.0 → 3.8.0.pre.1
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 +52 -0
- data/core/array.rbs +1743 -1580
- data/core/basic_object.rbs +38 -35
- data/core/comparable.rbs +1 -1
- data/core/complex.rbs +165 -93
- data/core/data.rbs +1 -1
- data/core/dir.rbs +1 -17
- data/core/encoding.rbs +12 -6
- 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 +2 -2
- data/core/exception.rbs +236 -170
- data/core/fiber.rbs +3 -2
- data/core/file.rbs +32 -74
- data/core/float.rbs +125 -72
- data/core/gc.rbs +138 -40
- data/core/hash.rbs +120 -141
- data/core/integer.rbs +79 -50
- data/core/io/buffer.rbs +49 -43
- data/core/io.rbs +97 -144
- data/core/kernel.rbs +290 -200
- data/core/match_data.rbs +76 -2
- data/core/math.rbs +0 -36
- data/core/module.rbs +28 -23
- data/core/nil_class.rbs +0 -3
- data/core/numeric.rbs +100 -103
- 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 +0 -2
- data/core/process.rbs +109 -57
- data/core/ractor.rbs +37 -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 +4 -52
- data/core/ruby_vm.rbs +88 -9
- data/core/rubygems/config_file.rbs +3 -0
- data/core/rubygems/errors.rbs +0 -5
- data/core/rubygems/platform.rbs +0 -9
- data/core/rubygems/rubygems.rbs +0 -5
- data/core/rubygems/version.rbs +6 -6
- data/core/set.rbs +3 -15
- data/core/string.rbs +130 -136
- data/core/struct.rbs +6 -18
- data/core/symbol.rbs +14 -21
- data/core/thread.rbs +32 -35
- data/core/time.rbs +127 -50
- data/core/trace_point.rbs +16 -0
- 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 +267 -292
- 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/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 +4 -19
- 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 +19 -77
- 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 +1 -2
- data/stdlib/resolv/0/resolv.rbs +8 -3
- data/stdlib/ripper/0/ripper.rbs +0 -2
- data/stdlib/securerandom/0/securerandom.rbs +0 -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 +49 -25
- data/stdlib/socket/0/tcp_server.rbs +0 -3
- data/stdlib/socket/0/tcp_socket.rbs +58 -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 +8 -1
- 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 +4 -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,7 +483,6 @@ 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
|
@@ -502,7 +493,6 @@ module Net
|
|
502
493
|
# * [#start](rdoc-ref:Net::HTTP#start): Begins a new session in an existing
|
503
494
|
# Net::HTTP object (`self`).
|
504
495
|
#
|
505
|
-
#
|
506
496
|
# ### Connections
|
507
497
|
#
|
508
498
|
# * [:continue_timeout](rdoc-ref:Net::HTTP#continue_timeout): Returns the
|
@@ -530,7 +520,6 @@ module Net
|
|
530
520
|
# * [write_timeout=](rdoc-ref:Net::HTTP#write_timeout=): Sets the write
|
531
521
|
# timeout.
|
532
522
|
#
|
533
|
-
#
|
534
523
|
# ### Requests
|
535
524
|
#
|
536
525
|
# * [::get](rdoc-ref:Net::HTTP.get): Sends a GET request and returns the
|
@@ -543,6 +532,8 @@ module Net
|
|
543
532
|
# form data and returns a response object.
|
544
533
|
# * [::post](rdoc-ref:Net::HTTP.post): Sends a POST request with data and
|
545
534
|
# returns a response object.
|
535
|
+
# * [::put](rdoc-ref:Net::HTTP.put): Sends a PUT request with data and returns
|
536
|
+
# a response object.
|
546
537
|
# * [#copy](rdoc-ref:Net::HTTP#copy): Sends a COPY request and returns a
|
547
538
|
# response object.
|
548
539
|
# * [#delete](rdoc-ref:Net::HTTP#delete): Sends a DELETE request and returns a
|
@@ -590,7 +581,6 @@ module Net
|
|
590
581
|
# * [#unlock](rdoc-ref:Net::HTTP#unlock): Sends an UNLOCK request and returns
|
591
582
|
# a response object.
|
592
583
|
#
|
593
|
-
#
|
594
584
|
# ### Responses
|
595
585
|
#
|
596
586
|
# * [:close_on_empty_response](rdoc-ref:Net::HTTP#close_on_empty_response):
|
@@ -606,7 +596,6 @@ module Net
|
|
606
596
|
# * [#response_body_encoding=](rdoc-ref:Net::HTTP#response_body_encoding=):
|
607
597
|
# Sets the response body encoding.
|
608
598
|
#
|
609
|
-
#
|
610
599
|
# ### Proxies
|
611
600
|
#
|
612
601
|
# * [:proxy_address](rdoc-ref:Net::HTTP#proxy_address): Returns the proxy
|
@@ -629,7 +618,6 @@ module Net
|
|
629
618
|
# * [#proxy_user](rdoc-ref:Net::HTTP#proxy_user): Returns the proxy user name.
|
630
619
|
# * [:proxy_user=](rdoc-ref:Net::HTTP#proxy_user=): Sets the proxy user.
|
631
620
|
#
|
632
|
-
#
|
633
621
|
# ### Security
|
634
622
|
#
|
635
623
|
# * [:ca_file](rdoc-ref:Net::HTTP#ca_file): Returns the path to a CA
|
@@ -694,7 +682,6 @@ module Net
|
|
694
682
|
# server the certification verification at the beginning of the SSL/TLS
|
695
683
|
# session.
|
696
684
|
#
|
697
|
-
#
|
698
685
|
# ### Addresses and Ports
|
699
686
|
#
|
700
687
|
# * [:address](rdoc-ref:Net::HTTP#address): Returns the string host name or
|
@@ -719,7 +706,6 @@ module Net
|
|
719
706
|
# port used to establish the connection.
|
720
707
|
# * [:port](rdoc-ref:Net::HTTP#port): Returns the integer port number.
|
721
708
|
#
|
722
|
-
#
|
723
709
|
# ### HTTP Version
|
724
710
|
#
|
725
711
|
# * [::version_1_2?](rdoc-ref:Net::HTTP.version_1_2?) (aliased as
|
@@ -727,7 +713,6 @@ module Net
|
|
727
713
|
# [::version_1_2](rdoc-ref:Net::HTTP.version_1_2)): Returns true; retained
|
728
714
|
# for compatibility.
|
729
715
|
#
|
730
|
-
#
|
731
716
|
# ### Debugging
|
732
717
|
#
|
733
718
|
# * [#set_debug_output](rdoc-ref:Net::HTTP#set_debug_output): Sets the output
|
@@ -925,7 +910,6 @@ module Net
|
|
925
910
|
# Server](rdoc-ref:Net::HTTP@Proxy+Server).
|
926
911
|
# * For argument `opts`, see below.
|
927
912
|
#
|
928
|
-
#
|
929
913
|
# With no block given:
|
930
914
|
#
|
931
915
|
# * Calls `http.start` with no block (see #start), which opens a TCP
|
@@ -938,7 +922,6 @@ module Net
|
|
938
922
|
# http.finish
|
939
923
|
# http.started? # => false
|
940
924
|
#
|
941
|
-
#
|
942
925
|
# With a block given:
|
943
926
|
#
|
944
927
|
# * Calls `http.start` with the block (see #start), which:
|
@@ -948,10 +931,8 @@ module Net
|
|
948
931
|
# * Closes the HTTP session and TCP connection on block exit.
|
949
932
|
# * Returns the block's value `object`.
|
950
933
|
#
|
951
|
-
#
|
952
934
|
# * Returns `object`.
|
953
935
|
#
|
954
|
-
#
|
955
936
|
# Example:
|
956
937
|
#
|
957
938
|
# hostname = 'jsonplaceholder.typicode.com'
|
@@ -999,7 +980,6 @@ module Net
|
|
999
980
|
# * #verify_mode
|
1000
981
|
# * #write_timeout
|
1001
982
|
#
|
1002
|
-
#
|
1003
983
|
# Note: If `port` is `nil` and `opts[:use_ssl]` is a truthy value, the value
|
1004
984
|
# passed to `new` is Net::HTTP.https_default_port, not `port`.
|
1005
985
|
#
|
@@ -1015,7 +995,7 @@ module Net
|
|
1015
995
|
|
1016
996
|
# <!--
|
1017
997
|
# 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)
|
998
|
+
# - 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
999
|
# -->
|
1020
1000
|
# Returns a new Net::HTTP object `http` (but does not open a TCP connection or
|
1021
1001
|
# HTTP session).
|
@@ -1027,7 +1007,6 @@ module Net
|
|
1027
1007
|
# * Has the default port number, Net::HTTP.default_port (80).
|
1028
1008
|
# * Has no proxy.
|
1029
1009
|
#
|
1030
|
-
#
|
1031
1010
|
# Example:
|
1032
1011
|
#
|
1033
1012
|
# http = Net::HTTP.new(hostname)
|
@@ -1706,6 +1685,11 @@ module Net
|
|
1706
1685
|
# http = Net::HTTP.new(hostname)
|
1707
1686
|
# http.put('/todos/1', data) # => #<Net::HTTPOK 200 OK readbody=true>
|
1708
1687
|
#
|
1688
|
+
# Related:
|
1689
|
+
#
|
1690
|
+
# * Net::HTTP::Put: request class for HTTP method PUT.
|
1691
|
+
# * Net::HTTP.put: sends PUT request, returns response body.
|
1692
|
+
#
|
1709
1693
|
def put: (String path, String data, ?headers initheader) -> Net::HTTPResponse
|
1710
1694
|
|
1711
1695
|
# <!--
|
@@ -2040,7 +2024,6 @@ module Net
|
|
2040
2024
|
# * https://jsonplaceholder.typicode.com.
|
2041
2025
|
# * http://example.com.
|
2042
2026
|
#
|
2043
|
-
#
|
2044
2027
|
# Some examples also assume these variables:
|
2045
2028
|
#
|
2046
2029
|
# uri = URI('https://jsonplaceholder.typicode.com/')
|
@@ -2208,7 +2191,6 @@ module Net
|
|
2208
2191
|
# * Net::HTTPGenericRequest (and therefore Net::HTTPRequest).
|
2209
2192
|
# * Net::HTTPResponse.
|
2210
2193
|
#
|
2211
|
-
#
|
2212
2194
|
# The headers are a hash-like collection of key/value pairs called *fields*.
|
2213
2195
|
#
|
2214
2196
|
# ## Request and Response Fields
|
@@ -2223,7 +2205,6 @@ module Net
|
|
2223
2205
|
# [Getters](rdoc-ref:Net::HTTPHeader@Getters) and
|
2224
2206
|
# [Iterators](rdoc-ref:Net::HTTPHeader@Iterators).
|
2225
2207
|
#
|
2226
|
-
#
|
2227
2208
|
# Exactly which fields should be sent or expected depends on the host; see:
|
2228
2209
|
#
|
2229
2210
|
# * [Request
|
@@ -2233,7 +2214,6 @@ module Net
|
|
2233
2214
|
# fields](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_
|
2234
2215
|
# fields).
|
2235
2216
|
#
|
2236
|
-
#
|
2237
2217
|
# ## About the Examples
|
2238
2218
|
#
|
2239
2219
|
# Examples here assume that `net/http` has been required (which also requires
|
@@ -2246,7 +2226,6 @@ module Net
|
|
2246
2226
|
# * https://jsonplaceholder.typicode.com.
|
2247
2227
|
# * http://example.com.
|
2248
2228
|
#
|
2249
|
-
#
|
2250
2229
|
# Some examples also assume these variables:
|
2251
2230
|
#
|
2252
2231
|
# uri = URI('https://jsonplaceholder.typicode.com/')
|
@@ -2283,7 +2262,6 @@ module Net
|
|
2283
2262
|
# * A symbol: Key `:Accept` is treated as if it were `:Accept.to_s.downcase`;
|
2284
2263
|
# i.e., `'accept'`.
|
2285
2264
|
#
|
2286
|
-
#
|
2287
2265
|
# Examples:
|
2288
2266
|
#
|
2289
2267
|
# req = Net::HTTP::Get.new(uri)
|
@@ -2306,7 +2284,6 @@ module Net
|
|
2306
2284
|
# * #to_hash: Returns a hash of all header fields: each key is a field
|
2307
2285
|
# name; its value is the array value for the field.
|
2308
2286
|
#
|
2309
|
-
#
|
2310
2287
|
# * These methods return field values as string; the string value for a field
|
2311
2288
|
# is equivalent to `self[key.downcase.to_s].join(', '))`:
|
2312
2289
|
#
|
@@ -2315,8 +2292,6 @@ module Net
|
|
2315
2292
|
# * #fetch: Like #[], but accepts a default value to be returned if the
|
2316
2293
|
# key does not exist.
|
2317
2294
|
#
|
2318
|
-
#
|
2319
|
-
#
|
2320
2295
|
# The field value may be set:
|
2321
2296
|
#
|
2322
2297
|
# * #[]=: Sets the value for the given key; the given value may be a string, a
|
@@ -2325,7 +2300,6 @@ module Net
|
|
2325
2300
|
# overwriting the existing value).
|
2326
2301
|
# * #delete: Deletes the field for the given key.
|
2327
2302
|
#
|
2328
|
-
#
|
2329
2303
|
# Example field values:
|
2330
2304
|
#
|
2331
2305
|
# * String:
|
@@ -2362,7 +2336,6 @@ module Net
|
|
2362
2336
|
# req[:foo] # => "bar, baz, bat, bam, bah, 0, bad, 1"
|
2363
2337
|
# req.get_fields(:foo) # => ["bar", "baz", "bat", "bam", "bah", "0", "bad", "1"]
|
2364
2338
|
#
|
2365
|
-
#
|
2366
2339
|
# ## Convenience Methods
|
2367
2340
|
#
|
2368
2341
|
# Various convenience methods retrieve values, set values, query values, set
|
@@ -2382,13 +2355,11 @@ module Net
|
|
2382
2355
|
# `'Proxy-Authorization'`.
|
2383
2356
|
# * #set_range: Sets the value for field `'Range'`.
|
2384
2357
|
#
|
2385
|
-
#
|
2386
2358
|
# ### Form Setters
|
2387
2359
|
#
|
2388
2360
|
# * #set_form: Sets an HTML form data set.
|
2389
2361
|
# * #set_form_data: Sets header fields and a body from HTML form data.
|
2390
2362
|
#
|
2391
|
-
#
|
2392
2363
|
# ### Getters
|
2393
2364
|
#
|
2394
2365
|
# Method #[] can retrieve the value of any field that exists, but always as a
|
@@ -2410,7 +2381,6 @@ module Net
|
|
2410
2381
|
# `'Content-Range'`.
|
2411
2382
|
# * #type_params: Returns the string parameters for `'Content-Type'`.
|
2412
2383
|
#
|
2413
|
-
#
|
2414
2384
|
# ### Queries
|
2415
2385
|
#
|
2416
2386
|
# * #chunked?: Returns whether field `'Transfer-Encoding'` is set to
|
@@ -2421,7 +2391,6 @@ module Net
|
|
2421
2391
|
# `'keep-alive'`.
|
2422
2392
|
# * #key?: Returns whether a given key exists.
|
2423
2393
|
#
|
2424
|
-
#
|
2425
2394
|
# ### Iterators
|
2426
2395
|
#
|
2427
2396
|
# * #each_capitalized: Passes each field capitalized-name/value pair to the
|
@@ -3039,7 +3008,6 @@ module Net
|
|
3039
3008
|
# * A name/value pair.
|
3040
3009
|
# * An IO stream opened for reading.
|
3041
3010
|
#
|
3042
|
-
#
|
3043
3011
|
# Argument `params` should be an
|
3044
3012
|
# [Enumerable](rdoc-ref:Enumerable@Enumerable+in+Ruby+Classes) (method
|
3045
3013
|
# `params.map` will be called), and is often an array or hash.
|
@@ -3076,13 +3044,10 @@ module Net
|
|
3076
3044
|
# * `:filename`: The name of the file to use.
|
3077
3045
|
# * `:content_type`: The content type of the uploaded file.
|
3078
3046
|
#
|
3079
|
-
#
|
3080
3047
|
# Example:
|
3081
3048
|
#
|
3082
3049
|
# req.set_form([['file', file, {filename: "other-filename.foo"}]]
|
3083
3050
|
#
|
3084
|
-
#
|
3085
|
-
#
|
3086
3051
|
# The various forms may be mixed:
|
3087
3052
|
#
|
3088
3053
|
# req.set_form(['foo', %w[bar 1], ['file', file]])
|
@@ -3100,8 +3065,6 @@ module Net
|
|
3100
3065
|
# * An IO stream opened for reading (only when argument `enctype` -- see
|
3101
3066
|
# below -- is given as `'multipart/form-data'`).
|
3102
3067
|
#
|
3103
|
-
#
|
3104
|
-
#
|
3105
3068
|
# Examples:
|
3106
3069
|
#
|
3107
3070
|
# # Nil-valued fields.
|
@@ -3124,7 +3087,6 @@ module Net
|
|
3124
3087
|
# * `'multipart/form-data'`; see [RFC
|
3125
3088
|
# 7578](https://www.rfc-editor.org/rfc/rfc7578).
|
3126
3089
|
#
|
3127
|
-
#
|
3128
3090
|
# Optional argument `formopt` is a hash of options (applicable only when
|
3129
3091
|
# argument `enctype` is `'multipart/form-data'`) that may include the following
|
3130
3092
|
# entries:
|
@@ -3240,7 +3202,6 @@ module Net
|
|
3240
3202
|
# Host](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#host-reques
|
3241
3203
|
# t-header).
|
3242
3204
|
#
|
3243
|
-
#
|
3244
3205
|
# You can add headers or override default headers:
|
3245
3206
|
#
|
3246
3207
|
# # res = Net::HTTP::Get.new(uri, {'foo' => '0', 'bar' => '1'})
|
@@ -3262,7 +3223,6 @@ module Net
|
|
3262
3223
|
# * Net::HTTP::Trace
|
3263
3224
|
# * Net::HTTP::Patch
|
3264
3225
|
#
|
3265
|
-
#
|
3266
3226
|
# Subclasses for WebDAV requests:
|
3267
3227
|
#
|
3268
3228
|
# * Net::HTTP::Propfind
|
@@ -3314,7 +3274,6 @@ module Net
|
|
3314
3274
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3315
3275
|
# eable_methods): yes.
|
3316
3276
|
#
|
3317
|
-
#
|
3318
3277
|
# Related:
|
3319
3278
|
#
|
3320
3279
|
# * Net::HTTP.get: sends `GET` request, returns response body.
|
@@ -3354,7 +3313,6 @@ module Net
|
|
3354
3313
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3355
3314
|
# eable_methods): yes.
|
3356
3315
|
#
|
3357
|
-
#
|
3358
3316
|
# Related:
|
3359
3317
|
#
|
3360
3318
|
# * Net::HTTP#head: sends `HEAD` request, returns response object.
|
@@ -3396,7 +3354,6 @@ module Net
|
|
3396
3354
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3397
3355
|
# eable_methods): yes.
|
3398
3356
|
#
|
3399
|
-
#
|
3400
3357
|
# Related:
|
3401
3358
|
#
|
3402
3359
|
# * Net::HTTP.post: sends `POST` request, returns response object.
|
@@ -3439,6 +3396,11 @@ module Net
|
|
3439
3396
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3440
3397
|
# eable_methods): no.
|
3441
3398
|
#
|
3399
|
+
# Related:
|
3400
|
+
#
|
3401
|
+
# * Net::HTTP.put: sends `PUT` request, returns response object.
|
3402
|
+
# * Net::HTTP#put: sends `PUT` request, returns response object.
|
3403
|
+
#
|
3442
3404
|
class HTTP::Put < HTTPRequest
|
3443
3405
|
METHOD: String
|
3444
3406
|
|
@@ -3474,7 +3436,6 @@ module Net
|
|
3474
3436
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3475
3437
|
# eable_methods): no.
|
3476
3438
|
#
|
3477
|
-
#
|
3478
3439
|
# Related:
|
3479
3440
|
#
|
3480
3441
|
# * Net::HTTP#delete: sends `DELETE` request, returns response object.
|
@@ -3513,7 +3474,6 @@ module Net
|
|
3513
3474
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3514
3475
|
# eable_methods): no.
|
3515
3476
|
#
|
3516
|
-
#
|
3517
3477
|
# Related:
|
3518
3478
|
#
|
3519
3479
|
# * Net::HTTP#options: sends `OPTIONS` request, returns response object.
|
@@ -3552,7 +3512,6 @@ module Net
|
|
3552
3512
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3553
3513
|
# eable_methods): no.
|
3554
3514
|
#
|
3555
|
-
#
|
3556
3515
|
# Related:
|
3557
3516
|
#
|
3558
3517
|
# * Net::HTTP#trace: sends `TRACE` request, returns response object.
|
@@ -3594,7 +3553,6 @@ module Net
|
|
3594
3553
|
# * [Cacheable](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cach
|
3595
3554
|
# eable_methods): no.
|
3596
3555
|
#
|
3597
|
-
#
|
3598
3556
|
# Related:
|
3599
3557
|
#
|
3600
3558
|
# * Net::HTTP#patch: sends `PATCH` request, returns response object.
|
@@ -3804,7 +3762,6 @@ module Net
|
|
3804
3762
|
# * https://jsonplaceholder.typicode.com.
|
3805
3763
|
# * http://example.com.
|
3806
3764
|
#
|
3807
|
-
#
|
3808
3765
|
# Some examples also assume these variables:
|
3809
3766
|
#
|
3810
3767
|
# uri = URI('https://jsonplaceholder.typicode.com/')
|
@@ -3851,7 +3808,6 @@ module Net
|
|
3851
3808
|
# * Hash-like method `[]`.
|
3852
3809
|
# * Specific reader methods, such as `content_type`.
|
3853
3810
|
#
|
3854
|
-
#
|
3855
3811
|
# Examples:
|
3856
3812
|
#
|
3857
3813
|
# res = Net::HTTP.get_response(uri) # => #<Net::HTTPOK 200 OK readbody=true>
|
@@ -3884,7 +3840,6 @@ module Net
|
|
3884
3840
|
# * Net::HTTPProcessing (102)
|
3885
3841
|
# * Net::HTTPEarlyHints (103)
|
3886
3842
|
#
|
3887
|
-
#
|
3888
3843
|
# * Net::HTTPSuccess:
|
3889
3844
|
#
|
3890
3845
|
# * Net::HTTPOK (200)
|
@@ -3898,7 +3853,6 @@ module Net
|
|
3898
3853
|
# * Net::HTTPAlreadyReported (208)
|
3899
3854
|
# * Net::HTTPIMUsed (226)
|
3900
3855
|
#
|
3901
|
-
#
|
3902
3856
|
# * Net::HTTPRedirection:
|
3903
3857
|
#
|
3904
3858
|
# * Net::HTTPMultipleChoices (300)
|
@@ -3910,7 +3864,6 @@ module Net
|
|
3910
3864
|
# * Net::HTTPTemporaryRedirect (307)
|
3911
3865
|
# * Net::HTTPPermanentRedirect (308)
|
3912
3866
|
#
|
3913
|
-
#
|
3914
3867
|
# * Net::HTTPClientError:
|
3915
3868
|
#
|
3916
3869
|
# * Net::HTTPBadRequest (400)
|
@@ -3941,7 +3894,6 @@ module Net
|
|
3941
3894
|
# * Net::HTTPRequestHeaderFieldsTooLarge (431)
|
3942
3895
|
# * Net::HTTPUnavailableForLegalReasons (451)
|
3943
3896
|
#
|
3944
|
-
#
|
3945
3897
|
# * Net::HTTPServerError:
|
3946
3898
|
#
|
3947
3899
|
# * Net::HTTPInternalServerError (500)
|
@@ -3956,8 +3908,6 @@ module Net
|
|
3956
3908
|
# * Net::HTTPNotExtended (510)
|
3957
3909
|
# * Net::HTTPNetworkAuthenticationRequired (511)
|
3958
3910
|
#
|
3959
|
-
#
|
3960
|
-
#
|
3961
3911
|
# There is also the Net::HTTPBadResponse exception which is raised when there is
|
3962
3912
|
# a protocol error.
|
3963
3913
|
#
|
@@ -5423,7 +5373,6 @@ module Net
|
|
5423
5373
|
# * https://jsonplaceholder.typicode.com.
|
5424
5374
|
# * http://example.com.
|
5425
5375
|
#
|
5426
|
-
#
|
5427
5376
|
# Some examples also assume these variables:
|
5428
5377
|
#
|
5429
5378
|
# uri = URI('https://jsonplaceholder.typicode.com/')
|
@@ -5470,7 +5419,6 @@ module Net
|
|
5470
5419
|
# * Hash-like method `[]`.
|
5471
5420
|
# * Specific reader methods, such as `content_type`.
|
5472
5421
|
#
|
5473
|
-
#
|
5474
5422
|
# Examples:
|
5475
5423
|
#
|
5476
5424
|
# res = Net::HTTP.get_response(uri) # => #<Net::HTTPOK 200 OK readbody=true>
|
@@ -5503,7 +5451,6 @@ module Net
|
|
5503
5451
|
# * Net::HTTPProcessing (102)
|
5504
5452
|
# * Net::HTTPEarlyHints (103)
|
5505
5453
|
#
|
5506
|
-
#
|
5507
5454
|
# * Net::HTTPSuccess:
|
5508
5455
|
#
|
5509
5456
|
# * Net::HTTPOK (200)
|
@@ -5517,7 +5464,6 @@ module Net
|
|
5517
5464
|
# * Net::HTTPAlreadyReported (208)
|
5518
5465
|
# * Net::HTTPIMUsed (226)
|
5519
5466
|
#
|
5520
|
-
#
|
5521
5467
|
# * Net::HTTPRedirection:
|
5522
5468
|
#
|
5523
5469
|
# * Net::HTTPMultipleChoices (300)
|
@@ -5529,7 +5475,6 @@ module Net
|
|
5529
5475
|
# * Net::HTTPTemporaryRedirect (307)
|
5530
5476
|
# * Net::HTTPPermanentRedirect (308)
|
5531
5477
|
#
|
5532
|
-
#
|
5533
5478
|
# * Net::HTTPClientError:
|
5534
5479
|
#
|
5535
5480
|
# * Net::HTTPBadRequest (400)
|
@@ -5560,7 +5505,6 @@ module Net
|
|
5560
5505
|
# * Net::HTTPRequestHeaderFieldsTooLarge (431)
|
5561
5506
|
# * Net::HTTPUnavailableForLegalReasons (451)
|
5562
5507
|
#
|
5563
|
-
#
|
5564
5508
|
# * Net::HTTPServerError:
|
5565
5509
|
#
|
5566
5510
|
# * Net::HTTPInternalServerError (500)
|
@@ -5575,8 +5519,6 @@ module Net
|
|
5575
5519
|
# * Net::HTTPNotExtended (510)
|
5576
5520
|
# * Net::HTTPNetworkAuthenticationRequired (511)
|
5577
5521
|
#
|
5578
|
-
#
|
5579
|
-
#
|
5580
5522
|
# There is also the Net::HTTPBadResponse exception which is raised when there is
|
5581
5523
|
# a protocol error.
|
5582
5524
|
#
|