From: Magnus Holm <judofyr@gmail.com>
To: rack-devel <rack-devel@googlegroups.com>
Subject: Re: Should server.run block?
Date: Sun, 4 Nov 2012 12:09:54 +0100 [thread overview]
Message-ID: <CAJ367ffGiObxvEgFu3ZFLgeK4r7_1ruD2fHoCqzpwarn5v0QyQ@mail.gmail.com> (raw)
In-Reply-To: <51e063f8-e986-464b-9d5b-def5f1d908aa@googlegroups.com>
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 <oscar@oscardelben.com> 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
next prev parent reply other threads:[~2012-11-04 11:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-04 5:14 Should server.run block? Oscar Del Ben
2012-11-04 11:09 ` Magnus Holm [this message]
2012-11-04 17:59 ` Oscar Del Ben
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://groups.google.com/group/rack-devel
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJ367ffGiObxvEgFu3ZFLgeK4r7_1ruD2fHoCqzpwarn5v0QyQ@mail.gmail.com \
--to=rack-devel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).