From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.229.70.129 with SMTP id d1cs65827qcj; Fri, 3 Jun 2011 22:33:50 -0700 (PDT) Return-Path: Received-SPF: pass (google.com: domain of rack-devel+bncCNSYpqGTFhC7h6fvBBoE7hGsRg@googlegroups.com designates 10.68.21.130 as permitted sender) client-ip=10.68.21.130; Authentication-Results: mr.google.com; spf=pass (google.com: domain of rack-devel+bncCNSYpqGTFhC7h6fvBBoE7hGsRg@googlegroups.com designates 10.68.21.130 as permitted sender) smtp.mail=rack-devel+bncCNSYpqGTFhC7h6fvBBoE7hGsRg@googlegroups.com; dkim=pass header.i=rack-devel+bncCNSYpqGTFhC7h6fvBBoE7hGsRg@googlegroups.com Received: from mr.google.com ([10.68.21.130]) by 10.68.21.130 with SMTP id v2mr1377497pbe.9.1307165629612 (num_hops = 1); Fri, 03 Jun 2011 22:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:x-beenthere:received-spf:date:from:to:subject :message-id:references:mime-version:in-reply-to:user-agent :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:x-google-group-id:list-post :list-help:list-archive:sender:list-subscribe:list-unsubscribe :content-type:content-disposition; bh=MWWspPUdgIdbyOUHLPiJO3bsgjGxynXnCDNgBqqnFWQ=; b=Z2ZC3KSnJBZkOvZ+KZWcr/OXiDcAQ0EHMLO+crCpHOD+XNhEiOE3Og4vgxcWM32t74 T/AJe7fMf9wqmG57h8ElmHJZs2+jD1OvSpNJ9HjGbaWAt1ayPptQGslaX4RAci+tVhDV uHuqSIZ+FIEiXTycYVn+I+eNZtXt5V5Paq+vY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:date:from:to:subject:message-id:references :mime-version:in-reply-to:user-agent:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type:content-disposition; b=B31sfTOPMuDNBKhy//hqHfYc93lSbRUNS9ml4XUGWBPiZJxRQPwRwC4305gfrjTudL aRluMWHObn++rUZZk0tyfGM7KAKaFjwsycd+VHImRHVGs/Dc6SV8JTxdu33hm6SAIln/ xt9pTaXREiEXVS2t4kWwj0dCwkumHk3LjGnUo= Received: by 10.68.21.130 with SMTP id v2mr400181pbe.9.1307165627102; Fri, 03 Jun 2011 22:33:47 -0700 (PDT) X-BeenThere: rack-devel@googlegroups.com Received: by 10.68.39.41 with SMTP id m9ls1029298pbk.2.gmail; Fri, 03 Jun 2011 22:33:46 -0700 (PDT) Received: by 10.68.30.36 with SMTP id p4mr547123pbh.42.1307165626224; Fri, 03 Jun 2011 22:33:46 -0700 (PDT) Received: by 10.68.30.36 with SMTP id p4mr547122pbh.42.1307165626213; Fri, 03 Jun 2011 22:33:46 -0700 (PDT) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by gmr-mx.google.com with ESMTP id f8si5827073pbc.0.2011.06.03.22.33.45; Fri, 03 Jun 2011 22:33:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of normalperson@yhbt.net designates 64.71.152.64 as permitted sender) client-ip=64.71.152.64; Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 40A64212CD; Sat, 4 Jun 2011 05:33:44 +0000 (UTC) Date: Fri, 3 Jun 2011 22:33:38 -0700 From: Eric Wong To: rack-devel@googlegroups.com Subject: Re: Middleware and post-request processing Message-ID: <20110604053337.GA15594@dcvr.yhbt.net> References: <2cac8438-1819-4887-bce9-9a99578539db@f31g2000pri.googlegroups.com> MIME-Version: 1.0 In-Reply-To: <2cac8438-1819-4887-bce9-9a99578539db@f31g2000pri.googlegroups.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Original-Sender: normalperson@yhbt.net X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of normalperson@yhbt.net designates 64.71.152.64 as permitted sender) smtp.mail=normalperson@yhbt.net Reply-To: rack-devel@googlegroups.com 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: Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: text/plain; charset=us-ascii Content-Disposition: inline ghazel wrote: > It seems to me that Rack is in need of a new post-response stage of > processing. This stage would occur after the response is fully written > and the client is unblocked, and before the next request is processed. I remember Aaron Patterson started thinking/blogging about it, at least. search: "rack api awkward" > Similar to what OobGC ( http://bogomips.org/unicorn.git/tree/lib/unicorn/oob_gc.rb#n59 > ) accomplishes, it is sometimes useful to perform additional > operations after the response is written without blocking the client. I should note OobGC used to (really) be middleware, but I had to rewrite it (as a Unicorn module) because Unicorn also needs to support middleware that captures the block passed to body#each and reuses the block in body#close. > This proposal would entail something like a single function which is > called on each middleware after the response is written to the client > and the socket is closed (depending on the server implementation). For > servers which have no ability to not block the client or delay further > requests the function should still be called, and the impact would be > similar to the behavior today. Any new post-response stage should give information about whether a client is persistent or not (and maybe even if it started pipelining the next request). It would be great to have a standardized API that makes logging whether a connection is keepalive/pipelined, but Rack doesn't get into that right now. As an author of Rack servers, I'll continue the my conservative personal policy of not implementing new APIs unless: 1) it's added to the Rack spec, or 2) another widely-used server implements it (e.g. Thin with the async/deferred? stuff) -- Eric Wong