Граф коммитов

56 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 003f06bde4 [ruby/resolv] Close leaked FD
https://github.com/ruby/resolv/commit/49aefa3bba
2023-11-26 01:07:21 +00:00
Jeremy Evans 7276d4b4e8 [ruby/resolv] Support a :raise_timeout_errors option to raise timeouts as Resolv::ResolvError
This allows to differentiate a timeout from an NXDOMAIN response.

Fixes [Bug #18151]

https://github.com/ruby/resolv/commit/c0e5abab76
2023-11-25 02:24:43 +00:00
Jeremy Evans 974d18fd0c [ruby/resolv] Fix the fallback from UDP to TCP due to message truncation
If truncation is detected, return immediately from decode so that
the UDP connection can be retried with TCP, instead of failing to
decode due to trying to decode a truncated response.

Fixes [Bug #13513]

https://github.com/ruby/resolv/commit/0de996dbca
2023-11-24 19:17:19 +00:00
Kasumi Hanazuki e3b485213d [ruby/resolv] Implement dohpath SvcParam
(https://github.com/ruby/resolv/pull/33)

* Implement dohpath SvcParam [RFC 9461]

This patch implements "dohpath" SvcParam proposed in
[draft-ietf-add-svcb-dns-08]. This parameter specifies a URI template
for the :path used in DNS-over-HTTPS requests.

"dohpath" is employed by [DDR], also a to-be-published Proposed Standard
that specifies how to upgrade DNS transport to a more secure one, i.d.,
DNS-over-TLS or DNS-over-HTTPS. DDR is deployed in the public DNS
resolvers including Cloudflare DNS, Google Public DNS, and Quad9.

[RFC 9461]: https://datatracker.ietf.org/doc/rfc9461/
[DDR]: https://datatracker.ietf.org/doc/draft-ietf-add-ddr/

https://github.com/ruby/resolv/commit/da9c023539

Co-authored-by: Sorah Fukumori <her@sorah.jp>
2023-11-24 01:42:08 +00:00
Kasumi Hanazuki 608a518b42 [ruby/resolv] Implement SVCB and HTTPS RRs
(https://github.com/ruby/resolv/pull/32)

* Add MessageDecoder#get_list

This method repeats yielding until all the data upto the current limit
is consumed, and then returns an Array containig the block results.

* Implement SVCB and HTTPS RRs [RFC 9460]

> This patch implements SVCB and HTTPS resource record types defined in
> [RFC 9460].
>
> The RR types are now supported by many server implementations including
> BIND, unbound, PowerDNS, and Knot DNS. Major browsers such as Chrome,
> Edge, and Safari have started to query HTTPS records, with the records
> gradually adopted by websites. Also, SVCB is actually deployed in the
> public DNS resolvers such as Cloudflare DNS and Google Public DNS for
> [DDR].
>
> With such wide adoption, we have plenty of real-world use cases, and
> it is unlikely the wire format will change further in an incompatible
> way. It is time to implement them in the client libraries!
>
> # Rationale for proposed API
>
> ## `Resolv::DNS::Resource::IN::ServiceBinding`
>
> This is an abstract class for SVCB-compatible RR types.
> SVCB-compatible RR types, as defined in the Draft, shares the wire
> format and the semantics of their RDATA fields with SVCB to allow
> implementations to share the processing of these RR types. So we do
> so.
>
> The interface of this class is straightforward: It has three
> attributes `priority`, `target`, and `params`, which correspond the
> RDATA fields SvcPriority, TargetName, and SvcParams, resp.
>
> SVCB RR type is defined specifically within IN class. Thus, this
> class is placed in the `Resolv::DNS::Resource::IN` namespace.
>
> ## `Resolv::DNS::Resource::IN::SVCB`, `Resolv::DNS::Resource::IN::HTTPS`
>
> Just inherits ServiceBinding class.
>
> ## `Resolv::DNS::SvcParam`
>
> This class represents a pair of a SvcParamKey and a SvcParamValue.
> Aligned with the design of `Resolv::DNS::Resource`, each SvcParamKey
> has its own subclass of `Resolv::DNS::SvcParam`.
>
> ## `Resolv::DNS::SvcParam::Generic`
>
> This is an abstract class representing a SvcParamKey that is unknown
> to this library. `Generic.create(key)` dynamically defines its
> subclass for specific `key`. E.g., `Generic.create(667)` will define
> `Generic::Key667`.
>
> This class holds SvcParamValue in its wire format.
>
> SvcParam with an unknown SvcParamKey will be decoded as a subclass of
> this class. Also, users of this library can generate a non-supported
> SvcParam if they know its wire format.
>
> ## `Resolv::DNS::SvcParams`
>
> This is conceptually a set of `SvcParam`s, whose elements have the
> unique SvcParamKeys. It behaves like a set, and for convenience
> provides indexing by SvcParamKey.
>
> - `#initialize(params)` takes an Enumerable of `SvcParam`s as the
>   initial content. If it contains `SvcParam`s with the duplicate key,
>   the one that appears last takes precedence.
> - `#[](key)` fetches the `SvcParam` with the given key. The key can be
>   specified by its name (e.g., `:alpn`) or number (e.g., `1`).
> - `#add(param)` adds a `SvcParam` to the set. If the set already has a
>   `SvcParam` with the same key, it will be replaced.
> - `#delete(key)` deletes a `SvcParam` by its key and returns it. The key
>   can be specified by its name or number.

* Update comments referring to draft-ietf-dnsop-svcb-https-12

Published as RFC 9460. https://datatracker.ietf.org/doc/rfc9460/

[draft-ietf-dnsop-svcb-https-12]: https://datatracker.ietf.org/doc/draft-ietf-dnsop-svcb-https/12/
[RFC 9460]: https://datatracker.ietf.org/doc/rfc9460/
[DDR]: https://datatracker.ietf.org/doc/draft-ietf-add-ddr/

https://github.com/ruby/resolv/commit/b3ced7f039
2023-11-24 01:35:33 +00:00
John Bond 9e24d747ff [ruby/resolv] IPv6: update to_s method to be RFC5952 compliant
(https://github.com/ruby/resolv/pull/25)

* IPv6: update to_s method to be RFC5952 compliant

I noticed that the resolv library does not honour RFC 5952 Section 4.2.2.
in relation to textural representation of ipv6 addresses:

   The symbol "::" MUST NOT be used to shorten just one 16-bit 0 field.
   For example, the representation 2001:db8:0:1:1:1:1:1 is correct, but
   2001:db8::1:1:1:1:1 is not correct.

Fixes https://github.com/ruby/resolv/pull/24

https://github.com/ruby/resolv/commit/5efcd6ed70

Co-authored-by: Sorah Fukumori <sora134@gmail.com>
2023-11-22 10:35:36 +00:00
Kasumi Hanazuki 957595f218 [ruby/resolv] Do not compress domain name in SRV RDATA
[RFC2782] prohibits use of name compression for the target host name
in the RDATA of a SRV record.

[RFC2782]: https://datatracker.ietf.org/doc/rfc2782/

Closes: https://github.com/ruby/resolv/issues/29

https://github.com/ruby/resolv/commit/ac85724e17
2023-04-08 14:16:59 +00:00
Hiroshi SHIBATA c02a9994ce [ruby/resolv] Use omit instead of skip for test-unit
https://github.com/ruby/resolv/commit/55e42221d4
2022-01-12 10:49:58 +09:00
Jeremy Evans d494a16ac5 [ruby/resolv] Support more characters in link local addresses
Implements [Feature #17524]

https://github.com/ruby/resolv/commit/993a1a374f
2022-01-12 10:49:57 +09:00
Hiroshi SHIBATA adcbae8d49
Removed minitest/mock 2021-05-19 14:24:01 +09:00
Takashi Kokubun cc1ea6e023
Run nmake check on Actions (#4487)
* Run nmake check on Actions

* Skip tests not working in mswin GitHub Actions

* Override TEMP

* Revert "Skip tests not working in mswin GitHub Actions"

This reverts commit 544d2575fcdf23ae63cd25aa03fce10c28b259f2.

* Revert "Revert "Skip tests not working in mswin GitHub Actions""

This reverts commit e1f8ad7862c9c4be52dc6e1031a004621eb07e6e.

* Fix timeouts

* Skip some more broken tests

* Update windows.yml

* Add a guard for rbasic_spec

* Revert "Update windows.yml"

This reverts commit bc9694b6b3b9594d406378d15ca11723fb052bc8.

* Skip the ensure clause

* Simplify the ensure
2021-05-11 15:18:44 -07:00
Kazuhiro NISHIYAMA d14397bcc4
`fe80` should be case insensitive too 2020-11-09 16:16:30 +09:00
Yusuke Endoh fcf8b9ef72 test/resolv/test_dns.rb: suppress "assigned but unused variable" 2020-11-08 23:32:44 +09:00
Jeremy Evans 2f12af42f7 Add support for IPv6 link local addresses to resolv
Now that it should work correctly, test that every address returned
by Socket.ip_address_list is resolvable.

Socket works with IPv6 link local addresses, and ipaddr now does
as well, so I think resolv should support them.

Fixes [Bug #17112]
2020-11-07 13:47:45 -08:00
Jeremy Evans 9682db0651 Remove sender/message_id pair after response received in resolv
Once a response for a given DNS request has been received (which
requires a matching message id), the [sender, message_id] pair
should be removed from the list of valid senders.  This makes it
so duplicate responses from the same sender are ignored.

Fixes [Bug #12838]
2020-11-07 13:12:27 -08:00
MSP-Greg eb2b425821 MinGW on Actions (#2791)
* MinGW - skip spec in spec/ruby/optional/capi/thread_spec.rb

C-API Thread function rb_thread_call_without_gvl
      -- runs a C function with the global lock unlocked and unlocks IO with the generic RUBY_UBF_IO

stops/freezes spec tests

See https://bugs.ruby-lang.org/issues/16265

* MinGW - skip test test/resolv/test_dns.rb

Test times out in CI (both AppVeyor & Actions), cannot repo locally

* MinGW - skip test test/ruby/test_thread_queue.rb

* Add Actions mingw.yml
2019-12-30 23:19:31 -08:00
Tanaka Akira 1da3a31a5f Use lowercase letters for IPv6 addresses.
Reported by chucke (Tiago Cardoso).
Patch by jeremyevans0 (Jeremy Evans).
[Bug #14612]
2019-07-30 11:59:54 +09:00
Jeremy Evans 6650899248 Make Resolv::DNS#each_name accept Resolv::IPv{4,6} arguments
These arguments were previously documented as supported, but not
actually supported.

Patch from Toru Iwase

Fixes [Bug #15900]
2019-06-08 20:31:12 -07:00
nobu 9f41da42eb Fix a typo [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-11 11:58:38 +00:00
nobu fb284ee7f8 use the reference as failure messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-06 05:59:29 +00:00
nobu e6c0a8f19e resolv.rb: close socket
* lib/resolv.rb (UnconnectedUDP#lazy_initialize): store new
  sockets before binding, so the sockets get closed when the
  requester is closing.

* lib/resolv.rb (ConnectedUDP#lazy_initialize): ditto.

* lib/resolv.rb (UnconnectedUDP#close): synchronize to get rid of
  race condition.

* lib/resolv.rb (ConnectedUDP#close): ditto.

[ruby-core:85901] [Bug #14571]

From: quixoten (Devin Christensen) <quixoten@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-06 02:48:17 +00:00
naruse afe296be78 fix for IPv6 env
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-11 19:41:49 +00:00
naruse 9e677261a9 Mock fetching data from real DNS [Feature #14340]
This test just tests MDNS#each_address method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-11 18:26:49 +00:00
usa 098c8d5491 fix test errors on Windows
* test/resolv/test_addr.rb (test_hosts_by_command): on Windows, `|` is
	  invalid charactor for path and raises `Errno::EINVAL` if trying to
	  open.

	* test/resolv/test_dns.rb (test_resolv_conf_by_command): ditto.

	cf. [Bug #14205]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-20 16:04:41 +00:00
nobu cdf1b85ae7 Fixed command Injection
* lib/resolv.rb (Resolv::Config.parse_resolv_conf): fixed
  potential command injection by use of Kernel#open.
  [ruby-core:84347] [Bug #14205]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-20 04:25:01 +00:00
hsbt 111a2de495 Handle Errno::EADDRNOTAVAIL with Raspberry Pi environment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:05:01 +00:00
hsbt db590b5d59 Fixed unexpected behavior of `Resolv::MDNS#each_address` when given ".local" address.
https://github.com/ruby/ruby/pull/1425

  Patch by @elct9620 [fix GH-1484]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 13:58:31 +00:00
nobu 2b2450ba4b Made #decode_rdata client to catch errors
* lib/resolv.rb (Resolv::DNS::Message::MessageDecoder#get_rr):
  re-raise an exception from decode_rdata as DecodeError, so it
  can report them to the top in more informative way.  It was not
  reflecting on errors of data and thus breaking.  Client code
  expects `DecodeError` and knows how to handle broken messages.
  [Fix GH-1511]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-14 02:26:48 +00:00
akr 7d27c0a2d8 fix Resolv::LOC::Coord.create.
* lib/resolv.rb (Resolv::LOC::Coord.create): fixed.
  [ruby-core:72567] [Bug #11912] fixed by Eric Wong and Kazuhiro
  NISHIYAMA.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 15:19:21 +00:00
normal a3b53cd991 Resolv::IPv6.create: avoid modifying frozen string literal
* lib/resolv.rb (Resolv::IPv6.create): avoid modifying frozen
* test/resolv/test_dns.rb (test_ipv6_create): test for above
  [Bug #11910] [ruby-core:72559]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 20:31:10 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
akr 60055f8dfd * lib/resolv.rb (Resolv::DNS::Message::MessageEncoder#put_labels):
Prevent overflow of pointer to labels.
  Patch by Hannes Georg.  [ruby-core:71248] [Bug #11632]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-09 15:37:04 +00:00
nobu beb1c085d5 use Timeout.timeout
* time: Object#timeout has been deprecated a long time ago, use
  Timeout.timeout.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-13 10:07:01 +00:00
nobu 466bd05fda resolv.rb: fix equality
* lib/resolv.rb (Resolv::DNS::Resource#==, #hash): elements
  returned by Kernel#instance_variables are Symbols now.
  [ruby-core:68128] [Bug #10857]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-17 02:47:19 +00:00
akr ec7f1f5dc2 * lib/resolv.rb (Resolv::DNS::Label::Str#==): Check class equality.
(Resolv::DNS::Name#initialize): Normalize labels as
  Resolv::DNS::Label::Str objects.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-02 00:10:04 +00:00
nobu 69a7bb31f9 resolv.rb: case-insensitive comparison
* lib/resolv.rb (Resolv::DNS::Name#==): DNS is case-insensitive, so the
  comparison should be case-insensitive as well.
  [ruby-core:66498] [Bug #10550]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-30 07:16:14 +00:00
nobu 1441d9da99 test_dns.rb: test name
* test/resolv/test_dns.rb (TestResolvDNS#test_dots_diffences): fix
  test name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-30 07:05:32 +00:00
nobu a0325ea704 resolv.rb: dots differences
* lib/resolv.rb (Resolv::DNS::Name): names with different dots
  should be different.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-30 07:03:47 +00:00
nobu fb933bf70b test_dns.rb: fix scope
* test/resolv/test_dns.rb (test_query_ipv4_address): fix local
  variables scope.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25 01:23:57 +00:00
usa 86693b30c5 * test/resolv/test_dns.rb (TestResolvDNS#test_query_ipv4_address):
set timeout for recvfrom because if client thread is crashed, it
  waits infinity.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25 00:21:00 +00:00
naruse 32f124e68a use timeout lib
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-24 18:59:45 +00:00
naruse 5328fa259b add timeout to avoid global timeout
http://ruby-mswin.cloudapp.net/vc10-x64/ruby-trunk/log/20141224T065940Z.log.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-24 08:32:55 +00:00
tenderlove 570c028c7e * lib/resolv.rb: fall back if canonicalization fails.
Thanks Vit Ondruch for the patch!  [ruby-core:65836]

* test/resolv/test_dns.rb: test for patch

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-21 20:04:27 +00:00
akr 08bb9482a0 * test/resolv/test_dns.rb: Use assert_join_threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-11 13:51:39 +00:00
akr 198964ea2f Avoid tempfile leaks using Tempfile.create instead of Tempfile.open.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 14:00:16 +00:00
hsbt 5691727653 * test/monitor/test_monitor.rb: remove unused variabels.
*  test/resolv/test_dns.rb: ditto.
*  test/rexml/test_functions.rb: ditto.
*  test/rss/test_setup_maker_itunes.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-21 01:53:38 +00:00
tmm1 959a66249d resolv/test_addr.rb: require tempfile for new test in r44312
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-21 09:45:50 +00:00
nobu 1ef0a76c6c test_dns.rb: no server access
* test/resolv/test_dns.rb (test_invalid_byte_comment): get rid of
  actual server access.  [Bug #9273]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-21 07:18:18 +00:00
nobu 1ffbe07e17 resolv.rb: no encodings
* lib/resolv.rb (Resolv::Hosts#lazy_initialize): should not
  consider encodings in hosts file.  [ruby-core:59239] [Bug #9273]
* lib/resolv.rb (Resolv::Config.parse_resolv_conf): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-21 03:37:26 +00:00
kazu ca0bb51887 * test/net/http/test_https_proxy.rb
(HTTPSProxyTest#test_https_proxy_authentication):
  add workaround to avoid to hang up without openssl.
  see #5786

* test/resolv/test_dns.rb (TestResolvDNS#test_query_ipv4_address):
  ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-02 15:55:07 +00:00