Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
Allow specifying a CA certificate
Browse files Browse the repository at this point in the history
git-svn-id: svn://78.47.249.61/ruby-mediawiki/trunk@78 ba9c31aa-a806-0410-9a81-9f13d15ee83b
  • Loading branch information
neingeist committed Apr 16, 2010
1 parent 2f76cdd commit 813a3dd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/mediawiki/minibrowser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,17 @@ class MiniBrowser
##
# Initialize a MiniBrowser instance
# url:: [URI::HTTP] or [URI::HTTPS]
def initialize(url)
# ca_file:: [String] Path to a CA certificate file
def initialize(url, ca_file = "/etc/ssl/certs/ca-certificates.crt")
@url = url
@http = Net::HTTP.new( @url.host, @url.port )
@http.use_ssl = true if @url.class == URI::HTTPS
if @url.class == URI::HTTPS
@http.use_ssl = true
if File.exist?(ca_file)
@http.verify_mode = OpenSSL::SSL::VERIFY_PEER
@http.ca_file = ca_file
end
end
@user_agent = 'WikiBot'
@cookies = {}
end
Expand Down

0 comments on commit 813a3dd

Please sign in to comment.