< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #12372 has been updated by Charles Nutter.
Ping again.
----------------------------------------
Bug #12372: Resolv::DNS does not fetch authority section resources when calling getresource(s)
https://bugs.ruby-lang.org/issues/12372#change-60251
* Author: Rafael Fernndez Lpez
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: All versions (1.1.8 - trunk)
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
In some cases, for example, when trying to retrieve the nameservers of a domain, you need to ask authoritative servers:
~~~
> dig ns org
(...)
;; ANSWER SECTION:
org. 13729 IN NS a0.org.afilias-nst.info.
org. 13729 IN NS a2.org.afilias-nst.info.
org. 13729 IN NS b0.org.afilias-nst.org.
org. 13729 IN NS b2.org.afilias-nst.org.
org. 13729 IN NS c0.org.afilias-nst.info.
org. 13729 IN NS d0.org.afilias-nst.org.
~~~
(pick one)
~~~
> dig ns ruby-lang.org @a0.org.afilias-nst.info
(...)
;; AUTHORITY SECTION:
ruby-lang.org. 86400 IN NS pichu.netlab.jp.
ruby-lang.org. 86400 IN NS support.netlab.jp.
~~~
The last reply (that returns the nameserver of the ruby-lang.org domain) comes in the authority section of the DNS message reply. Doing this with Resolv::DNS is very tricky right now:
~~~
require 'resolv'
dns = Resolv::DNS.new(:nameserver => ['199.19.56.1'])
puts dns.getresources('ruby-lang.org', Resolv::DNS::Resource::IN::NS).map(&:name)
~~~
Resolv::DNS is internally calling on extract_resources to each_answer, which only fetches the answer part of the DNS message reply. I created a pull request some time ago (https://github.com/ruby/ruby/pull/797), so it would internally call each_resource that internally collects each_answer, each_authority and each_additional.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>