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: AS33070 50.56.128.0/17 X-Spam-Status: No, score=1.3 required=5.0 tests=RDNS_NONE,T_DKIM_INVALID shortcircuit=no autolearn=no version=3.3.2 X-Original-To: archivist@yhbt.net Delivered-To: archivist@dcvr.yhbt.net Received: from rubyforge.org (unknown [50.56.192.79]) by dcvr.yhbt.net (Postfix) with ESMTP id 4927A1F433 for ; Thu, 13 Jun 2013 20:13:26 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 3A59F2E14F; Thu, 13 Jun 2013 20:13:27 +0000 (UTC) X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by rubyforge.org (Postfix) with ESMTP id 31B312E145 for ; Thu, 13 Jun 2013 19:34:33 +0000 (UTC) Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 92FA920D9A; Thu, 13 Jun 2013 15:34:31 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute6.internal (MEProxy); Thu, 13 Jun 2013 15:34:31 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=titanous.com; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=mesmtp; bh=aMSvmKfFdZl4qKNMGRDmvouKKhw=; b=tSQpa47iqmfur2a3T4NC61JWZ5jJ Dz8sI7CwTIlNzvAdpqHtdsYmO9LCnqQeqxQ6mLsrY3AcxHjcI5NSocMcrX0nkXcG Jhhi/Rokem6dsfRR5aBd+k9e5AC+W9/tiB2embD6L7Oyal2VL3+CLvz46KsiTohO Il1kQ5d8pV6ky9Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id :references:to; s=smtpout; bh=aMSvmKfFdZl4qKNMGRDmvouKKhw=; b=sT xCmO/fg77vFCjuT6461nqpq/gYsaQSU/9h8kJIcpH3oggvlKxs0m4bHmtpqS/ioV hY5epkol6OUv78Jmh3/DqFLQkGn90qcuW7LWBFhkrLKppvb+PlFN3SB/nDP/SaLl 8LFkJozren3kxNePeDJICxJd0vlNWydAXUa5DZcjU= X-Sasl-enc: sWyNGrN2LTJW1/5YTRNhXm6sNraFYT7+gbLRs3amHqNl 1371152071 Received: from [10.10.10.124] (unknown [71.185.221.139]) by mail.messagingengine.com (Postfix) with ESMTPA id 5D1F1680275; Thu, 13 Jun 2013 15:34:31 -0400 (EDT) Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: HEAD responses contain body From: Jonathan Rudenberg In-Reply-To: <46E5FBD0-C0EF-4338-9B78-1A8ED036A47F@titanous.com> Date: Thu, 13 Jun 2013 15:34:31 -0400 Message-Id: <97CE040B-C9AC-4CC9-B45E-358F1553A6DB@titanous.com> References: <9AEB1922-1C40-4E20-868B-9B890C22905E@titanous.com> <20130613182238.GA11842@dcvr.yhbt.net> <3CDFEE4E-AD32-4C0B-A90A-CEADC003B928@titanous.com> <20130613192145.GA11696@dcvr.yhbt.net> <46E5FBD0-C0EF-4338-9B78-1A8ED036A47F@titanous.com> To: Eric Wong X-Mailer: Apple Mail (2.1508) Cc: unicorn list X-BeenThere: mongrel-unicorn@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: mongrel-unicorn-bounces@rubyforge.org Errors-To: mongrel-unicorn-bounces@rubyforge.org On Jun 13, 2013, at 3:28 PM, Jonathan Rudenberg wrote: > > On Jun 13, 2013, at 3:21 PM, Eric Wong wrote: > >> Jonathan Rudenberg wrote: >>> On Jun 13, 2013, at 2:22 PM, Eric Wong wrote: >>>> Jonathan Rudenberg wrote: >>>>> RFC 2616 section 9.4[1] states: >>>>> >>>>>> The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. >>>>> >>>>> A HEAD request against this simple Rack app running on unicorn-4.6.2: >>>>> >>>>> require 'rack' >>>>> >>>> >>>> + use Rack::Head >>>> >>>>> run lambda { |env| [200, {}, []] } >>>> >>>> The Rack::Head middleware should be used to correctly strip HEAD >>>> responses of their bodies (frameworks such as Rails/Sinatra should >>>> already add Rack::Head to the middleware stack for you) >>> >>> This does not change the result, as the Rack::Head implementation looks like this: >>> >>> def call(env) >>> status, headers, body = @app.call(env) >>> >>> if env["REQUEST_METHOD"] == "HEAD" >>> body.close if body.respond_to? :close >>> [status, headers, []] >>> else >>> [status, headers, body] >>> end >>> end >> >> OK, I think you were hitting another problem because you were lacking >> Rack::ContentType >> >> Try the following: >> -----------------------8<--------------------- >> require 'rack' >> use Rack::ContentLength # less ambiguous than Rack::Chunked adding '0' >> use Rack::Head >> use Rack::ContentType >> run lambda { |env| [200, {}, []] } >> -----------------------8<--------------------- > > Thanks, this stack works. > >> I added the Rack::ContentLength (it's already in the default middleware >> stack) since I believe Rack::Chunked adding the '0' is a violation of >> rfc2616... I'll need to read more closely to be sure. > > Hmm, so this is a bug in Rack::Chunked? My reading of the spec says that the '0' is incorrect. Actually, the solution is that Rack::Head needs to come before Rack::Chunked. Perhaps Rack's default development stack should include this? _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying