From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.49.96.6 with SMTP id do6csp107341qeb; Sun, 4 Nov 2012 03:10:16 -0800 (PST) Return-Path: Received-SPF: pass (google.com: domain of rack-devel+bncBC7JX4G6SUEBBFU23GCAKGQEGH4AFYY@googlegroups.com designates 10.180.97.194 as permitted sender) client-ip=10.180.97.194 Authentication-Results: mr.google.com; spf=pass (google.com: domain of rack-devel+bncBC7JX4G6SUEBBFU23GCAKGQEGH4AFYY@googlegroups.com designates 10.180.97.194 as permitted sender) smtp.mail=rack-devel+bncBC7JX4G6SUEBBFU23GCAKGQEGH4AFYY@googlegroups.com; dkim=pass header.i=rack-devel+bncBC7JX4G6SUEBBFU23GCAKGQEGH4AFYY@googlegroups.com Received: from mr.google.com ([10.180.97.194]) by 10.180.97.194 with SMTP id ec2mr4126031wib.0.1352027416035 (num_hops = 1); Sun, 04 Nov 2012 03:10:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-beenthere:received-spf:mime-version:in-reply-to:references:from :date:message-id:subject:to: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=+zuZ7evicJacRKmhCESSpkskg9bDWSTiXMJuVh45fYo=; b=wuq5vueb/QjHupvzmGngni4jg8oIZd9MasAKhPQxDLiv/VPFJ9C3w4WJDekjvAzWE2 R9YQpazyvciNzauH63G0My7StWWetfDcNX15AAfkZfr42ET1iJnh4G32/1bd6OJWf129 qyVwbX4LkDHBENsk+cmLyod9At/VUpCfhPODVLwK1h9uLBPKMd7d8lHVw5hf6Xef3GUc YubRmMF7o2V0OfR//9H0HWG4LLlrE8S+3CBxC+Mwmef0NJXOMSAeBfc0q1UKtGl56vlH oXQfOVojUdO3qJF4/A6SWUczVgq8fZW3Kq9gtjuh+vXH0FJkM/m0sarJD5slqPLKYtbM BNvw== Received: by 10.180.97.194 with SMTP id ec2mr1125298wib.0.1352027415443; Sun, 04 Nov 2012 03:10:15 -0800 (PST) X-BeenThere: rack-devel@googlegroups.com Received: by 10.14.4.66 with SMTP id 42ls3740880eei.4.gmail; Sun, 04 Nov 2012 03:10:14 -0800 (PST) Received: by 10.14.199.6 with SMTP id w6mr6807033een.0.1352027414692; Sun, 04 Nov 2012 03:10:14 -0800 (PST) Received: by 10.14.199.6 with SMTP id w6mr6807032een.0.1352027414683; Sun, 04 Nov 2012 03:10:14 -0800 (PST) Received: from mail-ee0-f50.google.com (mail-ee0-f50.google.com [74.125.83.50]) by gmr-mx.google.com with ESMTPS id z47si2466789eel.0.2012.11.04.03.10.14 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 04 Nov 2012 03:10:14 -0800 (PST) Received-SPF: pass (google.com: domain of judofyr@gmail.com designates 74.125.83.50 as permitted sender) client-ip=74.125.83.50; Received: by mail-ee0-f50.google.com with SMTP id c41so2583389eek.9 for ; Sun, 04 Nov 2012 03:10:14 -0800 (PST) Received: by 10.14.194.72 with SMTP id l48mr25807303een.9.1352027414592; Sun, 04 Nov 2012 03:10:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.69.133 with HTTP; Sun, 4 Nov 2012 03:09:54 -0800 (PST) In-Reply-To: <51e063f8-e986-464b-9d5b-def5f1d908aa@googlegroups.com> References: <51e063f8-e986-464b-9d5b-def5f1d908aa@googlegroups.com> From: Magnus Holm Date: Sun, 4 Nov 2012 12:09:54 +0100 Message-ID: Subject: Re: Should server.run block? To: rack-devel X-Original-Sender: judofyr@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of judofyr@gmail.com designates 74.125.83.50 as permitted sender) smtp.mail=judofyr@gmail.com; dkim=pass header.i=@gmail.com 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=UTF-8 config.ru only specifies an app + middleware chain, not the server part. Rack::Builder doesn't run anything; it just builds up an app-object for you. In this case you should write a separate binary: app = Rack::Builder.parse_file("config.ru") Rack::Handler::Hare.run app On Sun, Nov 4, 2012 at 6:14 AM, Oscar Del Ben wrote: > > Hello, > > I'm trying to build a rack handler and I've noticed that if I don't block from server.run then Rack::Builder fails. In my config.ru file I do the following: > > Rack::Handler::Hare.run MyApp.new > > but then Rack::Builder fails to parse the file when calling the to_app method: > > def to_app > app = @map ? generate_map(@run, @map) : @run > fail "missing run or map statement" unless app > @use.reverse.inject(app) { |a,e| e[a] } > end > > The problem here is that I never call run explicitly from config.ru, since I want to use my custom handler, which doesn't block. > > I've looked into the thin source code and server.run actually blocks, so that Rack::Builder#to_app is never called. Is this how the server is supposed to behave or am I missing something? > > Many thanks, > > Oscar Del Ben