Sha256: 00cba746affec3257436f9feb2d3888cd7db8234bd81de141f954c8fb7bad9db

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

# frozen_string_literal: true

require "forwardable"
require "resolv"

module HTTPX
  class Resolver::System
    include Resolver::ResolverMixin

    def initialize(_, options)
      @options = Options.new(options)
      roptions = @options.resolver_options
      @state = :idle
      @resolver = Resolv::DNS.new(roptions.nil? ? nil : roptions)
      @resolver.timeouts = roptions[:timeouts] if roptions
    end

    def closed?
      true
    end

    def empty?
      true
    end

    def <<(channel)
      hostname = channel.uri.host
      addresses = ip_resolve(hostname) || system_resolve(hostname) || @resolver.getaddresses(hostname)
      addresses.empty? ? emit_resolve_error(channel, hostname) : emit_addresses(channel, addresses)
    end

    def uncache(*); end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
httpx-0.3.0 lib/httpx/resolver/system.rb
httpx-0.2.1 lib/httpx/resolver/system.rb
httpx-0.2.0 lib/httpx/resolver/system.rb