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 D51591F433 for ; Thu, 13 Jun 2013 19:55:25 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 927D12E151; Thu, 13 Jun 2013 19:55:26 +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 6909E2E145 for ; Thu, 13 Jun 2013 19:28:31 +0000 (UTC) Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 8E0C720B8F; Thu, 13 Jun 2013 15:28:29 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute4.internal (MEProxy); Thu, 13 Jun 2013 15:28:29 -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=g6fZC2amahPNqtDA+2qVybn/pwU=; b=bBXs1fmlFFNHhMVl1BAKmaf0O+k4 A5Xae6jtAWAfqpCXygPxrLr6tc5O2eLGwNwFbFrMaZ207iYdC7qz4wV//brEveOf Fu+a38KG2RpCBLFlh3CwyzhIFH/ExMoiWSIzmQsLYG0Ip/ChA9KWo/TY6byrh1Xv VrHUjHD6ayl1eZY= 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=g6fZC2amahPNqtDA+2qVybn/pwU=; b=ct 7VNqakc4IEtuFYULZj3+R51IEVYT0DMliWLdOoLc1BAE8G/7MoD4x9bZaYUkWp5q krQt/+imkZazIPV3EP6tKv2lzD17I7esy6Uri+7A1sfPMPMQ8unMwhFQ2i6o7wuY cUJ1sVjzstII1b0UOOwdhubTSXVsbX99/oKs3eLGU= X-Sasl-enc: fISgeFZ+dxqIuTMq6oUPZHjL84j2OLqUuaZyjE4HE+WM 1371151709 Received: from [10.10.10.124] (unknown [71.185.221.139]) by mail.messagingengine.com (Postfix) with ESMTPA id 58E2F680235; Thu, 13 Jun 2013 15:28:29 -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: <20130613192145.GA11696@dcvr.yhbt.net> Date: Thu, 13 Jun 2013 15:28:29 -0400 Message-Id: <46E5FBD0-C0EF-4338-9B78-1A8ED036A47F@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> 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: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. _______________________________________________ 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