Fixes rdm-mailhandler SSL support (#1724).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1715 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
91a5fa32d7
commit
2e4e9b88d2
|
@ -9,6 +9,19 @@ require 'net/https'
|
||||||
require 'uri'
|
require 'uri'
|
||||||
require 'getoptlong'
|
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
|
class RedmineMailHandler
|
||||||
VERSION = '0.1'
|
VERSION = '0.1'
|
||||||
|
|
||||||
|
@ -59,7 +72,7 @@ class RedmineMailHandler
|
||||||
issue_attributes.each { |attr, value| data["issue[#{attr}]"] = value }
|
issue_attributes.each { |attr, value| data["issue[#{attr}]"] = value }
|
||||||
|
|
||||||
debug "Posting to #{uri}..."
|
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}"
|
debug "Response received: #{response.code}"
|
||||||
response.code == 201 ? 0 : 1
|
response.code == 201 ? 0 : 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue