yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
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	[thread overview]
Message-ID: <20181226195716.31202-5-e@80x24.org> (raw)
In-Reply-To: <20181226195716.31202-1-e@80x24.org>

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


  parent reply	other threads:[~2018-12-26 19:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26 19:57 [PATCH 0/5] exec_cgi: various cleanups and fixes Eric Wong
2018-12-26 19:57 ` [PATCH 1/5] test/test_extras_exec_cgi.rb: improve test reliability Eric Wong
2018-12-26 19:57 ` [PATCH 2/5] extras/exec_cgi: remove kgio dependency Eric Wong
2018-12-26 19:57 ` [PATCH 3/5] extras/exec_cgi: update copyright year and use SPDX Eric Wong
2018-12-26 19:57 ` Eric Wong [this message]
2018-12-26 19:57 ` [PATCH 5/5] extras/exec_cgi: support Process.spawn options (e.g. RLIMIT_*) Eric Wong
2018-12-28  7:39   ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/yahns/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181226195716.31202-5-e@80x24.org \
    --to=e@80x24.org \
    --cc=yahns-public@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/yahns.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).