summaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-15 14:48:33 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-15 14:48:33 +0000
commitced782ecb21c629e13306010ca34bbaa8e3bb473 (patch)
tree0f0948abebc0c3dd7b5def7b87d94696cb86872f /extra
parent46f2f9cff71838a32470f3f79d64f997b804226c (diff)
downloadredmine-ced782ecb21c629e13306010ca34bbaa8e3bb473.tar.gz
redmine-ced782ecb21c629e13306010ca34bbaa8e3bb473.zip
Adds a User-Agent header to Redmine mailhandler requests (#7318).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4725 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'extra')
-rw-r--r--extra/mail_handler/rdm-mailhandler.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/extra/mail_handler/rdm-mailhandler.rb b/extra/mail_handler/rdm-mailhandler.rb
index fe9460a6b..c1b5c287d 100644
--- a/extra/mail_handler/rdm-mailhandler.rb
+++ b/extra/mail_handler/rdm-mailhandler.rb
@@ -57,10 +57,11 @@ require 'rdoc/usage'
module Net
class HTTPS < HTTP
- def self.post_form(url, params)
+ def self.post_form(url, params, headers)
request = Post.new(url.path)
request.form_data = params
request.basic_auth url.user, url.password if url.user
+ request.initialize_http_header(headers)
http = new(url.host, url.port)
http.use_ssl = (url.scheme == 'https')
http.start {|h| h.request(request) }
@@ -121,6 +122,8 @@ class RedmineMailHandler
def submit(email)
uri = url.gsub(%r{/*$}, '') + '/mail_handler'
+ headers = { 'User-Agent' => "Redmine mail handler/#{VERSION}" }
+
data = { 'key' => key, 'email' => email,
'allow_override' => allow_override,
'unknown_user' => unknown_user,
@@ -128,7 +131,7 @@ class RedmineMailHandler
issue_attributes.each { |attr, value| data["issue[#{attr}]"] = value }
debug "Posting to #{uri}..."
- response = Net::HTTPS.post_form(URI.parse(uri), data)
+ response = Net::HTTPS.post_form(URI.parse(uri), data, headers)
debug "Response received: #{response.code}"
case response.code.to_i