From 7bb7c4469fb744135377d68e7c29cde3fbc635dc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 10 Jun 2011 02:13:55 +0000 Subject: use HttpParser#add_parse API in Unicorn 3.7.0 It's easier-to-use in some cases. --- lib/rainbows/ev_core.rb | 3 +-- lib/rainbows/xepoll_thread_pool/client.rb | 3 +-- lib/rainbows/xepoll_thread_spawn/client.rb | 6 ++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/rainbows/ev_core.rb b/lib/rainbows/ev_core.rb index 030c8e1..5c1355f 100644 --- a/lib/rainbows/ev_core.rb +++ b/lib/rainbows/ev_core.rb @@ -80,8 +80,7 @@ module Rainbows::EvCore def on_read(data) case @state when :headers - @buf << data - @hp.parse or return want_more + @hp.add_parse(data) or return want_more @state = :body if 0 == @hp.content_length app_call NULL_IO # common case diff --git a/lib/rainbows/xepoll_thread_pool/client.rb b/lib/rainbows/xepoll_thread_pool/client.rb index 625d1ac..759202b 100644 --- a/lib/rainbows/xepoll_thread_pool/client.rb +++ b/lib/rainbows/xepoll_thread_pool/client.rb @@ -111,8 +111,7 @@ module Rainbows::XEpollThreadPool::Client return kato_set when String kato_delete - @hp.buf << buf - @hp.parse and return queue! + @hp.add_parse(buf) and return queue! else return close end while true diff --git a/lib/rainbows/xepoll_thread_spawn/client.rb b/lib/rainbows/xepoll_thread_spawn/client.rb index c6f2301..1d3a280 100644 --- a/lib/rainbows/xepoll_thread_spawn/client.rb +++ b/lib/rainbows/xepoll_thread_spawn/client.rb @@ -95,8 +95,7 @@ module Rainbows::XEpollThreadSpawn::Client return kato_set when String kato_delete - @hp.buf << buf - env = @hp.parse and return spawn(env, @hp) + env = @hp.add_parse(buf) and return spawn(env, @hp) else return close end while true @@ -115,8 +114,7 @@ module Rainbows::XEpollThreadSpawn::Client kato_set return false when String - hp.buf << buf - hp.parse and return true + hp.add_parse(buf) and return true # continue loop else return close -- cgit v1.2.3-24-ge0c7