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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from mail-qt0-x23b.google.com (mail-qt0-x23b.google.com [IPv6:2607:f8b0:400d:c0d::23b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 58E6D2023D for ; Thu, 29 Jun 2017 02:19:26 +0000 (UTC) Received: by mail-qt0-x23b.google.com with SMTP id w12sf5545607qta.1 for ; Wed, 28 Jun 2017 19:19:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1498702765; cv=pass; d=google.com; s=arc-20160816; b=gGpT44ydxx60D7zARZLo5PEcrz+hjtsrVcohcymJPw12pVk1uDar7iJ5WKP9ntlXB4 YJvB+wy6Ft1GkpIom6FsWvwyT15UJDeO7N0t82Keap0inq8f+YijiO9niDD78yblauMC Jz9Z7NngQG7G/epZORCYyRiOV/hvVCCDsxtsQVOWIrlO4MEaKRLwGRdWs2DDxJuRPCf1 B/ad9RhWjgWzcyB564tAkG/XeMW7lIbob9Z+Jesfgjrx4XAPm7ruuPJHTUi6E8rEeZ34 J4pHH1ilSH7pCnFfFjfiZRjPhOI+rHw73183GKaqdBzywBmnP2rxgd3iY+ZhKh7agFj/ hQCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:references:in-reply-to :message-id:date:subject:to:from:arc-authentication-results :arc-message-signature:mime-version:sender:dkim-signature :arc-authentication-results; bh=eXDud0F36FybZ3wyUsz308evWtjuIdyE817lBQkcLWI=; b=1JJrQ9oJN4pHFfTSWkQxY1rnOq8cTs/ocNIVAq2hl2X1Ce+Sv5Mvvd/UNdwpJPpDSs xO64OrA9+qVHEHkrWKTIr4kviUEW8xY/D2o4xz1T/Os87DWO5DaQuNj+y3/FexQAelrD z4oLTs+FyKULU0O/QKP7KAO3MzYTrcK8LaVc0iXTxG+pyV9RdsIKk4Z6DwCEApAN4oZW hvkK1UdptPc6VnXO6GUd80Wz2Vm26jjwf0SKvqwmS178dVkgRnaQt156+IwZ3FEqo/K6 F87nC4jSHPn3VaUoYBSAB7DU5LySw+clTlDjiMLTg8CUV3IupZTcJbLiv+IDbu4qb6d6 EE9A== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of e@80x24.org designates 2600:3c01::f03c:91ff:fe96:f5d6 as permitted sender) smtp.mailfrom=e@80x24.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=eXDud0F36FybZ3wyUsz308evWtjuIdyE817lBQkcLWI=; b=dgt32w2RJdJ+YarGqua8rnGr7bnvfHBnxgEZidP8+HYJcsjC23SfHIu3WlnOlp2m99 v326vmyfDrJXilaHqA6rFHRccdyAjsGUHYZIc4engnmGaKyz70c/qApjMBS3ex+yHrbu M1op9/2yL2w1inqUdK6ZUAEYJsaMqKE7fdcDqn5LycChUnVACT9U3J9HCoJre7GSMQXA KrTT4CHQ8p4pR6ZbaYZ4FybD4oWpHfsr851qnzwuFu9ZNRaEC0qPT1xl2lKV52QKW3wN FRi6ynNI3aF7DZl257JXLvOzqooK1W6FATRg2eyu4I2KIU93ID4vZYev/lu6atSnAGE/ i+0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=eXDud0F36FybZ3wyUsz308evWtjuIdyE817lBQkcLWI=; b=Qz2Jpr5FYLokUwuHalFpSAY/bnOnVNTpUfBbCUOcAHK1vIpYsDhgzEEkvpFyAVt6Ki 9qKqFcDMG2mg5RNkm0EfNf+IgDjmlOCApgPT+mS9vQjGhzp0/1erHTB84d0nEcE7jp+A 1BfH52B1GnxSlsvKVxbSHklxIFPKKOjaG7V4AoUnsLOy6rNYM1LX8emaSBZ17TxpGqEk tMtdYWytj079KPboBibY4K0xl+dR7y+JXs/7MRu8q4tUAMsSZGea7Va2gBp4n9hiZeoj hnt66qxBbfmJfCZdXWHHbT+ajC0N1c6SveG+dZkukwO8UWwzOBor5uPoKkvw15nQ50Le sP/g== Sender: rack-devel@googlegroups.com X-Gm-Message-State: AKS2vOw0llEwxOxMHDJ2a7pLd/Hio/3dOCU7IjAlF2cKZlgN1XmMk9Ul zHAZbaUJnhB69Q== X-Received: by 10.36.34.209 with SMTP id o200mr272196ito.0.1498702765522; Wed, 28 Jun 2017 19:19:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rack-devel@googlegroups.com Received: by 10.107.161.137 with SMTP id k131ls1146904ioe.46.gmail; Wed, 28 Jun 2017 19:19:25 -0700 (PDT) X-Received: by 10.98.152.23 with SMTP id q23mr7157023pfd.35.1498702765076; Wed, 28 Jun 2017 19:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498702765; cv=none; d=google.com; s=arc-20160816; b=gp1Ec4BNJ//AsHqK1tKptke2qpAZlJynGmsqrkzShmGxfD6EniJQ2ZQJhr4bB83Xux FacoG7V6ywXeyQ3QfV9MoaA+TiVziOAm0XDCFItUlsdoVUQEan2h0xLw0JxZhaLuzYSY MM1Dg8AGdgVqeaD1dLQ9ngzZDEMJFinZBz7QF1+rcxjj81UH6Ul6UYpb+yBnnSrhaf2r r35jH9ESRl8kEv/i4YHy3xAC3bKH11WZT/HqYm5L8gOKDxJpbq+rjboNnbiweUHeXeD4 CFr4+Lyy1UdHY6tWEJV5BZU9HFS+c+63SDfLeqxdw0HBT4ZMRTYSSm4B/yj+Jcvv2Ltv Dc9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :arc-authentication-results; bh=RxJjnW8/1dpNMs3ISJSQhBfT1lg7k/8d8Lqf1WOJJ3M=; b=SCO98QT2vqOwMTV3nk3KbZtDUcO0XVNrl9OapsEZif94eXx/7FwfuTt9xU6xgfHSDH ExGpTPTZLiZoDt4Y/jNR8Nwd1ZM1p7vf50yKxS1QQAW10Y9AzU29EjE6R5Kn2yYdC8z6 WbHT1LtY9Y7/UO8/K6tNZjTGFwSz3X/9m+vcNrfbJeev1DoEiN20oObSfsapFMsXYJ2a 0Q41hRe0dZdjn5q4AXz8+N/Q38IlghCzwB6U7B8RQjB0/eAFmp/9wWXY8f9XLuWf5CRO 0DUV0Klhfr4ltmQo8/M6tOwZUJqWEobJI9i2BTjJHkcEymRizNk8WEXTtYn1xLv7x6z3 MM2A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of e@80x24.org designates 2600:3c01::f03c:91ff:fe96:f5d6 as permitted sender) smtp.mailfrom=e@80x24.org Received: from dcvr.yhbt.net (dcvr.yhbt.net. [2600:3c01::f03c:91ff:fe96:f5d6]) by gmr-mx.google.com with ESMTPS id p74si64594pfj.10.2017.06.28.19.19.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2017 19:19:25 -0700 (PDT) Received-SPF: pass (google.com: domain of e@80x24.org designates 2600:3c01::f03c:91ff:fe96:f5d6 as permitted sender) client-ip=2600:3c01::f03c:91ff:fe96:f5d6; Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 093322023D for ; Thu, 29 Jun 2017 02:19:16 +0000 (UTC) From: Eric Wong To: rack-devel@googlegroups.com Subject: [PATCH 4/5] deflater: additional mtime tests Date: Thu, 29 Jun 2017 02:19:14 +0000 Message-Id: <20170629021915.22517-5-e@80x24.org> In-Reply-To: <20170629021915.22517-1-e@80x24.org> References: <20170629021915.22517-1-e@80x24.org> X-Original-Sender: e@80x24.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of e@80x24.org designates 2600:3c01::f03c:91ff:fe96:f5d6 as permitted sender) smtp.mailfrom=e@80x24.org Reply-To: rack-devel@googlegroups.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: X-Google-Group-Id: 486215384060 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , The next commit will reduce long-lived Time objects. Regardless of whether that commit is acceptable, having extra tests for existing mtime behavior cannot hurt. For testing responses with the Last-Modified header, setting a random date in the past should make failure to preserve mtime in the gzip header more apparent. --- test/spec_deflater.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/spec_deflater.rb b/test/spec_deflater.rb index 410a143..4a337ca 100644 --- a/test/spec_deflater.rb +++ b/test/spec_deflater.rb @@ -44,6 +44,8 @@ describe Rack::Deflater do [accept_encoding, accept_encoding.dup] end + start = Time.now.to_i + # build response status, headers, body = build_response( options['app_status'] || expected_status, @@ -67,6 +69,13 @@ describe Rack::Deflater do when 'gzip' io = StringIO.new(body_text) gz = Zlib::GzipReader.new(io) + mtime = gz.mtime.to_i + if last_mod = headers['Last-Modified'] + Time.httpdate(last_mod).to_i.must_equal mtime + else + mtime.must_be(:<=, Time.now.to_i) + mtime.must_be(:>=, start.to_i) + end tmp = gz.read gz.close tmp @@ -243,7 +252,7 @@ describe Rack::Deflater do end it 'handle gzip response with Last-Modified header' do - last_modified = Time.now.httpdate + last_modified = Time.at(123).httpdate options = { 'response_headers' => { 'Content-Type' => 'text/plain', -- EW -- --- You received this message because you are subscribed to the Google Groups "Rack Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.