From 49e4ffcc7ca3f1039a27c9ae884dd6c6ae23df41 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 7 Dec 2009 01:03:00 -0800 Subject: http_request: small cleanup/code reduction No point in bloating code for an unlikely path (and the memcpy() vs malloc() tradeoff is debatable...) --- lib/unicorn/http_request.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb index 1d978e6..31fcc3d 100644 --- a/lib/unicorn/http_request.rb +++ b/lib/unicorn/http_request.rb @@ -57,12 +57,10 @@ module Unicorn # short circuit the common case with small GET requests first if PARSER.headers(REQ, socket.readpartial(Const::CHUNK_SIZE, BUF)).nil? - data = BUF.dup # socket.readpartial will clobber data - # Parser is not done, queue up more data to read and continue parsing # an Exception thrown from the PARSER will throw us out of the loop begin - BUF << socket.readpartial(Const::CHUNK_SIZE, data) + BUF << socket.readpartial(Const::CHUNK_SIZE) end while PARSER.headers(REQ, BUF).nil? end REQ[Const::RACK_INPUT] = 0 == PARSER.content_length ? -- cgit v1.2.3-24-ge0c7