Skip to content

Commit

Permalink
Handle mailinglist on https
Browse files Browse the repository at this point in the history
  • Loading branch information
keram committed Nov 18, 2014
1 parent f941142 commit a75bebe
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@ def subscribe(subscriber, mailinglist)
end

def send_subscribe_request(url)
response = false
begin
request = Net::HTTP.post_form(URI.parse(url), {'email' => @subscriber.email})
response = true
rescue => e
logger.warn "There was an error subscribe email (#{@subscriber.email}) to mailinglist (#{url}). \n#{e.message}\n"
uri = URI.parse(url)
result = Net::HTTP.start(uri.host, use_ssl: uri.scheme == 'https', verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
http.post(uri.request_uri, URI.encode_www_form({ 'email' => @subscriber.email }))
end

return result.code_type == Net::HTTPOK

response
rescue => e
logger.warn "There was an error subscribe email (#{@subscriber.email}) to mailinglist (#{url}). \n#{e.message}\n"
false
end

def find_page
Expand Down

0 comments on commit a75bebe

Please sign in to comment.