ultrahook 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@ require 'net/http'
3
3
  require 'json'
4
4
  require 'base64'
5
5
  require 'optparse'
6
+ require 'openssl'
6
7
 
7
8
  $stdout.sync = true
8
9
 
@@ -71,7 +72,7 @@ module UltraHook
71
72
  "http://#{dest}"
72
73
  elsif dest =~ /^[[:alnum:]\.\-]+$/
73
74
  "http://#{dest}"
74
- elsif dest =~ /^http:\/\//
75
+ elsif dest =~ /^https?:\/\//
75
76
  dest
76
77
  else
77
78
  error "Cannot parse destination url"
@@ -114,11 +115,16 @@ module UltraHook
114
115
  uri = URI("#{@options["destination"]}#{payload["path"]}?#{payload["query"]}")
115
116
  response = http_post(uri, payload["body"], payload["headers"])
116
117
 
117
- puts "[#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}] POST http://#{uri.host}:#{uri.port}#{full_path(uri)} - #{response.code}"
118
+ puts "[#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}] POST #{uri.scheme}://#{uri.host}:#{uri.port}#{full_path(uri)} - #{response.code}"
118
119
  end
119
120
 
120
121
  def http_post(uri, data="", headers={})
121
- Net::HTTP.new(uri.host, uri.port).post(full_path(uri), data, headers)
122
+ http = Net::HTTP.new(uri.host, uri.port)
123
+ if uri.scheme == "https"
124
+ http.use_ssl = true
125
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
126
+ end
127
+ http.post(full_path(uri), data, headers)
122
128
  end
123
129
 
124
130
  def retrieve_config
@@ -1,3 +1,3 @@
1
1
  module UltraHook
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultrahook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-31 00:00:00.000000000 Z
12
+ date: 2015-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json