From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS30633 207.244.64.0/18 X-Spam-Status: No, score=-1.4 required=3.0 tests=AWL,BAYES_00,RCVD_IN_XBL, RDNS_NONE,SPF_FAIL,SPF_HELO_FAIL shortcircuit=no autolearn=no version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from 80x24.org (unknown [207.244.70.35]) by dcvr.yhbt.net (Postfix) with ESMTP id 325DA20A35 for ; Wed, 27 Apr 2016 00:27:13 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Subject: [PATCH 1/5] test_proxy_pass: test for auto chunking on 1.0 backends Date: Wed, 27 Apr 2016 00:27:00 +0000 Message-Id: <20160427002704.10660-2-e@80x24.org> In-Reply-To: <20160427002704.10660-1-e@80x24.org> References: <20160427002704.10660-1-e@80x24.org> List-Id: These are followups to the following two commits: * commit d16326723d ("proxy_http_response: fix non-terminated fast responses, too") * commit 8c9f33a539 ("proxy_http_response: workaround non-terminated backends") --- test/test_proxy_pass.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/test_proxy_pass.rb b/test/test_proxy_pass.rb index 448e480..c938976 100644 --- a/test/test_proxy_pass.rb +++ b/test/test_proxy_pass.rb @@ -586,6 +586,21 @@ def check_eof_body(host, port) assert_match %r{\AHTTP/1\.1 200 OK\r\n}, res assert_match %r{\r\n\r\neof-body-slow\z}, res s.close + + # we auto-chunk on 1.1 requests and 1.0 backends + %w(eof-body-slow eof-body-fast).each do |x| + s = TCPSocket.new(host, port) + s.write("GET /#{x} HTTP/1.1\r\nHost: example.com\r\n\r\n") + res = ''.dup + res << s.readpartial(512) until res =~ /0\r\n\r\n\z/ + s.close + head, body = res.split("\r\n\r\n", 2) + head = head.split("\r\n") + assert_equal 'HTTP/1.1 200 OK', head[0] + assert head.include?('Connection: keep-alive') + assert head.include?('Transfer-Encoding: chunked') + assert_match %r{\Ad\r\n#{x}\r\n0\r\n\r\n\z}, body + end end end -- EW