Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some warnings #174

Merged
merged 3 commits into from Apr 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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