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 2/2] wbuf_lite: unify EOF error handling
Date: Tue, 19 Jul 2016 22:24:37 +0000	[thread overview]
Message-ID: <20160719222437.23103-3-e@80x24.org> (raw)
In-Reply-To: <20160719222437.23103-1-e@80x24.org>

StringIO can never be truncated outside our control, so it is
a bug if we see EOF on trysendio, here.
---
 lib/yahns/wbuf_lite.rb | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/lib/yahns/wbuf_lite.rb b/lib/yahns/wbuf_lite.rb
index 8a93ad1..577b4dc 100644
--- a/lib/yahns/wbuf_lite.rb
+++ b/lib/yahns/wbuf_lite.rb
@@ -68,16 +68,9 @@ def wbuf_flush(client)
       @sf_offset += rv # keep going otherwise
     when :wait_writable, :wait_readable
       return rv
-    when nil
-      # response got truncated, drop the connection
-      # this may happens when using Rack::File or similar, we can't
-      # keep the connection alive because we already sent our Content-Length
-      # header the client would be confused.
-      @wbuf_persist = false
-      return wbuf_close(client)
     else
-      raise "BUG: rv=#{rv.inspect} " \
-            "on tmpio=#{@tmpio.inspect} " \
+      raise "BUG: #{rv.nil? ? 'EOF' : rv.inspect} on "
+            "tmpio.size=#{@tmpio.size} " \
             "sf_offset=#@sf_offset sf_count=#@sf_count"
     end while @sf_count > 0
     wbuf_close(client)
-- 
EW


  parent reply	other threads:[~2016-07-19 22:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 22:24 [PATCH] ANOTHER round of proxy_pass fixes Eric Wong
2016-07-19 22:24 ` [PATCH 1/2] wbuf_lite: prevent clobbering responses Eric Wong
2016-07-19 22:24 ` Eric Wong [this message]
2016-07-20 22:40 ` [PATCH 3/2] wbuf_lite: reset sf_offset/sf_count consistently Eric Wong
2016-07-21  0:57 ` [PATCH 4/2] wbuf_lite: clear @busy flag when re-arming 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=20160719222437.23103-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=yahns-public@yhbt.net \
    --subject='Re: [PATCH 2/2] wbuf_lite: unify EOF error handling' \
    /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

Code repositories for project(s) associated with this inbox:

	../../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).