POST Request Notifier #406

Closed
wants to merge 3 commits into from

2 participants

@deanpcmad

This would be a very useful feature for what I may be doing in the future.
Basically it sends a POST request to a specified host with the backup message and status.

This is what paramaters are sent (shown from the log of a Rails app)
{"message"=>"[Backup::Success] MySQL Backup on localhost (localhost_mysql_backup)", "status"=>"success", "backup_version"=>"3.0.27", "token"=>"2131231232312321312"}

@kangguru

+1 i'd love to see this merged

@bumi bumi commented on the diff May 24, 2013
lib/backup/notifier/post_request.rb
+ if token
+ uri = URI.parse([host, token].join('/'))
+ else
+ uri = URI.parse(host)
+ end
+
+ http_request = Net::HTTP::Post.new(uri.request_uri)
+ http_request.initialize_http_header({"User-Agent" => "BackupClient/#{Backup::Version.current}"})
+
+ http_request.set_form_data({:message => message, :status => status, :backup_version => Backup::Version.current})
+
+ http = Net::HTTP.new(uri.host, uri.port)
+
+ if uri.scheme == 'https'
+ http.use_ssl = true
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@bumi
bumi added a note May 24, 2013

what is the reason behind using OpenSSL::SSL::VERIFY_NONE ?
I think it should not disable certificate verification by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ghost Unknown added a commit that referenced this pull request May 26, 2013
Brian D. Burns Notifier::HttpPost
Adds a generic HTTP POST notifier.

closes #371, closes #406
a07d19d
@ghost

@deanperry @kangguru @bumi @r38y I've created a HttpPost Notifier in a http_post branch. a07d19d

I'd like for this to be as generic as possible, and I believe this will do the trick.
If you could test this out, let me know if I've missed anything, etc... I'd appreciated it :)

@ghost Unknown added a commit that closed this pull request Jul 22, 2013
Brian D. Burns Notifier::HttpPost
Adds a generic HTTP POST notifier.

closes #371, closes #406
68caf46
@ghost ghost closed this in 68caf46 Jul 22, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment