From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.227.175.12 with SMTP id v12csp25384wbz; Sun, 21 Apr 2013 08:41:14 -0700 (PDT) Return-Path: Received-SPF: pass (google.com: domain of rack-devel+bncBCY5V57U5EPBBFMR2CFQKGQESLJUMQI@googlegroups.com designates 10.50.180.197 as permitted sender) client-ip=10.50.180.197 Authentication-Results: mr.google.com; spf=pass (google.com: domain of rack-devel+bncBCY5V57U5EPBBFMR2CFQKGQESLJUMQI@googlegroups.com designates 10.50.180.197 as permitted sender) smtp.mail=rack-devel+bncBCY5V57U5EPBBFMR2CFQKGQESLJUMQI@googlegroups.com; dkim=pass header.i=@googlegroups.com X-Received: from mr.google.com ([10.50.180.197]) by 10.50.180.197 with SMTP id dq5mr19414479igc.17.1366558872197 (num_hops = 1); Sun, 21 Apr 2013 08:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-received:x-beenthere:x-received:received-spf:mime-version:subject :from:in-reply-to:date:message-id:references:to:x-mailer :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; bh=E9lTqk+rwji1U8dd0Fk1t0QPUA/G6EXTA3Uj6fkWdsM=; b=Mx1ar71d2prX9g79N6JQSuDC3qvZhp5RCB9munPa963RDy+6cKwyqJ+/5DoxbjsEyF 1gyQnipxCnEN8shu7vNp8iol9qiGLGgqvYWWPT/i3bVXVgFVvCyJkAS0sbOAwtdCy3Pr jhCieSt92NTLdgGNxvu/9nlzJUe4W2Ro5e5HasyzO2q9S5rXCkSG5Mp6vPJCUHemRM2S fzW+pUVsunh+MHXWoprJNZvG24PJ/HFzjxJFNfsE4AGL44hjg0D1ICTxhVGfKgAPGQN8 +wNO+hsuLOh9U0gSMYl+BeCKXLcCmY+3MyKLOkdSKt3DSzmduIynkeot4Vm+Vg788iIn IbLQ== X-Received: by 10.50.180.197 with SMTP id dq5mr4743282igc.17.1366558871715; Sun, 21 Apr 2013 08:41:11 -0700 (PDT) X-BeenThere: rack-devel@googlegroups.com Received: by 10.50.222.170 with SMTP id qn10ls1482342igc.6.gmail; Sun, 21 Apr 2013 08:41:09 -0700 (PDT) X-Received: by 10.42.100.135 with SMTP id a7mr17293717ico.11.1366558869014; Sun, 21 Apr 2013 08:41:09 -0700 (PDT) Received: from titanium.spork.in (titanium.spork.in. [67.207.128.196]) by gmr-mx.google.com with ESMTP id l10si1112903ige.0.2013.04.21.08.41.08; Sun, 21 Apr 2013 08:41:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of g@spork.in designates 67.207.128.196 as permitted sender) client-ip=67.207.128.196; Received: from [172.20.10.4] (36.117.224.49.dyn.cust.vf.net.nz [49.224.117.36]) (Authenticated sender: tim@spork.in) by titanium.spork.in (Postfix) with ESMTPSA id DD1E0B02E3 for ; Sun, 21 Apr 2013 08:41:07 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: [RFC/PATCH] lint: additional response checking/skipping for hijack From: Tim Carey-Smith In-Reply-To: Date: Mon, 22 Apr 2013 03:41:05 +1200 Message-Id: References: <20130123002048.GA362@dcvr.yhbt.net> To: rack-devel@googlegroups.com X-Mailer: Apple Mail (2.1503) X-Original-Sender: g@spork.in X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of g@spork.in designates 67.207.128.196 as permitted sender) smtp.mail=g@spork.in 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=ISO-8859-1 Could you update the examples on the original issue to behave in this way? This is a point of confusion, I think. Perhaps this could be added to the SPEC as well? On Jan 29, 2013, at 11:01 AM, James Tucker wrote: > I'd generally recommend that the hijacking app return valid stub data, > something like: [200, {}, []]. > > > On 22 January 2013 16:20, Eric Wong wrote: > >> Not a serious patch for now, at least not all of it. >> I suspect middlewares will break badly if the body.each/body.close >> checks are enforced. >> >> --- >> lib/rack/lint.rb | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/lib/rack/lint.rb b/lib/rack/lint.rb >> index 1bc2127..f895772 100644 >> --- a/lib/rack/lint.rb >> +++ b/lib/rack/lint.rb >> @@ -9,6 +9,7 @@ class Lint >> def initialize(app) >> @app = app >> @content_length = nil >> + @response_hijacked = false >> end >> >> # :stopdoc: >> @@ -47,6 +48,15 @@ def _call(env) >> >> ## and returns an Array of exactly three values: >> status, headers, @body = @app.call(env) >> + >> + # hijacked requests may not give a valid response, do not check them >> + if env.include?("rack.hijack_io") >> + # request hijacking implies response hijacking, this will ensure >> + # the response body raises if body.each or body.close gets called >> + @response_hijacked = true >> + return [ status, headers, self ] >> + end >> + >> ## The *status*, >> check_status status >> ## the *headers*, >> @@ -530,6 +540,7 @@ def check_hijack_response(headers, env) >> headers['rack.hijack'] = proc do |io| >> original_hijack.call HijackWrapper.new(io) >> end >> + @response_hijacked = true >> else >> ## >> ## The special response header rack.hijack must only be >> set >> @@ -636,6 +647,9 @@ def verify_content_length(bytes) >> >> ## === The Body >> def each >> + assert("server is not attempting to iterate hijacked response >> body") { >> + @response_hijacked == false >> + } >> @closed = false >> bytes = 0 >> >> @@ -683,6 +697,9 @@ def each >> end >> >> def close >> + assert("server is not attempting to close hijacked response") { >> + @response_hijacked == false >> + } >> @closed = true >> @body.close if @body.respond_to?(:close) >> end >> -- >> Eric Wong >> > > -- > > --- > You received this message because you are subscribed to the Google Groups "Rack Development" group. > To unsubscribe from this group, send email to rack-devel+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- --- 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/groups/opt_out.