Fix for Ruby 2.0 tweetstream issue https://github.com/intridea/tweetstream/issues/117
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/lib/em-twitter/connection.rb | |
+++ b/lib/em-twitter/connection.rb | |
@@ -137,7 +137,7 @@ module EventMachine | |
protected | |
def handle_stream(data) | |
- @last_response << @decoder.decode(data) | |
+ @last_response << (@decoder ||= BaseDecoder.new).decode(data) | |
if @last_response.complete? | |
invoke_callback(@client.each_item_callback, @last_response.body) | |
@@ -149,17 +149,6 @@ module EventMachine | |
@response_code = @parser.status_code | |
@headers = headers | |
- @decoder = BaseDecoder.new | |
- | |
- # TODO: Complete gzip support | |
- # detect gzip encoding and use a decoder for response bodies | |
- # gzip needs to be detected with the Content-Encoding header | |
- # @decoder = if gzip? | |
- # GzipDecoder.new | |
- # else | |
- # BaseDecoder.new | |
- # end | |
- | |
# everything below here is error handling so return if we got a 200 | |
if @response_code.to_i == 200 | |
@network_reconnector.reset | |
@@ -301,6 +290,7 @@ module EventMachine | |
def reset_connection | |
@buffer = BufferedTokenizer.new("\r", MAX_LINE_LENGTH) | |
@parser = Http::Parser.new(self) | |
+ @parser.on_body = proc { |data| self.on_body(data) } | |
@last_response = Response.new | |
@response_code = 0 | |
diff --git a/lib/em-twitter/version.rb b/lib/em-twitter/version.rb | |
index 137364c..30a4354 100644 | |
--- a/lib/em-twitter/version.rb | |
+++ b/lib/em-twitter/version.rb | |
@@ -1,5 +1,5 @@ | |
module EventMachine | |
module Twitter | |
- VERSION = "0.2.2" unless defined?(EventMachine::Twitter::VERSION) | |
+ VERSION = "0.2.2p1" unless defined?(EventMachine::Twitter::VERSION) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment