From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5D3EE2035F; Tue, 8 Nov 2016 23:28:56 +0000 (UTC) Date: Tue, 8 Nov 2016 23:28:56 +0000 From: Eric Wong To: yahns-public@yhbt.net Subject: Re: [PATCH] response: only stream "file" responses on known length Message-ID: <20161108232856.GA29116@dcvr> References: <20161108232140.21752-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161108232140.21752-1-e@80x24.org> List-Id: Eric Wong wrote: > diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb Oops, missed this :x --- a/lib/yahns/http_response.rb +++ b/lib/yahns/http_response.rb @@ -125,7 +125,7 @@ def kv_str(buf, key, value) def http_response_write(res, opt) status, headers, body = res offset = 0 - count = hijack = nil + count = hijack = clen = nil alive = @hs.next? && self.class.persistent_connections flags = MSG_DONTWAIT term = false > @@ -152,7 +152,8 @@ def http_response_write(res, opt) > alive = false if value =~ /\bclose\b/i > when %r{\AContent-Length\z}i > term = true > - flags |= MSG_MORE if value.to_i > 0 && !hdr_only > + clen = value.to_i > + flags |= MSG_MORE if clen > 0 && !hdr_only > kv_str(buf, key, value) > when %r{\ATransfer-Encoding\z}i > term = true if value =~ /\bchunked\b/i