Class: OpenID::CustomFetcher

Inherits:
StandardFetcher
  • Object
show all
Defined in:
lib/open_id/custom_fetcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ca_pathObject

Returns the value of attribute ca_path.



4
5
6
# File 'lib/open_id/custom_fetcher.rb', line 4

def ca_path
  @ca_path
end

Instance Method Details

#make_connection(uri) ⇒ Object



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
# File 'lib/open_id/custom_fetcher.rb', line 6

def make_connection(uri)
  conn = make_http(uri)

  if !conn.is_a?(Net::HTTP)
    raise RuntimeError, sprintf("Expected Net::HTTP object from make_http; got %s",
                                conn.class)
  end

  if uri.scheme == 'https'
    if supports_ssl?(conn)

      conn.use_ssl = true

      case
      when @ca_path
        set_verified(conn, true)
        conn.ca_path = @ca_path
      when @ca_file
        set_verified(conn, true)
        conn.ca_file = @ca_file
      else
        Util.log("WARNING: making https request to #{uri} without verifying " +
                 "server certificate; no CA path was specified.")
        set_verified(conn, false)
      end
    else
      raise RuntimeError, "SSL support not found; cannot fetch #{uri}"
    end
  end

  return conn
end