rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Rack-compatible server issues
@ 2009-12-05  2:04 Kevin Williams
  2009-12-05  6:42 ` Matt Todd
  2009-12-05  6:43 ` Michael Fellinger
  0 siblings, 2 replies; 8+ messages in thread
From: Kevin Williams @ 2009-12-05  2:04 UTC (permalink / raw)
  To: rack-devel

I'm implementing a Rack-compatible server for JRuby. I'm having issues
with complex apps returning bad data. Simple lambda apps run fine, but
when a Rack::Builder -created app is used, weird stuff happens.

http://gist.github.com/249506

If I pass just the lambda, my server runs fine, but if I pass the
whole builder-created app (any combination of middleware), I get one
of the middleware classes returned from the #call(env) method.

I thought once my server makes the top @app.call(env) call, it's all
Rack middleware and the user's app chained together. Shouldn't I get
the result of the user's app back to my server no matter what? What
could I be doing wrong that would cause this odd result?

Kevin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rack-compatible server issues
  2009-12-05  2:04 Rack-compatible server issues Kevin Williams
@ 2009-12-05  6:42 ` Matt Todd
  2009-12-05 15:51   ` Kevin Williams
  2009-12-05  6:43 ` Michael Fellinger
  1 sibling, 1 reply; 8+ messages in thread
From: Matt Todd @ 2009-12-05  6:42 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

>
> http://gist.github.com/249506
>
> If I pass just the lambda, my server runs fine, but if I pass the
> whole builder-created app (any combination of middleware), I get one
> of the middleware classes returned from the #call(env) method.
>

In that code, you're calling a use after the lambda... that lambda is
essentially disappearing. You should return that lambda.

If it's any value, I've never liked using the builder personally.

Matt



-- 
Matt Todd
Highgroove Studios
www.highgroove.com
cell: 404-314-2612
blog: maraby.org

Scout - Web Monitoring and Reporting Software
www.scoutapp.com

[-- Attachment #2: Type: text/html, Size: 1225 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rack-compatible server issues
  2009-12-05  2:04 Rack-compatible server issues Kevin Williams
  2009-12-05  6:42 ` Matt Todd
@ 2009-12-05  6:43 ` Michael Fellinger
  2009-12-05 16:00   ` Kevin Williams
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Fellinger @ 2009-12-05  6:43 UTC (permalink / raw)
  To: rack-devel

Structure it like this:

http://pastr.it/16475


On Sat, Dec 5, 2009 at 11:04 AM, Kevin Williams <kevwil@gmail.com> wrote:
> I'm implementing a Rack-compatible server for JRuby. I'm having issues
> with complex apps returning bad data. Simple lambda apps run fine, but
> when a Rack::Builder -created app is used, weird stuff happens.
>
> http://gist.github.com/249506
>
> If I pass just the lambda, my server runs fine, but if I pass the
> whole builder-created app (any combination of middleware), I get one
> of the middleware classes returned from the #call(env) method.
>
> I thought once my server makes the top @app.call(env) call, it's all
> Rack middleware and the user's app chained together. Shouldn't I get
> the result of the user's app back to my server no matter what? What
> could I be doing wrong that would cause this odd result?
>
> Kevin
>



-- 
Michael Fellinger
CTO, The Rubyists, LLC
972-996-5199

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rack-compatible server issues
  2009-12-05  6:42 ` Matt Todd
@ 2009-12-05 15:51   ` Kevin Williams
  2009-12-05 20:49     ` Iñaki Baz Castillo
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Williams @ 2009-12-05 15:51 UTC (permalink / raw)
  To: rack-devel

On Fri, Dec 4, 2009 at 11:42 PM, Matt Todd <chiology@gmail.com> wrote:
>> http://gist.github.com/249506
>>
>> If I pass just the lambda, my server runs fine, but if I pass the
>> whole builder-created app (any combination of middleware), I get one
>> of the middleware classes returned from the #call(env) method.
>
> In that code, you're calling a use after the lambda... that lambda is
> essentially disappearing. You should return that lambda.
> If it's any value, I've never liked using the builder personally.
> Matt

That makes sense. I can't say I'm a big fan of Builder either, but
I'll have to make it work for Rack apps that want to be created that
way. I haven't even come close to making the URLMap work, either.

The Rack docs say to run Rack::Lint before and after. Is that just an
old statement, or is there a better way to run Lint?

Kevin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rack-compatible server issues
  2009-12-05  6:43 ` Michael Fellinger
@ 2009-12-05 16:00   ` Kevin Williams
  2009-12-05 17:05     ` Kevin Williams
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Williams @ 2009-12-05 16:00 UTC (permalink / raw)
  To: rack-devel

Thanks for the clean example!!!

What I get as output is:

200
Content-Typetext/plain
#<Rack::CommonLogger:0x1235db0>

I expect to see 'OK' instead of the CommonLogger instance as the 3rd
element in the returned array.

I seem to always have either that problem, or I get a Rack::Lint
returned as the only element returned. This is really problematic as I
expect a 'status' number as the first element.


On Fri, Dec 4, 2009 at 11:43 PM, Michael Fellinger
<m.fellinger@gmail.com> wrote:
> Structure it like this:
>
> http://pastr.it/16475
>
>
> On Sat, Dec 5, 2009 at 11:04 AM, Kevin Williams <kevwil@gmail.com> wrote:
>> I'm implementing a Rack-compatible server for JRuby. I'm having issues
>> with complex apps returning bad data. Simple lambda apps run fine, but
>> when a Rack::Builder -created app is used, weird stuff happens.
>>
>> http://gist.github.com/249506
>>
>> If I pass just the lambda, my server runs fine, but if I pass the
>> whole builder-created app (any combination of middleware), I get one
>> of the middleware classes returned from the #call(env) method.
>>
>> I thought once my server makes the top @app.call(env) call, it's all
>> Rack middleware and the user's app chained together. Shouldn't I get
>> the result of the user's app back to my server no matter what? What
>> could I be doing wrong that would cause this odd result?
>>
>> Kevin
>>
>
>
>
> --
> Michael Fellinger
> CTO, The Rubyists, LLC
> 972-996-5199
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rack-compatible server issues
  2009-12-05 16:00   ` Kevin Williams
@ 2009-12-05 17:05     ` Kevin Williams
  0 siblings, 0 replies; 8+ messages in thread
From: Kevin Williams @ 2009-12-05 17:05 UTC (permalink / raw)
  To: rack-devel

replying to myself ....

My server code hasn't been handling the body correctly. I re-wrote the
body handling code to comply with the spec (respond to :each and yield
only Strings). Once I did that, these Rack middlewares and
Rack::Builder suddenly worked.


On Sat, Dec 5, 2009 at 9:00 AM, Kevin Williams <kevwil@gmail.com> wrote:
> Thanks for the clean example!!!
>
> What I get as output is:
>
> 200
> Content-Typetext/plain
> #<Rack::CommonLogger:0x1235db0>
>
> I expect to see 'OK' instead of the CommonLogger instance as the 3rd
> element in the returned array.
>
> I seem to always have either that problem, or I get a Rack::Lint
> returned as the only element returned. This is really problematic as I
> expect a 'status' number as the first element.
>
>
> On Fri, Dec 4, 2009 at 11:43 PM, Michael Fellinger
> <m.fellinger@gmail.com> wrote:
>> Structure it like this:
>>
>> http://pastr.it/16475
>>
>>
>> On Sat, Dec 5, 2009 at 11:04 AM, Kevin Williams <kevwil@gmail.com> wrote:
>>> I'm implementing a Rack-compatible server for JRuby. I'm having issues
>>> with complex apps returning bad data. Simple lambda apps run fine, but
>>> when a Rack::Builder -created app is used, weird stuff happens.
>>>
>>> http://gist.github.com/249506
>>>
>>> If I pass just the lambda, my server runs fine, but if I pass the
>>> whole builder-created app (any combination of middleware), I get one
>>> of the middleware classes returned from the #call(env) method.
>>>
>>> I thought once my server makes the top @app.call(env) call, it's all
>>> Rack middleware and the user's app chained together. Shouldn't I get
>>> the result of the user's app back to my server no matter what? What
>>> could I be doing wrong that would cause this odd result?
>>>
>>> Kevin
>>>
>>
>>
>>
>> --
>> Michael Fellinger
>> CTO, The Rubyists, LLC
>> 972-996-5199
>>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rack-compatible server issues
  2009-12-05 15:51   ` Kevin Williams
@ 2009-12-05 20:49     ` Iñaki Baz Castillo
  2009-12-05 22:55       ` Scytrin dai Kinthra
  0 siblings, 1 reply; 8+ messages in thread
From: Iñaki Baz Castillo @ 2009-12-05 20:49 UTC (permalink / raw)
  To: rack-devel

El Sábado, 5 de Diciembre de 2009, Kevin Williams escribió:
> That makes sense. I can't say I'm a big fan of Builder either

Perhaps I miss something but, which is the other way to create a Rack app 
without using Builder? 


-- 
Iñaki Baz Castillo <ibc@aliax.net>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Rack-compatible server issues
  2009-12-05 20:49     ` Iñaki Baz Castillo
@ 2009-12-05 22:55       ` Scytrin dai Kinthra
  0 siblings, 0 replies; 8+ messages in thread
From: Scytrin dai Kinthra @ 2009-12-05 22:55 UTC (permalink / raw)
  To: rack-devel

Starting the script directly, rackup is only one way to do things.

On Sat, Dec 5, 2009 at 12:49, Iñaki Baz Castillo <ibc@aliax.net> wrote:
> El Sábado, 5 de Diciembre de 2009, Kevin Williams escribió:
>> That makes sense. I can't say I'm a big fan of Builder either
>
> Perhaps I miss something but, which is the other way to create a Rack app
> without using Builder?
>
>
> --
> Iñaki Baz Castillo <ibc@aliax.net>
>



-- 
stadik.net

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-12-05 22:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-05  2:04 Rack-compatible server issues Kevin Williams
2009-12-05  6:42 ` Matt Todd
2009-12-05 15:51   ` Kevin Williams
2009-12-05 20:49     ` Iñaki Baz Castillo
2009-12-05 22:55       ` Scytrin dai Kinthra
2009-12-05  6:43 ` Michael Fellinger
2009-12-05 16:00   ` Kevin Williams
2009-12-05 17:05     ` Kevin Williams

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).