This file is indexed.

/usr/lib/ruby/1.8/yadis/fetcher.rb is in libyadis-ruby1.8 0.3.4-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
require "uri"

begin
  require "net/https"
rescue LoadError
  HAS_OPENSSL_ = false
  require 'net/http'
else  
  HAS_OPENSSL_ = true
end

class NetHTTPFetcher
    
  attr_accessor :ca_path
  
  def initialize(read_timeout=20, open_timeout=20)
    @read_timeout = read_timeout
    @open_timeout = open_timeout
    @ca_path = nil
  end
    
  def get(url, params = nil)    
    resp, final_url = do_get(url, params)
    if resp.nil?
      nil
    else
      [final_url, resp]
    end
  end
  
  protected
    
    # return a Net::HTTP object ready for use    
    def get_http_obj(uri)
      http = Net::HTTP.new(uri.host, uri.port)
      http.read_timeout = @read_timeout
      http.open_timeout = @open_timeout

      if uri.scheme == 'https'        
        if HAS_OPENSSL_
          http.use_ssl = true
          if @ca_path
            http.ca_file = @ca_path
            http.verify_mode = OpenSSL::SSL::VERIFY_PEER
          else
            http.verify_mode = OpenSSL::SSL::VERIFY_NONE
            STDERR.puts("Warning: fetching over https without verifying server certificate")
          end
        else
          STDERR.puts('Warning: trying to fetch HTTPS URL without OpenSSL support')
        end
      end

      return http
    end
    
    # do a GET following redirects limit deep    
    def do_get(url, params, limit=5)
      if limit == 0
        return nil
      end
      begin
        uri = URI.parse(url)
        http = get_http_obj(uri)
        resp = http.request_get(uri.request_uri, params)
      rescue
        nil
      else
        case resp
        when Net::HTTPSuccess
          return [resp, URI.parse(url).to_s]
        when Net::HTTPRedirection
          return do_get(resp["location"], params, limit-1)
        else
          return nil
        end
      end
    end

end