From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 490EA211BD for ; Wed, 26 Dec 2018 19:57:20 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Subject: [PATCH 4/5] extras/exec_cgi: @body_tip is always set Date: Wed, 26 Dec 2018 19:57:15 +0000 Message-Id: <20181226195716.31202-5-e@80x24.org> In-Reply-To: <20181226195716.31202-1-e@80x24.org> References: <20181226195716.31202-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: No point in increasing the complexity for cases it's not. --- extras/exec_cgi.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/extras/exec_cgi.rb b/extras/exec_cgi.rb index f143ac7..babda3c 100644 --- a/extras/exec_cgi.rb +++ b/extras/exec_cgi.rb @@ -31,10 +31,8 @@ def initialize(rd) end def each - buf = @body_tip || ''.dup - if buf.size > 0 - yield buf - end + buf = @body_tip + yield buf unless buf.empty? case tmp = @rd.read_nonblock(8192, buf, exception: false) when :wait_readable -- EW