Skip to content

Commit

Permalink
Merge pull request #174 from koic/fix_some_warnings
Browse files Browse the repository at this point in the history
Fix some warnings
  • Loading branch information
brianmario committed Apr 11, 2017
2 parents 35cf1c2 + 7d94079 commit 9c0f565
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/yajl/bzip2.rb
Expand Up @@ -6,6 +6,6 @@
require 'bzip2' unless defined?(Bzip2)
require 'yajl/bzip2/stream_reader.rb'
require 'yajl/bzip2/stream_writer.rb'
rescue LoadError => e
rescue LoadError
raise "Unable to load the bzip2 library. Is the bzip2-ruby gem installed?"
end
end
5 changes: 3 additions & 2 deletions lib/yajl/http_stream.rb
Expand Up @@ -4,6 +4,7 @@
require 'yajl'
require 'yajl/version' unless defined? Yajl::VERSION
require 'uri'
require 'cgi'

module Yajl
# This module is for making HTTP requests to which the response bodies (and possibly requests in the near future)
Expand Down Expand Up @@ -101,7 +102,7 @@ def self.request(method, uri, opts = {}, &block)
default_headers["Content-Type"] = opts["Content-Type"] || "application/x-www-form-urlencoded"
body = opts.delete(:body)
if body.is_a?(Hash)
body = body.keys.collect {|param| "#{URI.escape(param.to_s)}=#{URI.escape(body[param].to_s)}"}.join('&')
body = body.keys.collect {|param| "#{CGI.escape(param.to_s)}=#{CGI.escape(body[param].to_s)}"}.join('&')
end
default_headers["Content-Length"] = body.length
end
Expand Down Expand Up @@ -161,7 +162,7 @@ def self.request(method, uri, opts = {}, &block)
if block_given?
chunkLeft = 0
while !socket.eof? && (line = socket.gets)
break if line.match /^0.*?\r\n/
break if line.match(/^0.*?\r\n/)
next if line == "\r\n"
size = line.hex
json = socket.read(size)
Expand Down

0 comments on commit 9c0f565

Please sign in to comment.