I'm giving cloudkit a spin (using version 0.11.0) and I've come up
with a problem when using passenger (passenger-2.1.1 beta) to serve
the rack app. (i.e. the bug doesn't appear with mongrel)
I've tentatively tracked this down to Request#json and in particular
sending the #rewind message to the request body (i.e rack input).
For whatever reason, using mongrel the body was an instance of
Rack::Lint::InputWrapper. Using passenger, it was an instance of
TCPSocket which doesn't have a #rewind message.
My solution was to see how rails 2.3 handled this problem. Josh Peek
wrote a rewindable_input middleware which basically wraps rack input
in a StringIO to ensure it's rewindable. Using this middleware => no
more exception.
On Thu, Mar 12, 2009 at 5:23 PM, Saimon Moore <saimonmo...@gmail.com> wrote:
> Hi Jon,
> I'm giving cloudkit a spin (using version 0.11.0) and I've come up
> with a problem when using passenger (passenger-2.1.1 beta) to serve
> the rack app. (i.e. the bug doesn't appear with mongrel)
> I've tentatively tracked this down to Request#json and in particular
> sending the #rewind message to the request body (i.e rack input).
> For whatever reason, using mongrel the body was an instance of
> Rack::Lint::InputWrapper. Using passenger, it was an instance of
> TCPSocket which doesn't have a #rewind message.
Saimon, thank you for tracking this down and bringing it up on the list. If
passenger is setting rack.input to something that does not respond to
#rewind, then it is violating the spec for Rack. That being the case, I like
the pragmatic solution that you provided, wrapping the input so that it is
rewindable in all cases. I'll do some experiments with Passenger just to
confirm this and if everything checks out, a patch for CloudKit may be in
order.
> My solution was to see how rails 2.3 handled this problem. Josh Peek
> wrote a rewindable_input middleware which basically wraps rack input
> in a StringIO to ensure it's rewindable. Using this middleware => no
> more exception.
Thanks Saimon, this helped me out a lot. I'm using cloudkit 0.11.1
and passenger 2.1.3. This problem originally revealed itself as a
"Premature end of script headers" error in the apache logs, but
eventually I arrived at your conclusion that the issue was with
#rewind. Looking forward to an official fix on this from cloudkit or
passenger, whoever wants the honor ;)
On Mar 13, 1:51 pm, Jon Crosby <jon.r.cro...@gmail.com> wrote:
> On Thu, Mar 12, 2009 at 5:23 PM, Saimon Moore <saimonmo...@gmail.com> wrote:
> > Hi Jon,
> > I'm giving cloudkit a spin (using version 0.11.0) and I've come up
> > with a problem when using passenger (passenger-2.1.1 beta) to serve
> > the rack app. (i.e. the bug doesn't appear with mongrel)
> > I've tentatively tracked this down to Request#json and in particular
> > sending the #rewind message to the request body (i.e rack input).
> > For whatever reason, using mongrel the body was an instance of
> > Rack::Lint::InputWrapper. Using passenger, it was an instance of
> > TCPSocket which doesn't have a #rewind message.
> Saimon, thank you for tracking this down and bringing it up on the list. If
> passenger is setting rack.input to something that does not respond to
> #rewind, then it is violating the spec for Rack. That being the case, I like
> the pragmatic solution that you provided, wrapping the input so that it is
> rewindable in all cases. I'll do some experiments with Passenger just to
> confirm this and if everything checks out, a patch for CloudKit may be in
> order.
> > My solution was to see how rails 2.3 handled this problem. Josh Peek
> > wrote a rewindable_input middleware which basically wraps rack input
> > in a StringIO to ensure it's rewindable. Using this middleware => no
> > more exception.
On Mon, Apr 6, 2009 at 4:53 PM, Ryan Garver <ragar...@gmail.com> wrote:
> Thanks Saimon, this helped me out a lot. I'm using cloudkit 0.11.1
> and passenger 2.1.3. This problem originally revealed itself as a
> "Premature end of script headers" error in the apache logs, but
> eventually I arrived at your conclusion that the issue was with
> #rewind. Looking forward to an official fix on this from cloudkit or
> passenger, whoever wants the honor ;)
> On Mar 13, 1:51 pm, Jon Crosby <jon.r.cro...@gmail.com> wrote:
>> On Thu, Mar 12, 2009 at 5:23 PM, Saimon Moore <saimonmo...@gmail.com> wrote:
>> > Hi Jon,
>> > I'm giving cloudkit a spin (using version 0.11.0) and I've come up
>> > with a problem when using passenger (passenger-2.1.1 beta) to serve
>> > the rack app. (i.e. the bug doesn't appear with mongrel)
>> > I've tentatively tracked this down to Request#json and in particular
>> > sending the #rewind message to the request body (i.e rack input).
>> > For whatever reason, using mongrel the body was an instance of
>> > Rack::Lint::InputWrapper. Using passenger, it was an instance of
>> > TCPSocket which doesn't have a #rewind message.
>> Saimon, thank you for tracking this down and bringing it up on the list. If
>> passenger is setting rack.input to something that does not respond to
>> #rewind, then it is violating the spec for Rack. That being the case, I like
>> the pragmatic solution that you provided, wrapping the input so that it is
>> rewindable in all cases. I'll do some experiments with Passenger just to
>> confirm this and if everything checks out, a patch for CloudKit may be in
>> order.
>> > My solution was to see how rails 2.3 handled this problem. Josh Peek
>> > wrote a rewindable_input middleware which basically wraps rack input
>> > in a StringIO to ensure it's rewindable. Using this middleware => no
>> > more exception.