From 2e4e9b88d27942f6f2f60cf731656cfcc023ee39 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 3 Aug 2008 11:07:16 +0000 Subject: [PATCH] Fixes rdm-mailhandler SSL support (#1724). git-svn-id: http://redmine.rubyforge.org/svn/trunk@1715 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- extra/mail_handler/rdm-mailhandler.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/extra/mail_handler/rdm-mailhandler.rb b/extra/mail_handler/rdm-mailhandler.rb index 87a6798fa..96e975187 100644 --- a/extra/mail_handler/rdm-mailhandler.rb +++ b/extra/mail_handler/rdm-mailhandler.rb @@ -9,6 +9,19 @@ require 'net/https' require 'uri' require 'getoptlong' +module Net + class HTTPS < HTTP + def self.post_form(url, params) + request = Post.new(url.path) + request.form_data = params + request.basic_auth url.user, url.password if url.user + http = new(url.host, url.port) + http.use_ssl = (url.scheme == 'https') + http.start {|h| h.request(request) } + end + end +end + class RedmineMailHandler VERSION = '0.1' @@ -59,7 +72,7 @@ class RedmineMailHandler issue_attributes.each { |attr, value| data["issue[#{attr}]"] = value } debug "Posting to #{uri}..." - response = Net::HTTP.post_form(URI.parse(uri), data) + response = Net::HTTPS.post_form(URI.parse(uri), data) debug "Response received: #{response.code}" response.code == 201 ? 0 : 1 end