summaryrefslogtreecommitdiffstats
path: root/extra/mail_handler/rdm-mailhandler.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-08-03 11:07:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-08-03 11:07:16 +0000
commit2e4e9b88d27942f6f2f60cf731656cfcc023ee39 (patch)
tree3591b48fc05eb9ee13f675c132bd605dd37a20e0 /extra/mail_handler/rdm-mailhandler.rb
parent91a5fa32d7b0bd1bcebead3213091134dfc3df2b (diff)
downloadredmine-2e4e9b88d27942f6f2f60cf731656cfcc023ee39.tar.gz
redmine-2e4e9b88d27942f6f2f60cf731656cfcc023ee39.zip
Fixes rdm-mailhandler SSL support (#1724).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1715 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'extra/mail_handler/rdm-mailhandler.rb')
-rw-r--r--extra/mail_handler/rdm-mailhandler.rb15
1 files changed, 14 insertions, 1 deletions
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