aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-11-10 20:31:32 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-11-10 20:31:32 +0900
commitd2ff97498001cc672bdf00f35e3bcb29465aeddd (patch)
tree68c4f8828c6c3aa8b404171ad8ccb1f48d92fb9d
parentd22caa2e2684d1e875beb64f53eadecb6e561cf9 (diff)
downloadplum-d2ff97498001cc672bdf00f35e3bcb29465aeddd.tar.gz
examples: client/twitter: enable gzip / deflate
-rw-r--r--examples/client/twitter.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/client/twitter.rb b/examples/client/twitter.rb
index f870da4..88f742f 100644
--- a/examples/client/twitter.rb
+++ b/examples/client/twitter.rb
@@ -17,7 +17,7 @@ rest = Plum::Client.start("api.twitter.com", 443)
Plum::Client.start("userstream.twitter.com", 443) { |streaming|
streaming.get("/1.1/user.json",
headers: { "authorization" => SimpleOAuth::Header.new(:get, "https://userstream.twitter.com/1.1/user.json", {}, credentials).to_s,
- "accept-encoding" => "identity;q=1" }) { |res| # plum doesn't have built-in gzip/deflate decoder
+ "accept-encoding" => "gzip, deflate" }) { |res|
if res.status != "200"
puts "failed userstream"
exit
@@ -25,6 +25,7 @@ Plum::Client.start("userstream.twitter.com", 443) { |streaming|
buf = String.new
res.on_chunk { |chunk| # when received DATA frame
+ next if chunk.empty?
buf << chunk
*msgs, buf = buf.split("\r\n", -1)