lib/ruby-growl/gntp.rb in ruby-growl-4.0 vs lib/ruby-growl/gntp.rb in ruby-growl-4.1
- old
+ new
@@ -1,6 +1,7 @@
require 'digest'
+require 'net/http'
require 'openssl'
require 'time'
require 'uri'
require 'uri/x_growl_resource'
require 'uuid'
@@ -297,11 +298,11 @@
key_info = "SHA512:#{hash}.#{Digest.hexencode salt}"
end
if @encrypt == 'NONE' then
packet << ["GNTP/1.0", type, "NONE", key_info].compact.join(' ')
- packet << body
+ packet << body.force_encoding("ASCII-8BIT")
else
encipher, iv = cipher key
encrypt_info = "#{@encrypt}:#{Digest.hexencode iv}"
@@ -491,10 +492,9 @@
info = packet.shift
info =~ %r%^GNTP/([\d.]+) (\S+) (\S+)$%
version = $1
message = $2
- encryption = $3
raise Error, "invalid info line #{info.inspect}" unless version
headers = packet.flat_map do |header|
key, value = header.split ': ', 2